locationtech / jts

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

line difference point #950

Closed radi2015 closed 1 year ago

radi2015 commented 1 year ago
        WKTReader wktReader=new WKTReader();
        Geometry point = wktReader.read("POINT (0 1)");
        Geometry line = wktReader.read("LINESTRING (0 0, 0 2)");
        System.out.println(line.difference(point));

LINESTRING (0 0, 0 2)

why line.difference(point) is LINESTRING (0 0, 0 2) not MULTILINESTRING((0 0,0 1),(0 1,0 2)) is there something wrong with this?

dr-jts commented 1 year ago

Well, topologically speaking the two answers are the same. And that's the model that the overlay implementation is based on.

It would be nice if JTS had a Split function that would do this kind of thing.