protected Polygon makeHull(double[][] pc){
  GrahamScanConvexHull2D hull=new GrahamScanConvexHull2D();
  double[] diag=new double[]{0,0};
  for (int j=0; j < pc.length; j++) {
    hull.add(pc[j]);
    hull.add(times(pc[j],-1));
    for (int k=j + 1; k < pc.length; k++) {
      double[] q=pc[k];
      double[] ppq=timesEquals(plus(pc[j],q),MathUtil.SQRTHALF);
      double[] pmq=timesEquals(minus(pc[j],q),MathUtil.SQRTHALF);
      hull.add(ppq);
      hull.add(times(ppq,-1));
      hull.add(pmq);
      hull.add(times(pmq,-1));
    }
    plusEquals(diag,pc[j]);
  }
  timesEquals(diag,1.0 / Math.sqrt(pc.length));
  hull.add(diag);
  hull.add(times(diag,-1));
  return hull.getHull();
}

protected Polygon makeHull ( double [ ] [ ] pc ) { GrahamScanConvexHull2D hull = new GrahamScanConvexHull2D ( ) ; double [ ] diag = new double [ ] { 0 , 0 } ; for ( int j = 0 ; j < pc . length ; j ++ ) { hull . add ( pc [ j ] ) ; hull . add ( times ( pc [ j ] , - 1 ) ) ; for ( int k = j + 1 ; k < pc . length ; k ++ ) { double [ ] q = pc [ k ] ; double [ ] ppq = timesEquals ( plus ( pc [ j ] , q ) , MathUtil . SQRTHALF ) ; double [ ] pmq = timesEquals ( minus ( pc [ j ] , q ) , MathUtil . SQRTHALF ) ; hull . add ( ppq ) ; hull . add ( times ( ppq , - 1 ) ) ; hull . add ( pmq ) ; hull . add ( times ( pmq , - 1 ) ) ; } plusEquals ( diag , pc [ j ] ) ; } timesEquals ( diag , 1.0 / Math . sqrt ( pc . length ) ) ; hull . add ( diag ) ; hull . add ( times ( diag , - 1 ) ) ; return hull . getHull ( ) ; }
build a convex hull to approximate the sphere .
