Error when shrinking polygon with effect of vanishing
Nevsden opened this issue · 1 comments
Nevsden commented
When using the offset function with a distance value such that the area under the polygon vanishes, the algorithm throws an error. I naturally assumed that in this case the algorithm should throw an error like "AreaOfPolygonVanished" or something like this. Instead, this panic needs to be caught, which is pretty nasty.
In more detail, the Martinez sweep algorithm seems to throw an error:
thread 'main' panicked at 'Sweep line misses event to be removed'
with the backtracing log
0: backtrace::backtrace::trace_unsynchronized
at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.46\src\backtrace\mod.rs:66
1: std::sys_common::backtrace::_print_fmt
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\sys_common\backtrace.rs:78
2: std::sys_common::backtrace::_print::{{impl}}::fmt
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\sys_common\backtrace.rs:59
3: core::fmt::write
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libcore\fmt\mod.rs:1076
4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\io\mod.rs:1537
5: std::sys_common::backtrace::_print
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\sys_common\backtrace.rs:62
6: std::sys_common::backtrace::print
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\sys_common\backtrace.rs:49
7: std::panicking::default_hook::{{closure}}
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\panicking.rs:198
8: std::panicking::default_hook
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\panicking.rs:218
9: std::panicking::rust_panic_with_hook
at /rustc/c367798cfd3817ca6ae908ce675d1d99242af148\/src\libstd\panicking.rs:486
10: std::panicking::begin_panic<str*>
at C:\Users\linden\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\panicking.rs:410
11: geo_booleanop::boolean::subdivide_segments::subdivide<f64>
at C:\Users\linden\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\macros.rs:13
12: geo_booleanop::boolean::boolean_operation<f64>
at C:\Users\linden\.cargo\registry\src\github.com-1ecc6299db9ec823\geo-booleanop-0.2.2\src\boolean\mod.rs:111
13: geo_booleanop::boolean::{{impl}}::boolean<f64>
at C:\Users\linden\.cargo\registry\src\github.com-1ecc6299db9ec823\geo-booleanop-0.2.2\src\boolean\mod.rs:75
14: geo_booleanop::boolean::BooleanOp::union<geo_types::multi_polygon::MultiPolygon<f64>,f64,geo_types::multi_polygon::MultiPolygon<f64>>
at C:\Users\linden\.cargo\registry\src\github.com-1ecc6299db9ec823\geo-booleanop-0.2.2\src\boolean\mod.rs:44
15: geo_offset::offset::{{impl}}::offset_with_arc_segments
at C:\Users\linden\.cargo\registry\src\github.com-1ecc6299db9ec823\geo-offset-0.1.0\src\offset.rs:144
16: geo_offset::offset::{{impl}}::offset_with_arc_segments
at C:\Users\linden\.cargo\registry\src\github.com-1ecc6299db9ec823\geo-offset-0.1.0\src\offset.rs:94
17: geo_offset::offset::Offset::offset<geo_types::polygon::Polygon<f64>>
at C:\Users\linden\.cargo\registry\src\github.com-1ecc6299db9ec823\geo-offset-0.1.0\src\offset.rs:16
18: ghost::algorithms::manipulation::offset::offset_planarpolyline
at .\ghost\src\algorithms\manipulation\offset\mod.rs:95
lelongg commented
I cannot reproduce the issue, can you provide a minimal reproduction case ?