pub struct VoronoiSimplex<N: RealField + Copy> { /* private fields */ }
Expand description
A simplex of dimension up to 3 that uses 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>
Creates 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> 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>
. Box<dyn Any>
can
then be further downcast
into Box<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>
. Rc<Any>
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> DowncastSync for T
impl<T> DowncastSync for T
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.