pub struct Transform2<WFrom = Generic, WTo = WFrom> {
pub m: [f64; 6],
/* private fields */
}Expand description
A 2D affine transform between two phantom coordinate spaces.
Fields§
§m: [f64; 6]Affine matrix coefficients in kurbo-compatible [a, b, c, d, e, f] order.
Implementations§
Source§impl<WFrom: Space, WTo: Space> Transform2<WFrom, WTo>
impl<WFrom: Space, WTo: Space> Transform2<WFrom, WTo>
Sourcepub fn determinant(self) -> f64
pub fn determinant(self) -> f64
Returns the affine determinant.
Sourcepub fn coeffs(&self) -> [f64; 6]
pub fn coeffs(&self) -> [f64; 6]
Returns raw affine coefficients in kurbo-compatible [a, b, c, d, e, f] order.
Sourcepub fn get_translation(self) -> Vector2<WFrom>
pub fn get_translation(self) -> Vector2<WFrom>
Extracts the translation component as a vector.
Sourcepub fn cast_spaces<W: Space, T: Space>(self) -> Transform2<W, T>
pub fn cast_spaces<W: Space, T: Space>(self) -> Transform2<W, T>
Casts the phantom coordinate spaces without changing coefficients.
Sourcepub fn inverse(self) -> Transform2<WTo, WFrom>
pub fn inverse(self) -> Transform2<WTo, WFrom>
Produces NaN values when the determinant is zero.
Sourcepub fn compose(p: Point2<WTo>, vx: Vector2<WTo>, vy: Vector2<WTo>) -> Self
pub fn compose(p: Point2<WTo>, vx: Vector2<WTo>, vy: Vector2<WTo>) -> Self
Composes a transform from origin and basis vectors.
Sourcepub fn decompose(&self) -> (Point2<WTo>, Vector2<WTo>, Vector2<WTo>)
pub fn decompose(&self) -> (Point2<WTo>, Vector2<WTo>, Vector2<WTo>)
Decomposes the transform into origin and transformed basis vectors.
Sourcepub fn contains_point(&self, point: Point2<WTo>) -> bool
pub fn contains_point(&self, point: Point2<WTo>) -> bool
Returns true when point lands inside the transformed unit square.
Trait Implementations§
Source§impl<F, T> Clone for Transform2<F, T>
impl<F, T> Clone for Transform2<F, T>
Source§impl CoercionRules for Transform2
impl CoercionRules for Transform2
Source§fn allows_singleton_stack() -> bool
fn allows_singleton_stack() -> bool
Opts appearance layers into scalar-to-singleton stack conversion.
Ordinary vector values remain list-only.
Source§fn is_identity_roundtrip() -> bool
fn is_identity_roundtrip() -> bool
Whether cloning
Self preserves the semantics of converting that clone
through ToPaxValue and back with try_coerce. Read moreimpl<F, T> Copy for Transform2<F, T>
Source§impl<F, T> Debug for Transform2<F, T>
impl<F, T> Debug for Transform2<F, T>
Source§impl<T: Space, F: Space> From<Transform2<T, F>> for Affine
impl<T: Space, F: Space> From<Transform2<T, F>> for Affine
Source§fn from(value: Transform2<T, F>) -> Self
fn from(value: Transform2<T, F>) -> Self
Converts to this type from the input type.
Source§impl HelperFunctions for Transform2
impl HelperFunctions for Transform2
Source§fn register_all_functions()
fn register_all_functions()
Registers all helper functions for this type.
impl<F: Space, T: Space> ImplToFromPaxAny for Transform2<F, T>
Source§impl<W: Space, T: Space> Interpolatable for Transform2<W, T>
impl<W: Space, T: Space> Interpolatable for Transform2<W, T>
Source§fn interpolate(&self, other: &Self, t: f64) -> Self
fn interpolate(&self, other: &Self, t: f64) -> Self
Source§impl<F: Space, W: Space> Into<Transform2<F, W>> for TransformParts
impl<F: Space, W: Space> Into<Transform2<F, W>> for TransformParts
Source§fn into(self) -> Transform2<F, W>
fn into(self) -> Transform2<F, W>
Converts this type into the (usually inferred) input type.
Source§impl<F: Space, T: Space> Into<TransformParts> for Transform2<F, T>
NOTE: the returned parts.skew.y will always be equal to 0,
impl<F: Space, T: Space> Into<TransformParts> for Transform2<F, T>
NOTE: the returned parts.skew.y will always be equal to 0,
Source§fn into(self) -> TransformParts
fn into(self) -> TransformParts
Converts this type into the (usually inferred) input type.
Source§impl<W1: Space, W2: Space, W3: Space> Mul<Transform2<W1, W2>> for Transform2<W2, W3>
impl<W1: Space, W2: Space, W3: Space> Mul<Transform2<W1, W2>> for Transform2<W2, W3>
Source§type Output = Transform2<W1, W3>
type Output = Transform2<W1, W3>
The resulting type after applying the
* operator.Source§impl<F, T> PartialEq for Transform2<F, T>
impl<F, T> PartialEq for Transform2<F, T>
Source§impl ToPaxValue for Transform2
impl ToPaxValue for Transform2
Source§fn to_pax_value(self) -> PaxValue
fn to_pax_value(self) -> PaxValue
Converts this value into a
PaxValue.Source§fn nested_properties(&self) -> Vec<UntypedProperty>
fn nested_properties(&self) -> Vec<UntypedProperty>
Live properties read when snapshotting a compound value for PAXEL.
Adapters observe these as well as the containing property.
Source§fn to_pax_value_in_graph(self) -> PaxValuewhere
Self: Sized,
fn to_pax_value_in_graph(self) -> PaxValuewhere
Self: Sized,
Converts against owner-thread graph views, including nested generated
property fields. Requires an entered property graph for shared fields.
Ordinary
Self::to_pax_value reads published value snapshots.Auto Trait Implementations§
impl<WFrom, WTo> Freeze for Transform2<WFrom, WTo>
impl<WFrom, WTo> RefUnwindSafe for Transform2<WFrom, WTo>
impl<WFrom, WTo> Send for Transform2<WFrom, WTo>
impl<WFrom, WTo> Sync for Transform2<WFrom, WTo>
impl<WFrom, WTo> Unpin for Transform2<WFrom, WTo>
impl<WFrom, WTo> UnsafeUnpin for Transform2<WFrom, WTo>
impl<WFrom, WTo> UnwindSafe for Transform2<WFrom, WTo>
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> PropertyValue for T
Source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.
Source§impl<T> ToFromPaxAny for Twhere
T: ImplToFromPaxAny,
impl<T> ToFromPaxAny for Twhere
T: ImplToFromPaxAny,
Source§fn to_pax_any(self) -> PaxAny
fn to_pax_any(self) -> PaxAny
Converts this value into a
PaxAny.Source§fn from_pax_any(pax_any: PaxAny) -> Result<T, String>
fn from_pax_any(pax_any: PaxAny) -> Result<T, String>
Attempts to recover this concrete type from a
PaxAny.