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>

source

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 hull
  • result will contain a single element (with weight 1.0) if the query position lies exactly on a vertex
  • result 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.
source

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.

Auto Trait Implementations§

§

impl<'a, T> !Freeze for Barycentric<'a, T>

§

impl<'a, T> !RefUnwindSafe for Barycentric<'a, T>

§

impl<'a, T> Send for Barycentric<'a, T>
where T: Sync, <<T as Triangulation>::Vertex as HasPosition>::Scalar: Send,

§

impl<'a, T> !Sync for Barycentric<'a, T>

§

impl<'a, T> Unpin for Barycentric<'a, T>

§

impl<'a, T> UnwindSafe for Barycentric<'a, T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.