geometry
geometry copied to clipboard
Difference: not the right set of points returned. Rounding issue?
Hi,
Please have a look at the issue on godbolt.
As you can see, points are disappearing when they should not. My issue is that I suspect rounding to remove some points that should be kept on the polygon after applying a difference. Missing points are my main concern, I've been caught because I use your library for game development.
Type is double so we should not have such an issue with such large (0.05) absolute coordinates difference.
I disabled the optimisation because otherwise Goldbolt complained about compilation time too long (may be a temporary issue).
Is there an immediate workaround ?
Thanks
The issue arise because the points are touching the segment.
Maybe at some point the algorithm decides that they are unimportant, but they are to me. They work as tags/locations markers.
Applying a very small buffer could be an immediate workaround but it adds a lot of point and mess with the rest of my code.
The only way to do it right now is to manually add the points back in a loop.
Keeping the points in place on the edges in the first place would avoid this. Maybe add an option?
The issue is gone on godbolt... Whoops, ID "v94vceE1K" could not be found Can you please add it again?
I can reproduce it locally. To my understanding and according to difference definition (see documentation the right output of the above program is should be
8, 10
0, 10
0, 0
8, 0
for both f1 and f2.
However, boost geometry (1.82) returns
8 9.95
8 10
0 10
0 0
8 0
for f1 and
8 8.95
8 10
0 10
0 0
8 0
for f2.
@LumiereDeLOmbre it is not clear to me what you want to achieve but maybe talking the first polygon union the intersection of both polygons (only points could be an option) is a way to keep the intersection points you need.