mierune / earcut-rs Goto Github PK
View Code? Open in Web Editor NEWA Rust port of the Earcut polygon triangulation library.
Home Page: https://crates.io/crates/earcut
License: ISC License
A Rust port of the Earcut polygon triangulation library.
Home Page: https://crates.io/crates/earcut
License: ISC License
I would like to suggest to pass a slice of arrays with dimension defined as const generic. And instead of accepting dimensions as a number, use [usize; 2]
with indices to use. I.e. to use first two values from each array (x and y), use [0, 1]
.
It would be more ergonomic and more efficient since libraries usually represent meshes as vector of arrays instead of vector of values.
Hi! Thanks a lot for implementing my suggestions in #5. I decided to try the crate, but noticed a few inconveniences with the API:
&[f32; 2]
. It's a problem when you actually have 3D coordinates and you trying to convert them into 2D:positions.iter().map(|&[x, y, _]| &[x, y]);
I can't return &[x, y]
from a closure. I would suggest to remove the reference (make it just [f32; 2]
) or make turn it into an iterator over just f32
. I would suggest the latter since it will be a little closer to how the JS version works.
Vec<[N; 3]>
. But some crates, like Bevy, store them as just f32
. I would suggest to return just Vec<N>
. This way it will be more consistent with (1).In the benchmark section, earcut-rs (0.4.1) - water_huge2
is 11.0k ms/i
, which is almost 1000 times earcutr (0.4.3) - water_huge2
(10.90 ms/i
).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.