Open
Description
The isInside
and contains
methods have the following test
if (area > 0) {
return winding == 1;
} else {
return winding == 0;
}
I believe the code should be
if (area > 0) {
return winding == 1;
} else {
return winding == -1;
}
This can be tested with the following simple example
double[] xcoords0 = {0.0, 0.0, 10.0, 10.0, 0.0};
double[] ycoords0 = {0.0, 10.0, 10.0, 0.0, 0.0};
LinearRing2D ringCW = new LinearRing2D(xcoords0, ycoords0);
// anti-clockwise
double[] xcoords1 = {0.0, 10.0, 10.0, 0.0, 0.0};
double[] ycoords1 = {0.0, 0.0, 10.0, 10.0, 0.0};
LinearRing2D ringACW = new LinearRing2D(xcoords1, ycoords1);
System.out.println(ringCW.isInside(1.0, 1.0));
System.out.println(ringCW.isInside(10.5, 10.5));
System.out.println(ringACW.isInside(1.0, 1.0));
System.out.println(ringACW.isInside(10.5, 10.5));
Metadata
Metadata
Assignees
Labels
No labels