2 import java
.util
.Comparator
;
5 * An utility class to sort the polygon vertices, is extended by AntiClockSort
10 public abstract class PolygonSorter
implements Comparator
<PointDouble
> {
14 public PolygonSorter(double[][] podoubles
) {
15 this.center
= calcCenter(podoubles
);
19 * returns the point representing the center of a polygon
21 final PointDouble
calcCenter(double[][] podoubles
) {
24 for (double[] podouble
: podoubles
) {
28 return new PointDouble(sumx
/ podoubles
.length
, sumy
/ podoubles
.length
);
32 public abstract int compare(PointDouble a
, PointDouble b
);