locationtech / jts

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

Single-side buffering closes shape only sometimes #1008

Open nubblesite opened 12 months ago

nubblesite commented 12 months ago

I am performing single-sided buffering and then looping through the new offset curve to remove all points within offsetDistance - 0.01 of each point on the original curve. This results in a nice single-sided buffer like so:

image

The problem is that when I increase the offset distance beyond a certain amount, the first and last points become connected by a line segment (the photo above is 7.5 offset distance, the one below is 8.0): image

I'm aware that buffering will always return either a polygon or multipolygon (closed shape). That being said, I would like to prevent the first and last points from "connecting" together entirely. Any ideas as to why this would happen only beyond a certain offset distance?

nubblesite commented 12 months ago

OK, this issue is caused by the final offset curve not maintaining point order past a certain offset distance. I guess there's no way to ensure that the first and last points in the offset curve correspond to the first and last points in the original curve, since the buffer operation doesn't guarantee point order. Is that right?

dr-jts commented 12 months ago

You'll have to provide more information about what API you are using, and what the input data is.