项目
在 GitHub 查看
georust/earcut
关于
A Rust port of the Earcut polygon triangulation library
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文earcut (Rust)
A Rust port of the mapbox/earcut polygon triangulation library.
- Tracks the triangulation behavior and optional Delaunay refinement from the latest earcut 3.2.4.
- Designed to avoid unnecessary memory allocations. Internal buffers and the output index vector can be reused across multiple triangulations.
- Also provides
earcut::int::EarcutI32for integer coordinates with exact integer predicates, but it can be slower than the float-basedEarcuton modern CPUs. - An additional helper,
utils3d::project3d_to_2d, projects coplanar 3D polygons onto a 2D plane for use with earcut.
Benchmarks
Time per iteration (smaller is better). Measured on a MacBook Pro (M4 Pro).
| Polygon | earcut.hpp (C++) | earcut (Rust f64) |
|---|---|---|
| bad_hole | 1.60 µs | 1.21 µs |
| building | 189 ns | 95.5 ns |
| degenerate | 93.9 ns | 23.8 ns |
| dude | 3.09 µs | 2.82 µs |
| empty_square | 188 ns | 40.9 ns |
| water | 135 µs | 138 µs |
| water2 | 108 µs | 102 µs |
| water3 | 8.73 µs | 7.29 µs |
| water3b | 843 ns | 543 ns |
| water4 | 34.4 µs | 36.9 µs |
| water_huge | 834 µs | 594 µs |
| water_huge2 | 1.80 ms | 1.25 ms |
| water_huge3 | 18.1 ms | 10.8 ms |
| MVT corpus | 212 ms | 175 ms |
Public APIs: Rust reuses buffers; C++ allocates per call.
Demo
A simple egui-based visualizer for inspecting how earcut works.
cargo run --example visualizer
License
Licensed under either the MIT License (LICENSE-MIT) or the Apache License 2.0 (LICENSE-APACHE) at your option.
This project contains portions derived from mapbox/earcut, originally distributed under the ISC License (LICENSE-ISC).
探索相关项目
加载中…