georust / geo

Geospatial primitives and algorithms for Rust
https://crates.io/crates/geo
Other
1.53k stars 198 forks source link

panic on polygon union #1180

Closed AntoineRenaud91 closed 4 months ago

AntoineRenaud91 commented 4 months ago

The following code snippet panics:

use geo::{BooleanOps, Polygon, LineString, Coord};

fn main() {
   let poly1 = Polygon::new(
        LineString::new(vec![
            Coord {
                x: -10339459.518507583,
                y: 3672178.7824083967,
            },
            Coord {
                x: -10172502.686420029,
                y: 3169028.9498966974,
            },
            Coord {
                x: -10002503.513328442,
                y: 3498113.19617442,
            },
        ]),
        vec![],
    );
    let poly2 = Polygon::new(
        LineString::new(vec![
            Coord {
                x: -10644125.090349106,
                y: 3510000.058398463,
            },
            Coord {
                x: -10010375.27222986,
                y: 3502179.60931681,
            },
            Coord {
                x: -10018249.493188547,
                y: 3506247.294314978,
            },
            Coord {
                x: -10018249.49318854,
                y: 3506247.294314993,
            },
            Coord {
                x: -10320063.446714956,
                y: 3765929.7827082784,
            }
        ]),
        vec![],
    );
    poly2.union(&poly1);
}

The panic message:

thread 'main' panicked at /home/arenaud/.cargo/registry/src/index.crates.io-6f17d22bba15001f/geo-0.28.0/src/algorithm/sweep/vec_set.rs:29:14:
segment not found in active-vec-set: 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
AntoineRenaud91 commented 4 months ago

Just saw that it relates an other issue.