Skip to main content

Matrix3x2

Struct Matrix3x2 

Source
pub struct Matrix3x2 {
    pub m11: f32,
    pub m12: f32,
    pub m21: f32,
    pub m22: f32,
    pub m31: f32,
    pub m32: f32,
}
Expand description

A 3x2 matrix (a two-dimensional affine transform).

Fields§

§m11: f32

The first element of the first row.

§m12: f32

The second element of the first row.

§m21: f32

The first element of the second row.

§m22: f32

The second element of the second row.

§m31: f32

The first element of the third row.

§m32: f32

The second element of the third row.

Implementations§

Source§

impl Matrix3x2

Source

pub const IDENTITY: Matrix3x2

The multiplicative identity matrix.

Source

pub const fn new( m11: f32, m12: f32, m21: f32, m22: f32, m31: f32, m32: f32, ) -> Self

Creates a 3x2 matrix from the specified components.

Source

pub fn is_identity(&self) -> bool

Gets a value that indicates whether the current matrix is the identity matrix.

Source

pub fn translation(&self) -> Vector2

Gets the translation component of this matrix.

Source

pub fn set_translation(&mut self, value: Vector2)

Sets the translation component of this matrix.

Source

pub fn create_rotation(radians: f32) -> Matrix3x2

Creates a rotation matrix using the given rotation in radians.

Source

pub fn create_rotation_at(radians: f32, center_point: Vector2) -> Matrix3x2

Creates a rotation matrix using the specified rotation in radians and a center point.

Source

pub fn create_scale(scales: Vector2) -> Matrix3x2

Creates a scaling matrix from the specified vector scale.

Source

pub fn create_scale_xy(x_scale: f32, y_scale: f32) -> Matrix3x2

Creates a scaling matrix from the specified X and Y components.

Source

pub fn create_scale_uniform(scale: f32) -> Matrix3x2

Creates a scaling matrix that scales uniformly with the given scale.

Source

pub fn create_scale_at(scales: Vector2, center_point: Vector2) -> Matrix3x2

Creates a scaling matrix from the specified vector scale with an offset from the specified center point.

Source

pub fn create_skew(radians_x: f32, radians_y: f32) -> Matrix3x2

Creates a skew matrix from the specified angles in radians.

Source

pub fn create_skew_at( radians_x: f32, radians_y: f32, center_point: Vector2, ) -> Matrix3x2

Creates a skew matrix from the specified angles in radians and a center point.

Source

pub fn create_translation(position: Vector2) -> Matrix3x2

Creates a translation matrix from the specified 2-dimensional vector.

Source

pub fn create_translation_xy(x_position: f32, y_position: f32) -> Matrix3x2

Creates a translation matrix from the specified X and Y components.

Source

pub fn get_determinant(&self) -> f32

Calculates the determinant for this matrix.

Source

pub fn invert(matrix: Matrix3x2) -> Option<Matrix3x2>

Tries to invert the specified matrix. Returns None when the matrix is singular; see Matrix3x2::invert_or_nan for the value the reference runtime stores in that case.

Source

pub fn invert_or_nan(matrix: Matrix3x2) -> Matrix3x2

Inverts the specified matrix; a singular matrix gives a matrix whose components are all NaN (the out value of the reference runtime).

Source

pub fn lerp(matrix1: Matrix3x2, matrix2: Matrix3x2, amount: f32) -> Matrix3x2

Performs a linear interpolation from one matrix to a second matrix based on a value that specifies the weighting of the second matrix.

Trait Implementations§

Source§

impl Add for Matrix3x2

Source§

type Output = Matrix3x2

The resulting type after applying the + operator.
Source§

fn add(self, value2: Matrix3x2) -> Matrix3x2

Performs the + operation. Read more
Source§

impl BatchValue for Matrix3x2

Source§

fn write_to(&self, out: &mut Vec<u8>)

Source§

fn read_from(input: &mut BatchValueReader<'_>) -> Self

Source§

impl Clone for Matrix3x2

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Matrix3x2

Source§

impl Debug for Matrix3x2

Source§

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

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

impl Default for Matrix3x2

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Matrix3x2

Source§

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

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

impl ExpressionVariantValue for Matrix3x2

Source§

const FFI_VARIANT_TYPE: Option<VariantType>

The variant type a foreign function parameter of this type is matched against, or None when the type cannot be a foreign function parameter.
Source§

fn try_from_variant(v: &ExpressionVariant) -> Option<Self>

Source§

fn into_variant(self) -> ExpressionVariant

Source§

impl From<Matrix3x2> for ExpressionVariant

Source§

fn from(value: Matrix3x2) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl Mul for Matrix3x2

Source§

type Output = Matrix3x2

The resulting type after applying the * operator.
Source§

fn mul(self, value2: Matrix3x2) -> Matrix3x2

Performs the * operation. Read more
Source§

impl Mul<f32> for Matrix3x2

Multiplies every component by a scalar.

Source§

type Output = Matrix3x2

The resulting type after applying the * operator.
Source§

fn mul(self, value2: f32) -> Matrix3x2

Performs the * operation. Read more
Source§

impl Neg for Matrix3x2

Source§

type Output = Matrix3x2

The resulting type after applying the - operator.
Source§

fn neg(self) -> Matrix3x2

Performs the unary - operation. Read more
Source§

impl PartialEq for Matrix3x2

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Matrix3x2

Source§

impl Sub for Matrix3x2

Source§

type Output = Matrix3x2

The resulting type after applying the - operator.
Source§

fn sub(self, value2: Matrix3x2) -> Matrix3x2

Performs the - operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.