8 releases

new 0.0.8 Feb 23, 2021
0.0.7 Feb 23, 2021

#163 in Data structures

46 downloads per month

AGPL-3.0

490KB
10K SLoC

Crates.io Documentation Workflow Workflow dependency status

Line library for Rust

This crate contains data structures and methods that deals with lines in 2D and 3D space.

There are 3D and 2D implementations of:

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:

linestring = {version = "^0.0.8", features = ["impl-cgmath"]}

Same thing for the other supported 2d/3d libraries:

linestring = {version = "^0.0.8", features = ["impl-nalgebra"]}
linestring = {version = "^0.0.8", features = ["impl-mint"]}
linestring = {version = "^0.0.8", features = ["impl-vecmath"]}
linestring = {version = "^0.0.8", features = ["impl-vec"]}

The difference between impl-vecmath and impl-vec is that the impl-vecmath feature supports affine transformations.

##Demo Run the line simplification example with :

cargo run --example fltk_gui --features impl-cgmath

Todo

  • Improve on error handling
  • Benchmark and optimize (add smallvec to simplify rdp?)
  • optimize Ramer–Douglas-Peucker
  • optimize Visvalingam-Whyatt
  • figure out how to deal with rustdoc (the feature gates disables it).

Dependencies

~1–2.1MB
~46K SLoC