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

The element of the 1st row and 1st column.

The element of the 1st row and 2nd column.

The element of the 2nd row and 1st column.

The element of the 2nd row and 2nd column.

Methods

impl Mat2
[src]

[src]

Creates a new matrix from the given elements.

[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);

[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());

I: Mat2 = Mat2{a00: 1.0, a01: 0.0, a10: 0.0, a11: 1.0,}

Trait Implementations

impl PartialEq for Mat2
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Copy for Mat2
[src]

impl Clone for Mat2
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Mat2
[src]

[src]

Formats the value using the given formatter.

impl Mul for Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<Mat2> for &'a Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'b> Mul<&'b Mat2> for Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a, 'b> Mul<&'b Mat2> for &'a Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Mul<Vec2> for Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<Vec2> for &'a Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'b> Mul<&'b Vec2> for Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a, 'b> Mul<&'b Vec2> for &'a Mat2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl MulAssign for Mat2
[src]

[src]

Performs the *= operation.

impl<'b> MulAssign<&'b Mat2> for Mat2
[src]

[src]

Performs the *= operation.