#[repr(C)]pub struct Matrix<T> {
pub xx: T,
pub yx: T,
pub xy: T,
pub yy: T,
pub dx: T,
pub dy: T,
}Expand description
A transformation matrix.
This is a column-major 3x2 affine matrix with the following representation:
| xx xy dx |
| yx yy dy |with the basis vectors (xx, yx), (xy, yy) and the translation
(dx, dy).
Transformation of the point (x, y) is applied as follows:
x' = xx * x + xy * y + dx
y' = yx * x + yy * y + dyOur matrices are typically considered to be right-handed, meaning that positive angles apply counter-clockwise rotations and the rotation matrix for angle a is:
| cos(a) -sin(a) 0 |
| sin(a) cos(a) 0 |Matrix multiplication chains transforms in right to left order meaning
that for C = A * B, matrix C will apply B and then A.
Fields§
§xx: T§yx: T§xy: T§yy: T§dx: T§dy: TImplementations§
Trait Implementations§
Source§impl<T: MatrixElement> Default for Matrix<T>
impl<T: MatrixElement> Default for Matrix<T>
Source§impl<'de, T> Deserialize<'de> for Matrix<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Matrix<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: MatrixElement> Mul for Matrix<T>
impl<T: MatrixElement> Mul for Matrix<T>
Source§impl<T: MatrixElement> MulAssign for Matrix<T>
impl<T: MatrixElement> MulAssign for Matrix<T>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl<T> Zeroable for Matrix<T>where
T: AnyBitPattern,
impl<T> Zeroable for Matrix<T>where
T: AnyBitPattern,
impl<T> AnyBitPattern for Matrix<T>where
T: AnyBitPattern,
impl<T: Copy> Copy for Matrix<T>
impl<T: Eq> Eq for Matrix<T>
impl<T> StructuralPartialEq for Matrix<T>
Auto Trait Implementations§
impl<T> Freeze for Matrix<T>where
T: Freeze,
impl<T> RefUnwindSafe for Matrix<T>where
T: RefUnwindSafe,
impl<T> Send for Matrix<T>where
T: Send,
impl<T> Sync for Matrix<T>where
T: Sync,
impl<T> Unpin for Matrix<T>where
T: Unpin,
impl<T> UnsafeUnpin for Matrix<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Matrix<T>where
T: UnwindSafe,
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.