Fix RelateOp for a snapped line boundary point #839
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently two issues were reported in PostGIS (this and this) about inconsistent results between the
intersects
andPreparedGeometry.intersects
predicates.The cases involve two line segments which cross very close to a segment endpoint which is also a boundary point of a line. The lines intersect according to the robust orientation tests (visible in the TestBuilder Magnify Topology mode). The
intersects
result is incorrect, because the IM matrix is being computed incorrectly, as shown here:The problem is that roundoff causes the computed intersection point to be equal to the boundary point. The intersection detection logic in
SegmentIntersector.addIntersections
was not handling this case correctly. (The reason thatPreparedGeometry.intersects
works is that it uses different and simpler logic.)Note that there is an unavoidable inconsistency between the robust orientation predicates and the computed intersection point (which is subject to roundoff). The fix takes the computed point as being correct (thus effectively introducing an implicit, very small tolerance). This causes the computed IM to report
touches
as true as well.Also logged as GEOS-565.
Patch also removes some obsolete code to simplify logic.
Signed-off-by: Martin Davis [email protected]