Struct Matrix2

Source
#[repr(C)]
pub struct Matrix2<T: BaseFloat> { pub c0: Vector2<T>, pub c1: Vector2<T>, }

Fields§

§c0: Vector2<T>§c1: Vector2<T>

Implementations§

Source§

impl<T: BaseFloat> Matrix2<T>

Source

pub fn new(c0: Vector2<T>, c1: Vector2<T>) -> Matrix2<T>

Source

pub fn from_array(ary: &[Vector2<T>; 2]) -> &Matrix2<T>

Source

pub fn from_array_mut(ary: &mut [Vector2<T>; 2]) -> &mut Matrix2<T>

Source

pub fn as_array(&self) -> &[Vector2<T>; 2]

Source

pub fn as_array_mut(&mut self) -> &mut [Vector2<T>; 2]

Source

pub fn add_s(&self, rhs: T) -> Matrix2<T>

Source

pub fn add_m(&self, rhs: &Matrix2<T>) -> Matrix2<T>

Source

pub fn sub_s(&self, rhs: T) -> Matrix2<T>

Source

pub fn sub_m(&self, rhs: &Matrix2<T>) -> Matrix2<T>

Source

pub fn div_m(&self, rhs: &Matrix2<T>) -> Matrix2<T>

Source

pub fn div_s(&self, rhs: T) -> Matrix2<T>

Source

pub fn rem_m(&self, rhs: &Matrix2<T>) -> Matrix2<T>

Source

pub fn rem_s(&self, rhs: T) -> Matrix2<T>

Source

pub fn mul_s(&self, rhs: T) -> Matrix2<T>

Source

pub fn mul_v(&self, rhs: &Vector2<T>) -> Vector2<T>

Source

pub fn mul_m(&self, rhs: &Matrix2<T>) -> Matrix2<T>

Source

pub fn neg_m(&self) -> Matrix2<T>

Source§

impl<T: BaseFloat> Matrix2<T>

Source

pub fn extend(&self, z: Vector2<T>) -> Matrix3x2<T>

Extends self to a Matrix3x2 by appending the column vector z.

§Example
use glm::*;

let m2 = mat2(1., 2., 3., 4.);
let m3x2 = mat3x2(1., 2., 3., 4., 0., 0.);
assert_eq!(m2.extend(vec2(0., 0.)), m3x2);

Trait Implementations§

Source§

impl<T: BaseFloat> Add<T> for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Matrix2<T>

Performs the + operation. Read more
Source§

impl<T: BaseFloat> Add for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Matrix2<T>) -> Matrix2<T>

Performs the + operation. Read more
Source§

impl<T: BaseFloat> ApproxEq for Matrix2<T>

Source§

type BaseType = T

Source§

fn is_close_to(&self, rhs: &Matrix2<T>, max_diff: T) -> bool

Returns true if the difference between x and y is less than max_diff. Read more
Source§

fn is_approx_eq(&self, rhs: &Self) -> bool

Returns true if the difference between x and y is less than machine epsilon. Read more
Source§

impl<T: Clone + BaseFloat> Clone for Matrix2<T>

Source§

fn clone(&self) -> Matrix2<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + BaseFloat> Debug for Matrix2<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: BaseFloat> Div<T> for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Matrix2<T>

Performs the / operation. Read more
Source§

impl<T: BaseFloat> Div for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Matrix2<T>) -> Matrix2<T>

Performs the / operation. Read more
Source§

impl<T: BaseFloat> GenMat<T, Vector2<T>> for Matrix2<T>

Source§

type R = Vector2<T>

Type of row vectors.
Source§

type Transpose = Matrix2<T>

Type of transpose matrix.
Source§

fn transpose(&self) -> Matrix2<T>

Returns the transpose matrix. Read more
Source§

fn mul_c(&self, rhs: &Matrix2<T>) -> Matrix2<T>

Component-wise multiplication. Read more
Source§

impl<T: BaseFloat> GenSquareMat<T, Vector2<T>> for Matrix2<T>

Source§

fn determinant(&self) -> T

Returns the determinant of a square matrix. Read more
Source§

fn inverse(&self) -> Option<Matrix2<T>>

Returns the inverse matrix of a square matrix, or None if the matrix is not invertible.
Source§

impl<T: BaseFloat> Index<usize> for Matrix2<T>

Source§

type Output = Vector2<T>

The returned type after indexing.
Source§

fn index<'a>(&'a self, i: usize) -> &'a Vector2<T>

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: BaseFloat> IndexMut<usize> for Matrix2<T>

Source§

fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut Vector2<T>

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: BaseFloat> Mul<Matrix2<T>> for Matrix2x3<T>

Source§

type Output = Matrix2x3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix2<T>) -> Matrix2x3<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Mul<Matrix2<T>> for Matrix2x4<T>

Source§

type Output = Matrix2x4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix2<T>) -> Matrix2x4<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Mul<Matrix3x2<T>> for Matrix2<T>

Source§

type Output = Matrix3x2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix3x2<T>) -> Matrix3x2<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Mul<Matrix4x2<T>> for Matrix2<T>

Source§

type Output = Matrix4x2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix4x2<T>) -> Matrix4x2<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Mul<T> for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Matrix2<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Mul<Vector2<T>> for Matrix2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vector2<T>) -> Vector2<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Mul for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix2<T>) -> Matrix2<T>

Performs the * operation. Read more
Source§

impl<T: BaseFloat> Neg for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Matrix2<T>

Performs the unary - operation. Read more
Source§

impl<T: BaseFloat> One for Matrix2<T>

Source§

fn one() -> Matrix2<T>

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl<T: PartialEq + BaseFloat> PartialEq for Matrix2<T>

Source§

fn eq(&self, other: &Matrix2<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: BaseFloat> Rand for Matrix2<T>

Source§

fn rand<R: Rng>(rng: &mut R) -> Matrix2<T>

Generates a random instance of this type using the specified source of randomness.
Source§

impl<T: BaseFloat> Rem<T> for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Matrix2<T>

Performs the % operation. Read more
Source§

impl<T: BaseFloat> Rem for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Matrix2<T>) -> Matrix2<T>

Performs the % operation. Read more
Source§

impl<T: BaseFloat> Sub<T> for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Matrix2<T>

Performs the - operation. Read more
Source§

impl<T: BaseFloat> Sub for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Matrix2<T>) -> Matrix2<T>

Performs the - operation. Read more
Source§

impl<T: BaseFloat> Zero for Matrix2<T>

Source§

fn zero() -> Matrix2<T>

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<T: Copy + BaseFloat> Copy for Matrix2<T>

Source§

impl<T: BaseFloat> StructuralPartialEq for Matrix2<T>

Auto Trait Implementations§

§

impl<T> Freeze for Matrix2<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Matrix2<T>
where T: RefUnwindSafe,

§

impl<T> Send for Matrix2<T>

§

impl<T> Sync for Matrix2<T>
where T: Sync,

§

impl<T> Unpin for Matrix2<T>
where T: Unpin,

§

impl<T> UnwindSafe for Matrix2<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,