Struct matriarch::Mat2 [−][src]
A 2x2 Matrix with elements arranged in row-major order.
A Mat2 is laid out as follows:
[ a b ]
A = [ c d ]
Fields
a: f32
b: f32
c: f32
d: f32
Methods
impl Mat2
[src]
impl Mat2
pub fn new() -> Mat2
[src]
pub fn new() -> Mat2
Returns a new array with all elements set to 0.0
pub fn identity() -> Mat2
[src]
pub fn identity() -> Mat2
Returns an identity matrix.
pub fn new_from_values(a: &f32, b: &f32, c: &f32, d: &f32) -> Mat2
[src]
pub fn new_from_values(a: &f32, b: &f32, c: &f32, d: &f32) -> Mat2
Creates a new Mat2 using the borrowed values.
pub fn new_from_array(input: &[f32; 4]) -> Mat2
[src]
pub fn new_from_array(input: &[f32; 4]) -> Mat2
Creates a new Mat2 from a row-major ordered array.
pub fn new_from_col_array(input: &[f32; 4]) -> Mat2
[src]
pub fn new_from_col_array(input: &[f32; 4]) -> Mat2
Creates a Mat2 from a column-major ordered array.
pub fn to_array(&self) -> [f32; 4]
[src]
pub fn to_array(&self) -> [f32; 4]
Returns an array of the Mat2 elements in row-major order.
pub fn to_col_array(&self) -> [f32; 4]
[src]
pub fn to_col_array(&self) -> [f32; 4]
Returns an array of the Mat2 elements in column-major order.
pub fn to_vec2_array(&self) -> [Vec2; 2]
[src]
pub fn to_vec2_array(&self) -> [Vec2; 2]
Returns the matrix as an array of Vec2 columns
pub fn determinant(&self) -> f32
[src]
pub fn determinant(&self) -> f32
Returns the determinant of a Mat2.
pub fn transpose(&self) -> Mat2
[src]
pub fn transpose(&self) -> Mat2
Returns a new Mat2 that is the tranpose of the original Mat2.
Trait Implementations
impl Clone for Mat2
[src]
impl Clone for Mat2
fn clone(&self) -> Mat2
[src]
fn clone(&self) -> Mat2
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Mat2
[src]
impl Copy for Mat2
impl Debug for Mat2
[src]
impl Debug for Mat2
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Mat2
[src]
impl Default for Mat2
impl PartialEq for Mat2
[src]
impl PartialEq for Mat2
fn eq(&self, other: &Mat2) -> bool
[src]
fn eq(&self, other: &Mat2) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Mat2) -> bool
[src]
fn ne(&self, other: &Mat2) -> bool
This method tests for !=
.
impl Mul<Mat2> for Mat2
[src]
impl Mul<Mat2> for Mat2
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, other_mat2: Mat2) -> Mat2
[src]
fn mul(self, other_mat2: Mat2) -> Mat2
Multiplies two Mat2s together, returning a new Mat2.
Keep in mind that matrix multiplication is not commutative, such that
A*B != B*A
for most matrices (the main exception being the Identity
matrix)
Example:
let some_mat2 = mat2 * some_other_mat2;
impl Mul<Vec2> for Mat2
[src]
impl Mul<Vec2> for Mat2
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, vec2: Vec2) -> Vec2
[src]
fn mul(self, vec2: Vec2) -> Vec2
Multiplies a Mat2 by a Vec2, returning a Vec2.
impl Mul<Mat2> for f32
[src]
impl Mul<Mat2> for f32