Commit ea01c277 authored by Riegel's avatar Riegel
Browse files

Fix overly sensitive null line check

Slight adjustment of null line check to account for intersection lines of
vertex-to-polygon intersections.
parent 4b8e8c80
......@@ -154,7 +154,8 @@ public class IntersectPlanarPolygons {
List<PolygonPolygonIntersection> intersections, double epsilon) {
// check if both polygons have this point in common
if (!sharingBothPolygonsThisPoint(p1, p2, point, epsilon)) {
PolyLine pPL = new PolyLine(new Coordinate3d(point), new Coordinate3d(point));
Coordinate3d realPointCoordinate = new Coordinate3d(point);
PolyLine pPL = new PolyLine(realPointCoordinate, realPointCoordinate);
PolygonPolygonIntersection pPPI = new PolygonPolygonIntersection(p1, p2, pPL);
intersections.add(pPPI);
}
......
......@@ -79,7 +79,7 @@ public class PolyLine extends BaseEntity {
}
public boolean isNullLine() {
return isNullLine(0.00);
return isNullLine(0.0000001);
}
......@@ -88,6 +88,13 @@ public class PolyLine extends BaseEntity {
if (mpFirst == null || mpLast == null) {
return true;
}
// Check if same point object is start and end
if (mpFirst == mpLast){
Point3d start = mpFirst.getStart().getPoint();
Point3d end = mpLast.getEnd().getPoint();
// If start- and endpoint same object: -> not null line, intersection on a vertex
if(start == end) return false;
}
PolyLineSegment currentSegment = mpFirst;
double length = 0.00;
// Add length of all segments, starting from mpFirst
......@@ -108,7 +115,7 @@ public class PolyLine extends BaseEntity {
length += segmentLength;
}
// Check if total length is less than the set tolerance
return length <= tolerance;
return length < tolerance;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment