pub struct GeoVar<R: RotHint<D>, const D: usize> { /* private fields */ }Expand description
Geometric variables.
This type record the information of raw coefficients. You can merge two
instance with */*= operator.
use efd::{tests::*, Efd2};
let a = Efd2::from_curve(curve1, false);
let b = Efd2::from_curve(curve2, false);
let geo = b.as_geo() * a.as_geo().inverse();
assert!(curve_diff(&geo.transform(curve1), curve2) < EPS);Implementations§
Source§impl<R, const D: usize> GeoVar<R, D>where
R: RotHint<D>,
impl<R, const D: usize> GeoVar<R, D>where
R: RotHint<D>,
Sourcepub fn from_trans(trans: [f64; D]) -> Self
pub fn from_trans(trans: [f64; D]) -> Self
Create a new instance from translation.
Sourcepub fn from_scale(scale: f64) -> Self
pub fn from_scale(scale: f64) -> Self
Create a new instance from rotation.
Sourcepub fn only_trans(self) -> Self
pub fn only_trans(self) -> Self
Create a new instance from translation.
Sourcepub fn only_rot_scale(self) -> Self
pub fn only_rot_scale(self) -> Self
Create a new instance from rotation and scaling.
Sourcepub fn with_trans(self, trans: [f64; D]) -> Self
pub fn with_trans(self, trans: [f64; D]) -> Self
With the translate property.
Sourcepub fn with_scale(self, scale: f64) -> Self
pub fn with_scale(self, scale: f64) -> Self
With the scaling property.
Sourcepub fn to(&self, rhs: &Self) -> Self
pub fn to(&self, rhs: &Self) -> Self
Merge inverse self and rhs. (rhs * self^T)
It can be used on a not normalized contour a transforming to b.
use efd::{tests::*, Efd2};
let a = Efd2::from_curve(curve1, false);
let b = Efd2::from_curve(curve2, false);
let geo = a.as_geo().to(b.as_geo());
assert!(curve_diff(&geo.transform(curve1), curve2) < EPS);Sourcepub fn inverse(&self) -> Self
pub fn inverse(&self) -> Self
Inverse self. (self^T/self^-1)
use efd::{tests::*, Efd2};
let efd = Efd2::from_curve(curve, false);
let curve = efd.recon(curve.len());
let curve_norm = efd.recon_norm(curve.len());
let curve = efd.as_geo().inverse().transform(curve);Sourcepub fn transform_pt(&self, p: [f64; D]) -> [f64; D]
pub fn transform_pt(&self, p: [f64; D]) -> [f64; D]
Transform a point.
Please see GeoVar::transform() for more information.
Sourcepub fn transform<C>(&self, curve: C) -> Vec<[f64; D]>where
C: Curve<D>,
pub fn transform<C>(&self, curve: C) -> Vec<[f64; D]>where
C: Curve<D>,
Transform a contour with this information.
This function rotates first, then translates.
use efd::{tests::*, *};
let efd = Efd2::from_curve(curve, false);
// Normalize the curve
let curve_norm = efd.as_geo().inverse().transform(&curve);Sourcepub fn transform_inplace<C>(&self, curve: C)
pub fn transform_inplace<C>(&self, curve: C)
Transform a contour in-placed with this information.
Sourcepub fn transform_iter<'a, C>(
&'a self,
curve: C,
) -> impl Iterator<Item = [f64; D]> + 'a
pub fn transform_iter<'a, C>( &'a self, curve: C, ) -> impl Iterator<Item = [f64; D]> + 'a
Transform an iterator contour and return a new iterator.
Trait Implementations§
Auto Trait Implementations§
impl<R, const D: usize> Freeze for GeoVar<R, D>where
R: Freeze,
impl<R, const D: usize> RefUnwindSafe for GeoVar<R, D>where
R: RefUnwindSafe,
impl<R, const D: usize> Send for GeoVar<R, D>
impl<R, const D: usize> Sync for GeoVar<R, D>
impl<R, const D: usize> Unpin for GeoVar<R, D>where
R: Unpin,
impl<R, const D: usize> UnsafeUnpin for GeoVar<R, D>where
R: UnsafeUnpin,
impl<R, const D: usize> UnwindSafe for GeoVar<R, D>where
R: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, Right> ClosedMul<Right> 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.