Polygon chres = hull.getHull();
return chres;
}
protected Polygon makeHullComplex(Vector[] pc) {
GrahamScanConvexHull2D hull = new GrahamScanConvexHull2D();
Vector diag = new Vector(0, 0);
for(int j = 0; j < pc.length; j++) {
hull.add(pc[j]);
hull.add(pc[j].times(-1));
for(int k = j + 1; k < pc.length; k++) {
Vector q = pc[k];
Vector ppq = pc[j].plus(q).timesEquals(MathUtil.SQRTHALF);
Vector pmq = pc[j].minus(q).timesEquals(MathUtil.SQRTHALF);
hull.add(ppq);
hull.add(ppq.times(-1));
hull.add(pmq);
hull.add(pmq.times(-1));
for(int l = k + 1; l < pc.length; l++) {
Vector r = pc[k];
Vector ppqpr = ppq.plus(r).timesEquals(Math.sqrt(1 / 3.));
Vector pmqpr = pmq.plus(r).timesEquals(Math.sqrt(1 / 3.));
Vector ppqmr = ppq.minus(r).timesEquals(Math.sqrt(1 / 3.));
Vector pmqmr = pmq.minus(r).timesEquals(Math.sqrt(1 / 3.));
hull.add(ppqpr);
hull.add(ppqpr.times(-1));
hull.add(pmqpr);
hull.add(pmqpr.times(-1));
hull.add(ppqmr);
hull.add(ppqmr.times(-1));
hull.add(pmqmr);
hull.add(pmqmr.times(-1));
}
}
diag.plusEquals(pc[j]);
}
diag.timesEquals(1.0 / Math.sqrt(pc.length));
hull.add(diag);
hull.add(diag.times(-1));
Polygon chres = hull.getHull();
return chres;
}