Skip to content

Intersection error on barely touching polygons #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ZuiDet opened this issue Mar 14, 2025 · 2 comments
Open

Intersection error on barely touching polygons #281

ZuiDet opened this issue Mar 14, 2025 · 2 comments
Labels
bug Something isn't working clipping About polygon clipping or processing

Comments

@ZuiDet
Copy link

ZuiDet commented Mar 14, 2025

I found a very strange bug for the intersection of the following two polygons:

poly1 = GI.Polygon([[(0.0, 0.9), (0.09999999999999998, 0.9), (0.09999999999999998, 1.0), (0.0, 1.0), (0.0, 0.9)]]);
poly2 = GI.Polygon([[(-0.1000000000000057, 0.9000000000000031), (-4.761357969939932e-15, 0.8999999999999989), (1.0572338493419614e-30, 1.0), (-0.09999999999999998, 1.0), (-0.1000000000000057, 0.9000000000000031)]]);

Image

poly_int = GO.intersection(poly2 poly1; target=GI.PolygonTrait()); returns an empty list as expected

However,
poly_int = GO.intersection(poly1 poly2; target=GI.PolygonTrait());

returns the left polygon completely.

Image

I assume, this is connected to #193.

@asinghvi17
Copy link
Member

Huh, on my machine and on PR #297 (which has no changes to predicates beyond adopting AdaptivePredicates.jl) I see the same result but with the order of polygons inverted.

Yeah it does look like this has something to do with tracing or maybe the bounce functions being bad on our end. They do intersect, so the intersection should return something, meaning that both of these results are wrong and it should probably return a triangle...

@asinghvi17 asinghvi17 added bug Something isn't working clipping About polygon clipping or processing labels Apr 17, 2025
@asinghvi17
Copy link
Member

LibGEOS gives me this:

julia> import GeometryOps as GO, LibGEOS

julia> poly_int = GO.intersection(GO.GEOS(), poly2, poly1)
GeoInterface.Wrappers.LineString{false, false}(LINESTRING (0 1, 1.0572338493419614e-30 1))

julia> poly_int = GO.intersection(GO.GEOS(), poly1, poly2)
GeoInterface.Wrappers.LineString{false, false}(LINESTRING (1.0572338493419614e-30 1, 0 1))

so there is that to consider as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clipping About polygon clipping or processing
Projects
None yet
Development

No branches or pull requests

2 participants