[−][src]Struct physics2d::math::Mat2
A square matrix of order 2.
It is primarily used to represent 2D rotation matrices, but can be used otherwise too.
The elements are named based on their zero-based row-column positions.
Fields
a00: f32
The element of the 1st row and 1st column.
a01: f32
The element of the 1st row and 2nd column.
a10: f32
The element of the 2nd row and 1st column.
a11: f32
The element of the 2nd row and 2nd column.
Methods
impl Mat2
[src]
pub fn new(a00: f32, a01: f32, a10: f32, a11: f32) -> Mat2
[src]
Creates a new matrix from the given elements.
pub fn rotation(angle: f32) -> Mat2
[src]
Creates a new rotation matrix for a rotation angle in radians.
Examples
let a = Mat2::rotation(0.0); let b = Mat2::new(1.0, 0.0, 0.0, 1.0); assert_eq!(a, b);
pub fn transpose(&self) -> Mat2
[src]
Returns the transpose of the matrix.
Examples
let a = Mat2::new(3.0, 1.0, 8.0, 1.0); let a_t = Mat2::new(3.0, 8.0, 1.0, 1.0); assert_eq!(a_t, a.transpose());
pub const I: Mat2
[src]
Trait Implementations
impl Clone for Mat2
[src]
fn clone(&self) -> Mat2
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Mat2> for Mat2
[src]
impl Copy for Mat2
[src]
impl Debug for Mat2
[src]
impl Mul<Mat2> for Mat2
[src]
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, other: Mat2) -> Mat2
[src]
impl<'a> Mul<Mat2> for &'a Mat2
[src]
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, other: Mat2) -> Mat2
[src]
impl<'b> Mul<&'b Mat2> for Mat2
[src]
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, other: &'b Mat2) -> Mat2
[src]
impl<'a, 'b> Mul<&'b Mat2> for &'a Mat2
[src]
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, other: &'b Mat2) -> Mat2
[src]
impl Mul<Vec2> for Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, other: Vec2) -> Vec2
[src]
impl<'a> Mul<Vec2> for &'a Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, other: Vec2) -> Vec2
[src]
impl<'b> Mul<&'b Vec2> for Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, other: &'b Vec2) -> Vec2
[src]
impl<'a, 'b> Mul<&'b Vec2> for &'a Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, other: &'b Vec2) -> Vec2
[src]
impl MulAssign<Mat2> for Mat2
[src]
fn mul_assign(&mut self, other: Mat2)
[src]
impl<'b> MulAssign<&'b Mat2> for Mat2
[src]
fn mul_assign(&mut self, other: &'b Mat2)
[src]
Auto Trait Implementations
impl Sync for Mat2
impl Send for Mat2
impl Unpin for Mat2
impl RefUnwindSafe for Mat2
impl UnwindSafe for Mat2
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,