pub struct VoronoiSimplex<N: RealField + Copy> { /* private fields */ }Expand description
A simplex of dimension up to 2 using Voronoï regions for computing point projections.
Implementations§
Source§impl<N: RealField + Copy> VoronoiSimplex<N>
impl<N: RealField + Copy> VoronoiSimplex<N>
Sourcepub fn new() -> VoronoiSimplex<N>
pub fn new() -> VoronoiSimplex<N>
Crates a new empty simplex.
Sourcepub fn proj_coord(&self, i: usize) -> N
pub fn proj_coord(&self, i: usize) -> N
Retrieves the barycentric coordinate associated to the i-th by the last call to project_origin_and_reduce.
Sourcepub fn prev_proj_coord(&self, i: usize) -> N
pub fn prev_proj_coord(&self, i: usize) -> N
Retrieves the barycentric coordinate associated to the i-th before the last call to project_origin_and_reduce.
Sourcepub fn prev_point(&self, i: usize) -> &CSOPoint<N>
pub fn prev_point(&self, i: usize) -> &CSOPoint<N>
The i-th point of the simplex before the last call to projet_origin_and_reduce.
Sourcepub fn project_origin_and_reduce(&mut self) -> Point<N>
pub fn project_origin_and_reduce(&mut self) -> Point<N>
Projets the origin on the boundary of this simplex and reduces self the smallest subsimplex containing the origin.
Retruns the result of the projection or Point::origin() if the origin lies inside of the simplex.
The state of the samplex before projection is saved, and can be retrieved using the methods prefixed
by prev_.
Sourcepub fn project_origin(&mut self) -> Point<N>
pub fn project_origin(&mut self) -> Point<N>
Compute the projection of the origin on the boundary of this simplex.
Sourcepub fn contains_point(&self, pt: &Point<N>) -> bool
pub fn contains_point(&self, pt: &Point<N>) -> bool
Tests if the given point is already a vertex of this simplex.
Sourcepub fn dimension(&self) -> usize
pub fn dimension(&self) -> usize
The dimension of the smallest subspace that can contain this simplex.
Sourcepub fn prev_dimension(&self) -> usize
pub fn prev_dimension(&self) -> usize
The dimension of the simplex before the last call to project_origin_and_reduce.
Sourcepub fn max_sq_len(&self) -> N
pub fn max_sq_len(&self) -> N
The maximum squared length of the vertices of this simplex.
Sourcepub fn modify_pnts(&mut self, f: &dyn Fn(&mut CSOPoint<N>))
pub fn modify_pnts(&mut self, f: &dyn Fn(&mut CSOPoint<N>))
Apply a function to all the vertices of this simplex.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for VoronoiSimplex<N>where
N: Freeze,
impl<N> RefUnwindSafe for VoronoiSimplex<N>where
N: RefUnwindSafe,
impl<N> Send for VoronoiSimplex<N>
impl<N> Sync for VoronoiSimplex<N>
impl<N> Unpin for VoronoiSimplex<N>where
N: Unpin,
impl<N> UnwindSafe for VoronoiSimplex<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.