pub struct Matrix4<S> {
pub x: Vector4<S>,
pub y: Vector4<S>,
pub z: Vector4<S>,
pub w: Vector4<S>,
}
Expand description
A 4 x 4, column major matrix
Fields§
§x: Vector4<S>
§y: Vector4<S>
§z: Vector4<S>
§w: Vector4<S>
Implementations§
source§impl<S> Matrix4<S>
impl<S> Matrix4<S>
source§impl<S: BaseNum> Matrix4<S>
impl<S: BaseNum> Matrix4<S>
sourcepub fn from_translation(v: Vector3<S>) -> Matrix4<S>
pub fn from_translation(v: Vector3<S>) -> Matrix4<S>
Create a translation matrix from a Vector3
Trait Implementations§
source§impl<S: BaseNum> From<AffineMatrix3<S>> for Matrix4<S>
impl<S: BaseNum> From<AffineMatrix3<S>> for Matrix4<S>
source§fn from(aff: AffineMatrix3<S>) -> Matrix4<S>
fn from(aff: AffineMatrix3<S>) -> Matrix4<S>
Converts to this type from the input type.
source§impl<S: BaseFloat + 'static> From<Perspective<S>> for Matrix4<S>
impl<S: BaseFloat + 'static> From<Perspective<S>> for Matrix4<S>
source§fn from(persp: Perspective<S>) -> Matrix4<S>
fn from(persp: Perspective<S>) -> Matrix4<S>
Converts to this type from the input type.
source§impl<S: BaseFloat, A: Angle<S>> From<PerspectiveFov<S, A>> for Matrix4<S>
impl<S: BaseFloat, A: Angle<S>> From<PerspectiveFov<S, A>> for Matrix4<S>
source§fn from(persp: PerspectiveFov<S, A>) -> Matrix4<S>
fn from(persp: PerspectiveFov<S, A>) -> Matrix4<S>
Converts to this type from the input type.
source§impl<S: BaseFloat> From<Quaternion<S>> for Matrix4<S>
impl<S: BaseFloat> From<Quaternion<S>> for Matrix4<S>
source§fn from(quat: Quaternion<S>) -> Matrix4<S>
fn from(quat: Quaternion<S>) -> Matrix4<S>
Convert the quaternion to a 4 x 4 rotation matrix
source§impl<S: BaseFloat> Matrix for Matrix4<S>
impl<S: BaseFloat> Matrix for Matrix4<S>
source§fn swap_columns(&mut self, a: usize, b: usize)
fn swap_columns(&mut self, a: usize, b: usize)
Swap two columns of this array.
source§fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize))
fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize))
Swap the values at index
a
and b
source§fn mul_s(&self, s: S) -> Matrix4<S>
fn mul_s(&self, s: S) -> Matrix4<S>
Multiply this matrix by a scalar, returning the new matrix.
source§fn mul_self_s(&mut self, s: S)
fn mul_self_s(&mut self, s: S)
Multiply this matrix by a scalar, in-place.
source§fn div_self_s(&mut self, s: S)
fn div_self_s(&mut self, s: S)
Divide this matrix by a scalar, in-place.
source§fn as_mut_ptr(&mut self) -> *mut Self::Element
fn as_mut_ptr(&mut self) -> *mut Self::Element
Get a mutable pointer to the first element of the array.
source§impl<S: PartialEq> PartialEq<Matrix4<S>> for Matrix4<S>
impl<S: PartialEq> PartialEq<Matrix4<S>> for Matrix4<S>
source§impl<S: BaseFloat> SquareMatrix for Matrix4<S>
impl<S: BaseFloat> SquareMatrix for Matrix4<S>
source§fn from_value(value: S) -> Matrix4<S>
fn from_value(value: S) -> Matrix4<S>
Create a new diagonal matrix using the supplied value.
source§fn from_diagonal(value: Vector4<S>) -> Matrix4<S>
fn from_diagonal(value: Vector4<S>) -> Matrix4<S>
Create a matrix from a non-uniform scale
source§fn one() -> Matrix4<S>
fn one() -> Matrix4<S>
Create a matrix where the each element of the diagonal is equal to one.
source§fn add_m(&self, m: &Matrix4<S>) -> Matrix4<S>
fn add_m(&self, m: &Matrix4<S>) -> Matrix4<S>
Add this matrix with another matrix, returning the new metrix.
source§fn sub_m(&self, m: &Matrix4<S>) -> Matrix4<S>
fn sub_m(&self, m: &Matrix4<S>) -> Matrix4<S>
Subtract another matrix from this matrix, returning the new matrix.
source§fn add_self_m(&mut self, m: &Matrix4<S>)
fn add_self_m(&mut self, m: &Matrix4<S>)
Add this matrix with another matrix, in-place.
source§fn sub_self_m(&mut self, m: &Matrix4<S>)
fn sub_self_m(&mut self, m: &Matrix4<S>)
Subtract another matrix from this matrix, in-place.
source§fn transpose_self(&mut self)
fn transpose_self(&mut self)
Transpose this matrix in-place.
source§fn determinant(&self) -> S
fn determinant(&self) -> S
Take the determinant of this matrix.
source§fn invert(&self) -> Option<Matrix4<S>>
fn invert(&self) -> Option<Matrix4<S>>
Invert this matrix, returning a new matrix.
m.mul_m(m.invert())
is
the identity matrix. Returns None
if this matrix is not invertible
(has a determinant of zero).source§fn is_diagonal(&self) -> bool
fn is_diagonal(&self) -> bool
Test if this is a diagonal matrix. That is, every element outside of
the diagonal is 0.
source§fn is_symmetric(&self) -> bool
fn is_symmetric(&self) -> bool
Test if this matrix is symmetric. That is, it is equal to its
transpose.
source§fn mul_self_m(&mut self, m: &Self)
fn mul_self_m(&mut self, m: &Self)
Multiply this matrix by another matrix, in-place.
source§fn trace(&self) -> Self::Element
fn trace(&self) -> Self::Element
Return the trace of this matrix. That is, the sum of the diagonal.
source§fn invert_self(&mut self)
fn invert_self(&mut self)
Invert this matrix in-place.
source§fn is_invertible(&self) -> bool
fn is_invertible(&self) -> bool
Test if this matrix is invertible.
impl<S: Copy> Copy for Matrix4<S>
impl<S> StructuralPartialEq for Matrix4<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Matrix4<S>where S: RefUnwindSafe,
impl<S> Send for Matrix4<S>where S: Send,
impl<S> Sync for Matrix4<S>where S: Sync,
impl<S> Unpin for Matrix4<S>where S: Unpin,
impl<S> UnwindSafe for Matrix4<S>where S: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more