cds-astro / cds-healpix-rust

The CDS HEALPix library in Rust (WebAssembly, Python, ...)
Apache License 2.0
16 stars 5 forks source link

Assertion failure on polygon_coverage with triangle crossing the antimeridian #7

Closed berke closed 4 months ago

berke commented 4 months ago

Hello,

I get assertion failed: intersect2.lon() < p2.lon() at special_points_finder.rs:428:7 with the following code:

    let bad = [(f64::PI, 1.000),
           (-f64::PI + 1e-3, 1.001),
           (f64::PI - 1e-3, 1.002)];
    let lay = hp::nested::get(4);
    let _ = lay.polygon_coverage(&bad,true);

This doesn't happen if exact_solution is false.

fxpineau commented 4 months ago

Thank you @berke. Fixed in commit 95239e756a3f08a7919bf81edb4cef94157a0964 (I use PI instead of -PI in the test, it should be the same).