diff --git a/Cargo.toml b/Cargo.toml index 1db7def..de0acb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "earcut" -version = "0.4.1" +version = "0.4.2" edition = "2021" description = "A Rust port of the Earcut polygon triangulation library" authors = ["Taku Fukada ", "MIERUNE Inc. "] diff --git a/README.md b/README.md index cb0f880..12a96bc 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ A Rust port of the [mapbox/earcut](https://github.com/mapbox/earcut) polygon triangulation library, implemented from scratch with some reference to [donbright/earcutr](https://github.com/donbright/earcutr). -- Based on the latest earcut 2.2.4 release. -- Designed to avoid unnecessary memory allocations. You can reuse the internal buffer and the output index vector for multiple triangulations. +- Based on the latest earcut 3.0.0 release. +- Designed to avoid unnecessary memory allocations. The internal buffer and output index vector can be reused across multiple triangulations. - (Experimental) An additional module, `utils3d`, can rotate 3D coplanar polygons into the 2D plane before triangulation. - License: ISC @@ -39,6 +39,5 @@ on Macbook Pro (M1 Pro) ## Authors -- MIERUNE Inc. - Taku Fukada ([@ciscorn](https://github.com/ciscorn)) - original author - +- MIERUNE Inc. diff --git a/src/lib.rs b/src/lib.rs index 82ba5eb..9911da6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -288,7 +288,7 @@ impl Earcut { } self.queue - .sort_unstable_by(|(_a, ax), (_b, bx)| ax.partial_cmp(bx).unwrap_or(Ordering::Equal)); + .sort_by(|(_a, ax), (_b, bx)| ax.partial_cmp(bx).unwrap_or(Ordering::Equal)); // process holes from left to right for &(q, _) in &self.queue { diff --git a/tests/fixture.rs b/tests/fixture.rs index a8cf35b..04f0d70 100644 --- a/tests/fixture.rs +++ b/tests/fixture.rs @@ -27,7 +27,12 @@ fn test_fixture(name: &str, num_triangles: usize, expected_deviation: f64) { earcut.earcut(data.iter().copied(), &hole_indices, &mut triangles); // check - assert!(triangles.len() == num_triangles * 3); + assert!( + triangles.len() == num_triangles * 3, + "{} {}", + triangles.len(), + num_triangles * 3 + ); if !triangles.is_empty() { assert!(deviation(data.iter().copied(), &hole_indices, &triangles) <= expected_deviation); } @@ -44,7 +49,7 @@ fn fixture_dude() { } #[test] -fn fixture_water() { +fn fixture_water1() { test_fixture("water", 2482, 0.0008); } @@ -69,7 +74,7 @@ fn fixture_water4() { } #[test] -fn fixture_water_huge() { +fn fixture_water_huge1() { test_fixture("water-huge", 5177, 0.0011); }