#[repr(C)]
pub struct TypedTransform2D<T, Src, Dst> { pub m11: T, pub m12: T, pub m21: T, pub m22: T, pub m31: T, pub m32: T, /* private fields */ }
Expand description

A 2d transform stored as a 3 by 2 matrix in row-major order in memory.

Transforms can be parametrized over the source and destination units, to describe a transformation from a space to another. For example, TypedTransform2D<f32, WorldSpace, ScreenSpace>::transform_point4d takes a TypedPoint2D<f32, WorldSpace> and returns a TypedPoint2D<f32, ScreenSpace>.

Transforms expose a set of convenience methods for pre- and post-transformations. A pre-transformation corresponds to adding an operation that is applied before the rest of the transformation, while a post-transformation adds an operation that is applied after.

Fields

m11: Tm12: Tm21: Tm22: Tm31: Tm32: T

Implementations

Create a transform specifying its matrix elements in row-major order.

Create a transform specifying its matrix elements in column-major order.

Returns an array containing this transform’s terms in row-major order (the order in which the transform is actually laid out in memory).

Returns an array containing this transform’s terms in column-major order.

Returns an array containing this transform’s 3 rows in (in row-major order) as arrays.

This is a convenience method to interface with other libraries like glium.

Creates a transform from an array of 6 elements in row-major order.

Creates a transform from 3 rows of 2 elements (row-major order).

Drop the units, preserving only the numeric value.

Tag a unitless value with units.

Cast from one numeric representation to another, preserving the units.

Fallible cast from one numeric representation to another, preserving the units.

Returns the multiplication of the two matrices such that mat’s transformation applies after self’s transformation.

Returns the multiplication of the two matrices such that mat’s transformation applies before self’s transformation.

Returns a translation transform.

Applies a translation after self’s transformation and returns the resulting transform.

Applies a translation before self’s transformation and returns the resulting transform.

Returns a scale transform.

Applies a scale after self’s transformation and returns the resulting transform.

Applies a scale before self’s transformation and returns the resulting transform.

Returns a rotation transform.

Applies a rotation after self’s transformation and returns the resulting transform.

Applies a rotation after self’s transformation and returns the resulting transform.

Returns the given point transformed by this transform.

Returns the given vector transformed by this matrix.

Returns a rectangle that encompasses the result of transforming the given rectangle by this transform.

Computes and returns the determinant of this transform.

Returns the inverse transform if possible.

Returns the same transform with a different destination unit.

Returns the same transform with a different source unit.

Create a 3D transform from the current transform

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
Converts this type into the (usually inferred) input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.