Struct efd::PosedEfd

source ·
pub struct PosedEfd<const D: usize>
where U<D>: EfdDim<D>,
{ /* private fields */ }
Expand description

An open-curve 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>

source

pub fn from_angles<C>(curve: C, angles: &[f64]) -> Self
where C: Curve<2>,

Calculate the coefficients from a curve and its angles from each point.

source

pub fn from_angles_harmonic<C>( curve: C, angles: &[f64], harmonic: usize ) -> Self
where C: Curve<2>,

Calculate the coefficients from a curve and its angles from each point.

The harmonic is the number of the coefficients to be calculated.

source§

impl<const D: usize> PosedEfd<D>
where U<D>: EfdDim<D>,

source

pub const fn from_parts_unchecked(efd: Efd<D>, posed: Efd<D>) -> Self

Create object from an Efd object.

Posed EFD is a special shape to describe the pose, efd is only used to describe this motion signature.

See also PosedEfd::into_inner().

source

pub fn from_series<C1, C2>(curve_p: C1, curve_q: C2) -> Self
where C1: Curve<D>, C2: Curve<D>,

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].

source

pub fn from_series_harmonic<C1, C2>( curve_p: C1, curve_q: C2, harmonic: usize ) -> Self
where C1: Curve<D>, C2: Curve<D>,

Calculate the coefficients from two series of points.

The harmonic is the number of the coefficients to be calculated.

source

pub fn from_uvec<C, V>(curve: C, vectors: V) -> Self
where C: Curve<D>, V: Curve<D>,

Calculate the coefficients from a curve and its unit vectors from each point.

If the unit vectors is not normalized, the length of the first vector will be used as the scaling factor.

source

pub fn from_uvec_harmonic<C, V>(curve: C, vectors: V, harmonic: usize) -> Self
where C: Curve<D>, V: Curve<D>,

Calculate the coefficients from a curve and its unit vectors from each point.

If the unit vectors is not normalized, the length of the first vector will be used as the scaling factor.

The harmonic is the number of the coefficients to be calculated.

source

pub fn fourier_power_anaysis<T>(self, threshold: T) -> Self
where Option<f64>: From<T> + Clone,

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.

source

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().

source

pub fn as_curve(&self) -> &Efd<D>

Get the reference of the curve coefficients.

source

pub fn as_pose(&self) -> &Efd<D>

Get the reference of the pose coefficients.

source

pub fn as_geo(&self) -> &GeoVar<Rot<D>, D>

Get the reference of geometric variables.

source

pub fn harmonic(&self) -> usize

Get the harmonic number of the coefficients.

source

pub fn err(&self, rhs: &Self) -> f64

Calculate the error between two PosedEfd.

source

pub fn err_sig(&self, sig: &MotionSig<D>) -> f64

Calculate the error from a MotionSig.

Trait Implementations§

source§

impl<const D: usize> Clone for PosedEfd<D>
where U<D>: EfdDim<D>,

source§

fn clone(&self) -> PosedEfd<D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const D: usize> Debug for PosedEfd<D>
where U<D>: EfdDim<D>,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const D: usize> !Freeze for PosedEfd<D>

§

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> 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> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.