I'm trying to test whether a ring of coordinates is clockwise or counter-clockwise. As far as I can see, there is a method CGAlgorithms.isCCW
exactly for that. However, whatever ring I supply to that method, the result is the opposite of the expected, that is, it says that a ring is counter-clockwise when I expect it to be clockwise and vice versa.
boolean ccw = CGAlgorithms.isCCW(new Coordinate[]{
new Coordinate(20, 0),
new Coordinate(0, 0),
new Coordinate(0, 20),
new Coordinate(20, 20),
new Coordinate(20, 0)
});
System.out.println(ccw); // Outputs false, I expected true
I tried with different coordinate arrays and with two different versions of the library (1.14-SNAPSHOT and 1.8)
Am I missing something?
Just realized that method uses y-up coordinate system, when I imagined it to be y-down.