pub struct PosedEfd<const D: usize>{ /* 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_angles()
/ PosedEfd::from_series()
/
PosedEfd::from_uvec()
and their 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 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()
.
sourcepub fn from_series<C1, C2>(curve_p: C1, curve_q: C2, is_open: bool) -> Self
pub fn from_series<C1, C2>(curve_p: C1, curve_q: C2, is_open: bool) -> Self
Calculate the coefficients from two series of points.
The second series is the pose series, the curve_q[i]
has the same time
as curve_p[i]
.
sourcepub fn from_series_harmonic<C1, C2>(
curve_p: C1,
curve_q: C2,
is_open: bool,
harmonic: usize
) -> Self
pub fn from_series_harmonic<C1, C2>( curve_p: C1, curve_q: 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.
If the unit vectors is not normalized, the length of the first vector will be used as the scaling factor.
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.
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.
sourcepub fn fourier_power_anaysis(self, threshold: impl Into<Option<f64>>) -> Self
pub fn fourier_power_anaysis(self, threshold: impl Into<Option<f64>>) -> Self
Use Fourier Power Anaysis (FPA) to reduce the harmonic number.
The posed EFD will set the harmonic number to the maximum harmonic number of the curve and the pose.
See also Efd::fourier_power_anaysis()
.
§Panics
Panics if the threshold is not in 0..1, or the harmonic is zero.
sourcepub fn fpa_inplace(&mut self, threshold: impl Into<Option<f64>>)
pub fn fpa_inplace(&mut self, threshold: impl Into<Option<f64>>)
Fourier Power Anaysis (FPA) function with in-place operation.
See also PosedEfd::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.
See also Efd::set_harmonic()
.
§Panics
Panics if the harmonic is zero.
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 as_curve(&self) -> &Efd<D>
pub fn as_curve(&self) -> &Efd<D>
Get the reference of the curve coefficients.
Note: There is no mutable reference, please use
PosedEfd::into_inner()
instead.
let efd = efd::PosedEfd2::from_angles(curve, angles, true);
let curve_efd = efd.as_curve();
let (mut curve_efd, _) = efd.into_inner();
See also PosedEfd::as_pose()
.
sourcepub fn as_pose(&self) -> &Efd<D>
pub fn as_pose(&self) -> &Efd<D>
Get the reference of the pose coefficients.
Note: There is no mutable reference, please use
PosedEfd::into_inner()
instead.
let efd = efd::PosedEfd2::from_angles(curve, angles, true);
let pose_efd = efd.as_pose();
let (_, mut pose_efd) = efd.into_inner();
See also PosedEfd::as_curve()
.
Trait Implementations§
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> 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<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.