-
Notifications
You must be signed in to change notification settings - Fork 4
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
Intersection bug: "Clipping tracing hit every point" when polygons are not closed #191
Comments
I can't see float64 issues being a problem here. ~cc @skygering ~ import GeometryOps as GO, GeoInterface as GI
using GeoMakie, CairoMakie, StaticArrays
hex = GI.Polygon([SVector{2}.([[0.012661261919576613, 0.0], [0.006330630959788308, 0.010964974466321872], [-0.006330630959788304, 0.010964974466321874], [-0.012661261919576613, 1.5505573882975772e-18], [-0.006330630959788312, -0.01096497446632187], [0.006330630959788308, -0.010964974466321872]])]);
hex´ = GI.Polygon([SVector{2}.([[0.012382790701850534, 0.0012522257170548476], [0.00548697322789982, 0.011870853442051934], [-0.007156936872252775, 0.011208214192248522], [-0.012905029498454658, -7.305278255197601e-5], [-0.006009212024503947, -0.010691680507549062], [0.006634698075648655, -0.01002904125774565]])]);
dif = GO.difference(hex, hex´; target = GI.PolygonTrait())
f, a, p = poly(hex; color = Cycled(1), label = "hex")
poly!(hex´; color = Cycled(2), label = "hex´")
poly!(dif; color = Cycled(3), label = "difference")
axislegend(a)
f |
Ah, the polygons aren't closed (i.e., We do need a better error message if the rings are not closed, though. Maybe that can go in
|
Yes we can probably fix it on the fly if the begin and end points don't match in any ring. It would be good if unclosed rings just worked everywhere without manual fixes. |
So, this was the problem! Thanks. Is it explained anywhere that polygons "should" be closed (identical start and end points)? Note that |
This package is very new, just a bug not intentional. We accept geoms from basically any package so we can't know if they're closed. We just have to check. |
Of course, sorry! Actually, GeometryOps is surprisingly good already. In this particular intersection problem it is faster and allocates way less than Meshes.jl. Keep up the great work! |
It also uses exact arithmetic :) |
Interection of two overlapping polygons with no particular degeneracies fails for some reason
MWE:
The text was updated successfully, but these errors were encountered: