locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.9k stars 437 forks source link

Fix TopologyPreservingSimplifier to prevent jumping components causing incorrect topology #1024

Closed dr-jts closed 7 months ago

dr-jts commented 7 months ago

This PR fixes a long-standing bug in TopologyPreservingSimplifier which created incorrect output due to simplified edges "jumping" over components in the input geometry.

The fix handles both polygonal and linear inputs. (Previously, polygonal inputs with "jumps" produced invalid results. Linear inputs produced results whose topology did not match the input).

Before fix

image

After fix

image

Fixes #428.

Porting this to GEOS will fix the following issues: