MATH-1450: fixing PolygonsSet to return correct last vertex for open loops

This commit is contained in:
darkma773r 2018-02-10 23:44:16 -05:00
parent cfe0502990
commit 73f3e2b3d6
2 changed files with 2 additions and 4 deletions

View File

@ -689,9 +689,7 @@ public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> {
if (j < (array.length - 1)) {
// current point
array[j++] = segment.getEnd();
}
if (j == (array.length - 1)) {
} else if (j == (array.length - 1)) {
// last dummy point
double x = segment.getLine().toSubSpace(segment.getStart()).getX();
x += FastMath.max(1.0, FastMath.abs(x / 2));

View File

@ -191,7 +191,7 @@ public class PolygonsSetTest {
checkPointsEqual(new Cartesian2D(0, 1), loop[1], tolerance);
checkPointsEqual(new Cartesian2D(0, 0), loop[2], tolerance);
checkPointsEqual(new Cartesian2D(1, 0), loop[3], tolerance);
checkPointsEqual(new Cartesian2D(1, 0), loop[4], tolerance);
checkPointsEqual(new Cartesian2D(1, 1), loop[4], tolerance);
}
@Test