pub struct Delaunator {
pub coords: Vec<f64>,
pub triangles: Vec<usize>,
pub halfedges: Vec<usize>,
pub hull: Vec<usize>,
pub triangles_len: usize,
/* private fields */
}Expand description
§Delaunator
§Description
An incredibly fast and robust Typescript library for Delaunay triangulation of 2D points.
§Usage
The methods you have access to:
Delaunator::new: Create a new DelaunatorDelaunator::from_points: Given a flattened array of x,y points. e.g.[[x1, y1], [x2, y2], ...]- [
Delaunator::from_vector_points]: Create a new Delaunator from a collection of VectorPoints Delaunator::update: Updates the triangulation if you modified delaunay.
The properties you have access to:
Delaunator::coords: coordinates of each pointDelaunator::triangles: indexes to each triangle.(triangle[i * 3], triangle[(i * 3) + 1], triangle[(i * 3) + 2])Delaunator::halfedges: indexes to each half edge.(halfedge[i], halfedge[(i + 1) % 3], halfedge[(i + 2) % 3])Delaunator::hull: indexes to each point on the convex hullDelaunator::triangles_len: length of the triangles array
use gistools::tools::Delaunator;
use s2json::Point;
let points = vec![
Point(382., 302.),
Point(382., 328.),
Point(382., 205.),
Point(623., 175.),
Point(382., 188.),
Point(382., 284.),
Point(623., 87.),
Point(623., 341.),
Point(141., 227.),
];
let del = Delaunator::from_points(&points);§Links
Fields§
§coords: Vec<f64>coordinates of each point
triangles: Vec<usize>indexes to each triangle. (triangle[i * 3], triangle[(i * 3) + 1], triangle[(i * 3) + 2])
makes a triangle
halfedges: Vec<usize>indexes to each half edge. (halfedge[i], halfedge[(i + 1) % 3], halfedge[(i + 2) % 3])
hull: Vec<usize>indexes to each point on the convex hull
triangles_len: usizelength of the triangles array
Implementations§
Source§impl Delaunator
impl Delaunator
Sourcepub fn new(coords: Vec<f64>) -> Delaunator
pub fn new(coords: Vec<f64>) -> Delaunator
Constructs a delaunay triangulation object given an array of point coordinates of the form:
[x0, y0, x1, y1, ...] (use a typed array for best performance).
§Parameters
coords: flattened array of x,y points. e.g.[x1, y1, x2, y2, ...]
§Returns
A new Delaunator object
Sourcepub fn from_points<P: GetXY>(points: &[P]) -> Delaunator
pub fn from_points<P: GetXY>(points: &[P]) -> Delaunator
Given a collection of points that contain an x and y property, returns a new
Delaunator object.
§Returns
A Delaunator class to do Delaunay triangulation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Delaunator
impl RefUnwindSafe for Delaunator
impl Send for Delaunator
impl Sync for Delaunator
impl Unpin for Delaunator
impl UnwindSafe for Delaunator
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more