diff --git a/README.md b/README.md index 02ee3a2..019b2e0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The library is published on Maven Central. For Maven, you can include the follow org.geolatte geolatte-geom - 1.8.0 + 1.9.0 ``` diff --git a/geom/src/main/java/org/geolatte/geom/GeometryPositionEquality.java b/geom/src/main/java/org/geolatte/geom/GeometryPositionEquality.java index 5c63142..1949d58 100644 --- a/geom/src/main/java/org/geolatte/geom/GeometryPositionEquality.java +++ b/geom/src/main/java/org/geolatte/geom/GeometryPositionEquality.java @@ -59,7 +59,8 @@ public GeometryPositionEquality() { this.pointSeqEq = new PositionSequencePositionEquality(pointEquality); } - + //FIXME - provide a means to also inject an PositionSequenceEquality, e.g. + // for rings equal except one is shifted n positions w.r.t the other. /** diff --git a/geom/src/main/java/org/geolatte/geom/cga/NumericalMethods.java b/geom/src/main/java/org/geolatte/geom/cga/NumericalMethods.java index 6f2e0ac..f0585b6 100644 --- a/geom/src/main/java/org/geolatte/geom/cga/NumericalMethods.java +++ b/geom/src/main/java/org/geolatte/geom/cga/NumericalMethods.java @@ -128,7 +128,7 @@ public static boolean isCounterClockwise(LinearRing ring) { * This uses Newell's method (see Graphics Gems III, V. 5) * * @param ring the linear ring - * @return +1 if the specified ring is clockwise, -1 if counterclockwise, 0 if all vertices are collinear + * @return -1 if the specified ring is clockwise, +1 if counterclockwise, 0 if all vertices are collinear */ public static double orient2d(LinearRing ring) { return orient2d(ring.getPositions()); diff --git a/geom/src/test/java/org/geolatte/geom/cga/NumericalMethodsTest.java b/geom/src/test/java/org/geolatte/geom/cga/NumericalMethodsTest.java index a29208d..33c8db7 100644 --- a/geom/src/test/java/org/geolatte/geom/cga/NumericalMethodsTest.java +++ b/geom/src/test/java/org/geolatte/geom/cga/NumericalMethodsTest.java @@ -127,11 +127,15 @@ public void testColinearZigZag() { @Test public void testCounterClockwiseLineString() { - LinearRing cwLinestring = ring(xy, c(0, 0), c(1, 0), c(2, 0.5), c(1, -1), c(0, 0)); - LinearRing ccwLinestring = ring(xy, c(0, 0), c(1, 0), c(2, 0.5), c(1, 0.5), c(0, 0)); + LinearRing cwLinestring = ring(xy, c(0, 0), c(0, 1), c(1, 1), c(1, 0), c(0, 0)); + LinearRing ccwLinestring = ring(xy, c(0, 0), c(1, 0), c(1, 1), c(0, 1), c(0, 0)); assertFalse(NumericalMethods.isCounterClockwise(cwLinestring)); + assertEquals((int)orient2d(cwLinestring), -1); + assertTrue(NumericalMethods.isCounterClockwise(ccwLinestring)); + assertEquals((int)orient2d(ccwLinestring), 1); + } @Test