Struct spade::Barycentric
source · pub struct Barycentric<'a, T>where
T: Triangulation,{ /* private fields */ }
Expand description
Implements methods related to barycentric interpolation.
Created by calling crate::FloatTriangulation::barycentric.
Refer to the documentation of NaturalNeighbor for an overview of different interpolation methods.
Implementations§
source§impl<'a, T> Barycentric<'a, T>
impl<'a, T> Barycentric<'a, T>
sourcepub fn get_weights(
&self,
position: Point2<<T::Vertex as HasPosition>::Scalar>,
result: &mut Vec<(FixedVertexHandle, <T::Vertex as HasPosition>::Scalar)>
)
pub fn get_weights( &self, position: Point2<<T::Vertex as HasPosition>::Scalar>, result: &mut Vec<(FixedVertexHandle, <T::Vertex as HasPosition>::Scalar)> )
Returns the barycentric coordinates and the respective vertices for a given query position.
The resulting coordinates and vertices are stored within the given result
vec`` to prevent unneeded allocations.
result` will be cleared initially.
The number of returned elements depends on the query positions location:
result
will be empty if the query position lies outside of the triangulation’s convex hullresult
will contain a single element (with weight 1.0) if the query position lies exactly on a vertexresult
will contain two vertices if the query point lies exactly on any edge of the triangulation.result
will contain exactly three elements if the query point lies on an inner face of the triangulation.
sourcepub fn interpolate<I>(
&self,
i: I,
position: Point2<<T::Vertex as HasPosition>::Scalar>
) -> Option<<T::Vertex as HasPosition>::Scalar>where
I: Fn(VertexHandle<'_, T::Vertex, T::DirectedEdge, T::UndirectedEdge, T::Face>) -> <T::Vertex as HasPosition>::Scalar,
pub fn interpolate<I>(
&self,
i: I,
position: Point2<<T::Vertex as HasPosition>::Scalar>
) -> Option<<T::Vertex as HasPosition>::Scalar>where
I: Fn(VertexHandle<'_, T::Vertex, T::DirectedEdge, T::UndirectedEdge, T::Face>) -> <T::Vertex as HasPosition>::Scalar,
Performs barycentric interpolation on this triangulation at a given position.
Returns None
for any value outside the triangulation’s convex hull.
The value to interpolate is given by the i
parameter.
Refer to NaturalNeighbor for a comparison with other interpolation methods.