Struct physics2d::Mat2
[−]
[src]
pub struct Mat2 { pub a00: f32, pub a01: f32, pub a10: f32, pub a11: f32, }
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]
fn new(a00: f32, a01: f32, a10: f32, a11: f32) -> Mat2
[src]
Creates a new matrix from the given elements.
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);
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());
const I: Mat2
I: Mat2 = Mat2{a00: 1.0, a01: 0.0, a10: 0.0, a11: 1.0,}
Trait Implementations
impl PartialEq for Mat2
[src]
fn eq(&self, __arg_0: &Mat2) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Mat2) -> bool
[src]
This method tests for !=
.
impl Copy for Mat2
[src]
impl Clone for Mat2
[src]
fn clone(&self) -> Mat2
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Mat2
[src]
impl Mul for Mat2
[src]
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, other: Mat2) -> Mat2
[src]
Performs the *
operation.
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]
Performs the *
operation.
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]
Performs the *
operation.
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]
Performs the *
operation.
impl Mul<Vec2> for Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, other: Vec2) -> Vec2
[src]
Performs the *
operation.
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]
Performs the *
operation.
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]
Performs the *
operation.
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]
Performs the *
operation.
impl MulAssign for Mat2
[src]
fn mul_assign(&mut self, other: Mat2)
[src]
Performs the *=
operation.
impl<'b> MulAssign<&'b Mat2> for Mat2
[src]
fn mul_assign(&mut self, other: &'b Mat2)
[src]
Performs the *=
operation.