pub struct PosedEfd<const D: usize>{ /* private fields */ }Expand description
A shape with a pose described by EFD.
These are the same as Efd except that it has a pose, and the data are
always normalized and readonly.
Start with PosedEfd::from_series() and its related methods.
Pose Representation
Pose is represented by an unit vector, which is rotated by the rotation of the original shape.
Implementations§
source§impl PosedEfd<2>
impl PosedEfd<2>
sourcepub fn from_angles<C>(curve: C, angles: &[f64], is_open: bool) -> Selfwhere
C: Curve<2>,
pub fn from_angles<C>(curve: C, angles: &[f64], is_open: bool) -> Selfwhere
C: Curve<2>,
Calculate the coefficients from a curve and its angles from each point.
source§impl<const D: usize> PosedEfd<D>
impl<const D: usize> PosedEfd<D>
sourcepub const fn from_parts_unchecked(curve: Efd<D>, pose: Efd<D>) -> Self
pub const fn from_parts_unchecked(curve: Efd<D>, pose: Efd<D>) -> Self
Create a new PosedEfd from two Efds. (curve and pose)
See also PosedEfd::into_inner().
sourcepub fn from_series<C1, C2>(curve1: C1, curve2: C2, is_open: bool) -> Self
pub fn from_series<C1, C2>(curve1: C1, curve2: C2, is_open: bool) -> Self
Calculate the coefficients from two series of points.
The second series is the pose series, the curve2[i] has the same time
as curve[i].
sourcepub fn from_series_harmonic<C1, C2>(
curve1: C1,
curve2: C2,
is_open: bool,
harmonic: usize
) -> Self
pub fn from_series_harmonic<C1, C2>( curve1: C1, curve2: C2, is_open: bool, harmonic: usize ) -> Self
Calculate the coefficients from two series of points.
The harmonic is the number of the coefficients to be calculated.
sourcepub fn from_uvec<C, V>(curve: C, vectors: V, is_open: bool) -> Self
pub fn from_uvec<C, V>(curve: C, vectors: V, is_open: bool) -> Self
Calculate the coefficients from a curve and its unit vectors from each point.
See also PosedEfd::from_uvec_unchecked() if you want to skip the
unit vector calculation.
sourcepub fn from_uvec_harmonic<C, V>(
curve: C,
vectors: V,
is_open: bool,
harmonic: usize
) -> Self
pub fn from_uvec_harmonic<C, V>( curve: C, vectors: V, is_open: bool, harmonic: usize ) -> Self
Calculate the coefficients from a curve and its unit vectors from each point.
See also PosedEfd::from_uvec_harmonic_unchecked() if you want to
skip the unit vector calculation.
sourcepub fn from_uvec_unchecked<C, V>(curve: C, vectors: V, is_open: bool) -> Self
pub fn from_uvec_unchecked<C, V>(curve: C, vectors: V, is_open: bool) -> Self
Calculate the coefficients from a curve and its unit vectors from each point.
sourcepub fn from_uvec_harmonic_unchecked<C, V>(
curve: C,
vectors: V,
is_open: bool,
harmonic: usize
) -> Self
pub fn from_uvec_harmonic_unchecked<C, V>( curve: C, vectors: V, is_open: bool, harmonic: usize ) -> Self
Calculate the coefficients from a curve and its unit vectors from each point.
The harmonic is the number of the coefficients to be calculated.
sourcepub fn fourier_power_anaysis<T>(self, threshold: T) -> Self
pub fn fourier_power_anaysis<T>(self, threshold: T) -> Self
Use Fourier Power Anaysis (FPA) to reduce the harmonic number.
The default threshold is 99.99%.
See also Efd::fourier_power_anaysis().
Panics
Panics if the threshold is not in 0..1, or the harmonic is zero.
sourcepub fn set_harmonic(&mut self, harmonic: usize)
pub fn set_harmonic(&mut self, harmonic: usize)
Set the harmonic number of the coefficients.
Panics
Panics if the harmonic is zero or greater than the current harmonic.
sourcepub fn into_inner(self) -> (Efd<D>, Efd<D>)
pub fn into_inner(self) -> (Efd<D>, Efd<D>)
Consume self and return the parts of this type. The first is the curve coefficients, and the second is the pose coefficients.
See also PosedEfd::from_parts_unchecked().
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Check if the coefficients are valid.
It is only helpful if this object is constructed by
PosedEfd::from_parts_unchecked().
sourcepub fn distance(&self, rhs: &Self) -> f64
pub fn distance(&self, rhs: &Self) -> f64
Calculate the L1 distance between two coefficient set.
For more distance methods, please see Distance.
sourcepub fn generate(&self, n: usize, len: f64) -> (Vec<Coord<D>>, Vec<Coord<D>>)
pub fn generate(&self, n: usize, len: f64) -> (Vec<Coord<D>>, Vec<Coord<D>>)
Obtain the curve and pose for visualization.
The len is the length of the pose vector.
Trait Implementations§
Auto Trait Implementations§
impl<const D: usize> !RefUnwindSafe for PosedEfd<D>
impl<const D: usize> !Send for PosedEfd<D>
impl<const D: usize> !Sync for PosedEfd<D>
impl<const D: usize> !Unpin for PosedEfd<D>
impl<const D: usize> !UnwindSafe for PosedEfd<D>
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.