This crate contains data structures and methods that deals with lines in 2d and 3d space.
There are 3d and 2d implementations of: - [x] LineString, a sequence of points, aka Polyline. - [x] Self intersection tests for lines in 2d, O( n log n + k). - [x] Line, a finite two-point struct (no rays). - [x] [Ramer–Douglas-Peucker](https://en.wikipedia.org/wiki/Ramer–Douglas–Peuckeralgorithm) and - [x] [Visvalingam-Whyatt](https://en.wikipedia.org/wiki/Visvalingam–Whyattalgorithm) line simplification algorithms. - [x] Aabb axis aligned bounding box. - [x] sampling of boostvoronoi parabolic arc curves.
This is implemented for cgmath, nalgebra, vecmath and limited versions for mint and plain vectors (no transformations etc). \ These implementations are feature gated, so you only have to include the 3d package you need in your code. More implementations could be added if required.
If you want to use this library in your cgmath project you add this to your Cargo.toml:
cargo
linestring = {version = "^0.0.7", features = ["impl-cgmath"]}
Same thing for the other supported 2d/3d libraries:
cargo
linestring = {version = "^0.0.7", features = ["impl-nalgebra"]}
cargo
linestring = {version = "^0.0.7", features = ["impl-mint"]}
cargo
linestring = {version = "^0.0.7", features = ["impl-vecmath"]}
cargo
linestring = {version = "^0.0.7", features = ["impl-vec"]}
The difference between impl-vecmath
and impl-vec
is that the impl-vecmath
feature implements
affine transformations.
Run the line simplification example with :
fish
cargo run --example fltk_gui --features impl-cgmath