pub enum FastTransform<Src, Dst> {
    Offset(Vector2D<f32, Src>),
    Transform {
        transform: Transform3D<f32, Src, Dst>,
        inverse: Option<Transform3D<f32, Dst, Src>>,
        is_2d: bool,
    },
}
Expand description

An enum that tries to avoid expensive transformation matrix calculations when possible when dealing with non-perspective axis-aligned transformations.

Variants§

§

Offset(Vector2D<f32, Src>)

A simple offset, which can be used without doing any matrix math.

§

Transform

Fields

§transform: Transform3D<f32, Src, Dst>
§inverse: Option<Transform3D<f32, Dst, Src>>
§is_2d: bool

A 2D transformation with an inverse.

Implementations§

source§

impl<Src, Dst> FastTransform<Src, Dst>

source

pub fn identity() -> Self

source

pub fn with_vector(offset: Vector2D<f32, Src>) -> Self

source

pub fn with_scale_offset(scale_offset: ScaleOffset) -> Self

source

pub fn with_transform(transform: Transform3D<f32, Src, Dst>) -> Self

source

pub fn to_transform(&self) -> Cow<'_, Transform3D<f32, Src, Dst>>

source

pub fn is_identity(&self) -> bool

Return true if this is an identity transform

source

pub fn then<NewDst>( &self, other: &FastTransform<Dst, NewDst> ) -> FastTransform<Src, NewDst>

source

pub fn pre_transform<NewSrc>( &self, other: &FastTransform<NewSrc, Src> ) -> FastTransform<NewSrc, Dst>

source

pub fn pre_translate(&self, other_offset: Vector2D<f32, Src>) -> Self

source

pub fn then_translate(&self, other_offset: Vector2D<f32, Dst>) -> Self

source

pub fn is_backface_visible(&self) -> bool

source

pub fn transform_point2d( &self, point: Point2D<f32, Src> ) -> Option<Point2D<f32, Dst>>

source

pub fn project_point2d( &self, point: Point2D<f32, Src> ) -> Option<Point2D<f32, Dst>>

source

pub fn inverse(&self) -> Option<FastTransform<Dst, Src>>

Trait Implementations§

source§

impl<Src, Dst> Clone for FastTransform<Src, Dst>

source§

fn clone(&self) -> Self

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<Src: Debug, Dst: Debug> Debug for FastTransform<Src, Dst>

source§

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

Formats the value using the given formatter. Read more
source§

impl<Src, Dst> From<Transform3D<f32, Src, Dst>> for FastTransform<Src, Dst>

source§

fn from(transform: Transform3D<f32, Src, Dst>) -> Self

Converts to this type from the input type.
source§

impl<Src, Dst> From<Vector2D<f32, Src>> for FastTransform<Src, Dst>

source§

fn from(vector: Vector2D<f32, Src>) -> Self

Converts to this type from the input type.
source§

impl<Src, Dst> MallocSizeOf for FastTransform<Src, Dst>where Src: MallocSizeOf, Dst: MallocSizeOf,

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl<Src, Dst> Serialize for FastTransform<Src, Dst>where Src: Serialize, Dst: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Src, Dst> Copy for FastTransform<Src, Dst>

Auto Trait Implementations§

§

impl<Src, Dst> RefUnwindSafe for FastTransform<Src, Dst>where Dst: RefUnwindSafe, Src: RefUnwindSafe,

§

impl<Src, Dst> Send for FastTransform<Src, Dst>where Dst: Send, Src: Send,

§

impl<Src, Dst> Sync for FastTransform<Src, Dst>where Dst: Sync, Src: Sync,

§

impl<Src, Dst> Unpin for FastTransform<Src, Dst>where Dst: Unpin, Src: Unpin,

§

impl<Src, Dst> UnwindSafe for FastTransform<Src, Dst>where Dst: UnwindSafe, Src: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.