pub struct Delaunay {
pub points: Vec<f64>,
pub point_markers: Vec<i32>,
pub triangles: Vec<usize>,
pub neighbors: Option<Vec<i32>>,
pub edges: Option<Vec<usize>>,
}
Expand description
Delaunay triangulation
Fields§
§points: Vec<f64>
Triangulation vertices as [x0,y0,x1,y1,…]
point_markers: Vec<i32>
Indices in points.chunks(2)
, the first 3 indices correspond to the vertices of the 1st triangle, the next 3 to the 2nd triangle, etc…
triangles: Vec<usize>
§neighbors: Option<Vec<i32>>
List of triangles neighbors: indices in triangles.chunks(3) (3 integers per triangle)
edges: Option<Vec<usize>>
Edges endpoints: indices in points.chunks(2) (2 integers per edge)
Implementations§
Source§impl Delaunay
impl Delaunay
Sourcepub fn n_vertices(&self) -> usize
pub fn n_vertices(&self) -> usize
Returns the number of vertices
Sourcepub fn n_triangles(&self) -> usize
pub fn n_triangles(&self) -> usize
Returns the number of Delaunay triangles
Sourcepub fn vertex_iter(&self) -> Chunks<'_, f64>
pub fn vertex_iter(&self) -> Chunks<'_, f64>
Returns an iterator over the vertices, each item is a vertex (x,y) coordinates
Sourcepub fn vertex_iter_mut(&mut self) -> ChunksMut<'_, f64>
pub fn vertex_iter_mut(&mut self) -> ChunksMut<'_, f64>
Returns an iterator over mutable vertices, each item is a vertex (x,y) coordinates
Sourcepub fn vertex_par_iter(&self) -> Chunks<'_, f64>
pub fn vertex_par_iter(&self) -> Chunks<'_, f64>
Returns a parallel iterator over the vertices, each item is a vertex (x,y) coordinates
Sourcepub fn triangle_iter(&self) -> Chunks<'_, usize>
pub fn triangle_iter(&self) -> Chunks<'_, usize>
Returns an iterator over the triangles, each item is the indices of the vertices in vertex_iter
Sourcepub fn triangle_iter_mut(&mut self) -> ChunksMut<'_, usize>
pub fn triangle_iter_mut(&mut self) -> ChunksMut<'_, usize>
Returns an iterator over mutable triangles, each item is the indices of the vertices in vertex_iter
Sourcepub fn triangle_par_iter(&self) -> Chunks<'_, usize>
pub fn triangle_par_iter(&self) -> Chunks<'_, usize>
Returns a parallel iterator over the triangles, each item is the indices of the vertices in vertex_iter
Sourcepub fn triangle_vertex_iter(&self) -> impl Iterator<Item = Vec<(f64, f64)>> + '_
pub fn triangle_vertex_iter(&self) -> impl Iterator<Item = Vec<(f64, f64)>> + '_
Returns an interator over the triangles, each item is a vector of the 3 (x,y) vertices coordinates
Sourcepub fn filter_within_circle(
&mut self,
radius: f64,
origin: Option<(f64, f64)>,
) -> &mut Self
pub fn filter_within_circle( &mut self, radius: f64, origin: Option<(f64, f64)>, ) -> &mut Self
Removes triangles inside a circle of given radius
centered on Some(origin)
Sourcepub fn triangle_areas(&self) -> Vec<f64>
pub fn triangle_areas(&self) -> Vec<f64>
Returns the triangle areas
Sourcepub fn mesh_area(&self) -> f64
pub fn mesh_area(&self) -> f64
Returns the area covered by the mesh as the sum of the Delaunay triangles area
pub fn average(&self, vertices: &[[f64; 3]], data: &[f64]) -> f64
pub fn average_with<F: Fn(f64) -> f64>( &self, vertices: &[[f64; 3]], data: &[f64], f: F, ) -> f64
Sourcepub fn dot(&self, v_a: &[f64], v_b: &[f64]) -> f64
pub fn dot(&self, v_a: &[f64], v_b: &[f64]) -> f64
Returns the dot product of two vector a
and b
sampled on the Delaunay mesh
Sourcepub fn is_point_inside(&self, point: &[f64], triangle_id: usize) -> bool
pub fn is_point_inside(&self, point: &[f64], triangle_id: usize) -> bool
Returns true if a point [x,y]
is inside the triangle given by its index (triangle_id
) in triangles_iter
, otherwise returns false
Sourcepub fn which_contains_point(&self, point: &[f64]) -> Option<usize>
pub fn which_contains_point(&self, point: &[f64]) -> Option<usize>
Finds the index of the triangle in triangles_iter
that contains the given point [x,y]
Sourcepub fn point_into_barycentric(
&self,
point: &[f64],
triangle_ids: &[usize],
) -> [f64; 3]
pub fn point_into_barycentric( &self, point: &[f64], triangle_ids: &[usize], ) -> [f64; 3]
Returns the barycentric coordinates of a point [x,y]
with respect to the triangle that contains it
The triangle that contains the point is specified with the indices triangle_ids
in vertex_iter
of the triangle vertices
Sourcepub fn barycentric_interpolation(
&self,
point: &[f64],
val_at_vertices: &[f64],
) -> f64
pub fn barycentric_interpolation( &self, point: &[f64], val_at_vertices: &[f64], ) -> f64
Linearly interpolates at a given point [x,y], values val_at_vertices
at the Delaunay mesh vertices
The linear interpolation is based on the barycentric coordinates of the point