Skip to content

Union and Intersection Degenerate Case #166

@skygering

Description

@skygering

Sorry that these coordinates are complicated, I haven't been able to recreate with simpler coordinates.

using LibGEOS, Plots
c1 = [[[0.0, 65905.78568220709], [12540.144108116785, 66644.10887217366], [13639.90993528687, 64693.73062699103], [13323.160413385054, 61494.1194419435], [2375.0223287135154, 53673.4087205281], [0.0, 52759.58192468053], [0.0, 65905.78568220709]]]
c2 = [[[23303.577415035626, 55323.60484150198], [19851.52938808218, 49637.68131132904], [2375.022328713516, 53673.4087205281], [13323.160413385054, 61494.1194419435], [23303.577415035626, 55323.60484150198]]]
p1 = LibGEOS.Polygon(c1)
p2 = LibGEOS.Polygon(c2)
plot(p1) # top in image below
plot!(p2) # bottom in image below

When plotted, they look like follows:

Screen Shot 2023-05-04 at 4 59 30 PM

They don't appear to be overlapping. However, the union is the lower of the two polygons, and the intersection is the bottom.

u = LibGEOS.union(p1, p2)
plot!(u)

Screen Shot 2023-05-04 at 5 03 02 PM

i = LibGEOS.intersection(p1, p2)
plot!(i)

Screen Shot 2023-05-04 at 5 04 14 PM

All polygons are valid if tested with ifValid. This doesn't happen if I set up two squares that share a border. Then the intersection is the line between them, and the union is a larger rectangle made of both.

Please let me know if I am missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions