Skip to content

Intersection bug: "Clipping tracing hit every point" when polygons are not closed #191

@pablosanjose

Description

@pablosanjose

Interection of two overlapping polygons with no particular degeneracies fails for some reason

MWE:

julia> import GeometryOps as GO, GeoInterface as GI

julia> using StaticArrays

julia> 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]])]);

julia> 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]])]);

julia> int = GO.intersection(hex, hex´; target = GI.PolygonTrait())
ERROR: AssertionError: Clipping tracing hit every point - clipping error. Please open an issue with polygons: [[[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]]] and [[[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]]].
Stacktrace:
 [1] _trace_polynodes(::Type{…}, a_list::Vector{…}, b_list::Vector{…}, a_idx_list::Vector{…}, f_step::typeof(GeometryOps._inter_step), poly_a::GeoInterface.Wrappers.Polygon{…}, poly_b::GeoInterface.Wrappers.Polygon{…})
   @ GeometryOps ~/.julia/packages/GeometryOps/FMWuP/src/methods/clipping/clipping_processor.jl:572
 [2] _intersection(::GeometryOps.TraitTarget{…}, ::Type{…}, ::GeoInterface.PolygonTrait, poly_a::GeoInterface.Wrappers.Polygon{…}, ::GeoInterface.PolygonTrait, poly_b::GeoInterface.Wrappers.Polygon{…}; exact::GeometryOps._True, kwargs::@Kwargs{})
   @ GeometryOps ~/.julia/packages/GeometryOps/FMWuP/src/methods/clipping/intersection.jl:74
 [3] _intersection
   @ ~/.julia/packages/GeometryOps/FMWuP/src/methods/clipping/intersection.jl:63 [inlined]
 [4] #intersection#152
   @ ~/.julia/packages/GeometryOps/FMWuP/src/methods/clipping/intersection.jl:45 [inlined]
 [5] intersection
   @ ~/.julia/packages/GeometryOps/FMWuP/src/methods/clipping/intersection.jl:42 [inlined]
 [6] top-level scope
   @ REPL[7]:1
Some type information was truncated. Use `show(err)` to see complete types.

Screenshot 2024-07-30 at 15 21 45

Metadata

Metadata

Assignees

No one assigned

    Labels

    clippingAbout polygon clipping or processingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions