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: f32The first element of the first row.
m12: f32The second element of the first row.
m21: f32The first element of the second row.
m22: f32The second element of the second row.
m31: f32The first element of the third row.
m32: f32The second element of the third row.
Implementations§
Source§impl Matrix3x2
impl Matrix3x2
Sourcepub const fn new(
m11: f32,
m12: f32,
m21: f32,
m22: f32,
m31: f32,
m32: f32,
) -> Self
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.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Gets a value that indicates whether the current matrix is the identity matrix.
Sourcepub fn translation(&self) -> Vector2
pub fn translation(&self) -> Vector2
Gets the translation component of this matrix.
Sourcepub fn set_translation(&mut self, value: Vector2)
pub fn set_translation(&mut self, value: Vector2)
Sets the translation component of this matrix.
Sourcepub fn create_rotation(radians: f32) -> Matrix3x2
pub fn create_rotation(radians: f32) -> Matrix3x2
Creates a rotation matrix using the given rotation in radians.
Sourcepub fn create_rotation_at(radians: f32, center_point: Vector2) -> Matrix3x2
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.
Sourcepub fn create_scale(scales: Vector2) -> Matrix3x2
pub fn create_scale(scales: Vector2) -> Matrix3x2
Creates a scaling matrix from the specified vector scale.
Sourcepub fn create_scale_xy(x_scale: f32, y_scale: f32) -> Matrix3x2
pub fn create_scale_xy(x_scale: f32, y_scale: f32) -> Matrix3x2
Creates a scaling matrix from the specified X and Y components.
Sourcepub fn create_scale_uniform(scale: f32) -> Matrix3x2
pub fn create_scale_uniform(scale: f32) -> Matrix3x2
Creates a scaling matrix that scales uniformly with the given scale.
Sourcepub fn create_scale_at(scales: Vector2, center_point: Vector2) -> Matrix3x2
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.
Sourcepub fn create_skew(radians_x: f32, radians_y: f32) -> Matrix3x2
pub fn create_skew(radians_x: f32, radians_y: f32) -> Matrix3x2
Creates a skew matrix from the specified angles in radians.
Sourcepub fn create_skew_at(
radians_x: f32,
radians_y: f32,
center_point: Vector2,
) -> Matrix3x2
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.
Sourcepub fn create_translation(position: Vector2) -> Matrix3x2
pub fn create_translation(position: Vector2) -> Matrix3x2
Creates a translation matrix from the specified 2-dimensional vector.
Sourcepub fn create_translation_xy(x_position: f32, y_position: f32) -> Matrix3x2
pub fn create_translation_xy(x_position: f32, y_position: f32) -> Matrix3x2
Creates a translation matrix from the specified X and Y components.
Sourcepub fn get_determinant(&self) -> f32
pub fn get_determinant(&self) -> f32
Calculates the determinant for this matrix.
Sourcepub fn invert(matrix: Matrix3x2) -> Option<Matrix3x2>
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.
Sourcepub fn invert_or_nan(matrix: Matrix3x2) -> Matrix3x2
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).
Trait Implementations§
Source§impl BatchValue for Matrix3x2
impl BatchValue for Matrix3x2
impl Copy for Matrix3x2
Source§impl ExpressionVariantValue for Matrix3x2
impl ExpressionVariantValue for Matrix3x2
Source§const FFI_VARIANT_TYPE: Option<VariantType>
const FFI_VARIANT_TYPE: Option<VariantType>
None when the type cannot be a foreign function parameter.Source§fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
Source§fn into_variant(self) -> ExpressionVariant
fn into_variant(self) -> ExpressionVariant
Source§impl From<Matrix3x2> for ExpressionVariant
impl From<Matrix3x2> for ExpressionVariant
Source§fn from(value: Matrix3x2) -> ExpressionVariant
fn from(value: Matrix3x2) -> ExpressionVariant
impl StructuralPartialEq for Matrix3x2
Auto Trait Implementations§
impl Freeze for Matrix3x2
impl RefUnwindSafe for Matrix3x2
impl Send for Matrix3x2
impl Sync for Matrix3x2
impl Unpin for Matrix3x2
impl UnsafeUnpin for Matrix3x2
impl UnwindSafe for Matrix3x2
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more