MATH-1450: fixing PolygonsSet to return correct last vertex for open loops
This commit is contained in:
parent
cfe0502990
commit
73f3e2b3d6
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue