Crates.io | linestring |
lib.rs | linestring |
version | 0.13.0 |
source | src |
created_at | 2021-02-10 13:29:11.28737 |
updated_at | 2023-12-08 15:43:45.411425 |
description | line string toolbox |
homepage | |
repository | https://codeberg.org/eadf/linestring_rs |
max_upload_size | |
id | 353222 |
size | 472,129 |
linestring
is a Rust crate providing data structures and methods for working with poly-lines and segments in 2D space.
Utilizing the vector-traits
crate, it abstracts over different vector implementations allowing for seamless
transitions between vector libraries like glam
and cgmath
(for now).
Vec<GenericVector2>
and Vec<GenericVector3>
Include the following dependencies in your Cargo.toml
file, picking the vector implementation you need:
vector-traits = {version="0.3.2", features= ["glam","cgmath"]} # pick cgmath or glam, whatever you need
linestring = {version="0.12"}
// the vector type can just as well be glam::Dvec2, cgmath::Vector2<f32> or cgmath::Vector2<f64>,
let some_points: Vec<glam::Vec2> = vec![
vec2(77f32, 613.),
vec2(689., 650.),
vec2(710., 467.),
vec2(220., 200.),
];
let convex_hull:Vec<glam::Vec2> = some_points.convex_hull()?;
for p in some_points {
assert!(convex_hull.contains_point_inclusive(p));
}
The minimum supported version of Rust for linestring
is 1.66
.
We welcome contributions from the community. Feel free to submit pull requests or report issues on our GitHub repository. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Licensed under either of
at your option.