pub struct Matrix3<S> {
pub x: Vector3<S>,
pub y: Vector3<S>,
pub z: Vector3<S>,
}
Expand description
A 3 x 3, column major matrix
Fields§
§x: Vector3<S>
§y: Vector3<S>
§z: Vector3<S>
Implementations§
source§impl<S: BaseFloat> Matrix3<S>
impl<S: BaseFloat> Matrix3<S>
sourcepub fn new(
c0r0: S,
c0r1: S,
c0r2: S,
c1r0: S,
c1r1: S,
c1r2: S,
c2r0: S,
c2r1: S,
c2r2: S
) -> Matrix3<S>
pub fn new( c0r0: S, c0r1: S, c0r2: S, c1r0: S, c1r1: S, c1r2: S, c2r0: S, c2r1: S, c2r2: S ) -> Matrix3<S>
Create a new matrix, providing values for each index.
sourcepub fn from_cols(c0: Vector3<S>, c1: Vector3<S>, c2: Vector3<S>) -> Matrix3<S>
pub fn from_cols(c0: Vector3<S>, c1: Vector3<S>, c2: Vector3<S>) -> Matrix3<S>
Create a new matrix, providing columns.
sourcepub fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Matrix3<S>
pub fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Matrix3<S>
Create a rotation matrix that will cause a vector to point at
dir
, using up
for orientation.
sourcepub fn from_angle_x(theta: Rad<S>) -> Matrix3<S>
pub fn from_angle_x(theta: Rad<S>) -> Matrix3<S>
Create a rotation matrix from a rotation around the x
axis (pitch).
sourcepub fn from_angle_y(theta: Rad<S>) -> Matrix3<S>
pub fn from_angle_y(theta: Rad<S>) -> Matrix3<S>
Create a rotation matrix from a rotation around the y
axis (yaw).
sourcepub fn from_angle_z(theta: Rad<S>) -> Matrix3<S>
pub fn from_angle_z(theta: Rad<S>) -> Matrix3<S>
Create a rotation matrix from a rotation around the z
axis (roll).
sourcepub fn from_euler(x: Rad<S>, y: Rad<S>, z: Rad<S>) -> Matrix3<S>
pub fn from_euler(x: Rad<S>, y: Rad<S>, z: Rad<S>) -> Matrix3<S>
Create a rotation matrix from a set of euler angles.
Parameters
x
: the angular rotation around thex
axis (pitch).y
: the angular rotation around they
axis (yaw).z
: the angular rotation around thez
axis (roll).
sourcepub fn from_axis_angle(axis: Vector3<S>, angle: Rad<S>) -> Matrix3<S>
pub fn from_axis_angle(axis: Vector3<S>, angle: Rad<S>) -> Matrix3<S>
Create a rotation matrix from an angle around an arbitrary axis.
Trait Implementations§
source§impl<S: BaseFloat> From<Matrix3<S>> for Quaternion<S>
impl<S: BaseFloat> From<Matrix3<S>> for Quaternion<S>
source§fn from(mat: Matrix3<S>) -> Quaternion<S>
fn from(mat: Matrix3<S>) -> Quaternion<S>
Convert the matrix to a quaternion
source§impl<S: BaseFloat> From<Quaternion<S>> for Matrix3<S>
impl<S: BaseFloat> From<Quaternion<S>> for Matrix3<S>
source§fn from(quat: Quaternion<S>) -> Matrix3<S>
fn from(quat: Quaternion<S>) -> Matrix3<S>
Convert the quaternion to a 3 x 3 rotation matrix
source§impl<S: BaseFloat> Matrix for Matrix3<S>
impl<S: BaseFloat> Matrix for Matrix3<S>
source§impl<S: PartialEq> PartialEq<Matrix3<S>> for Matrix3<S>
impl<S: PartialEq> PartialEq<Matrix3<S>> for Matrix3<S>
source§impl<S: BaseFloat> SquareMatrix for Matrix3<S>
impl<S: BaseFloat> SquareMatrix for Matrix3<S>
source§fn from_value(value: S) -> Matrix3<S>
fn from_value(value: S) -> Matrix3<S>
Create a new diagonal matrix using the supplied value.
source§fn from_diagonal(value: Vector3<S>) -> Matrix3<S>
fn from_diagonal(value: Vector3<S>) -> Matrix3<S>
Create a matrix from a non-uniform scale
source§fn identity() -> Matrix3<S>
fn identity() -> Matrix3<S>
The identity matrix. Multiplying this
matrix with another has no effect.
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<Matrix3<S>>
fn invert(&self) -> Option<Matrix3<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 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.
source§fn is_identity(&self) -> bool
fn is_identity(&self) -> bool
Test if this matrix is the identity matrix. That is, it is diagonal
and every element in the diagonal is one.
impl<S: Copy> Copy for Matrix3<S>
impl<S> StructuralPartialEq for Matrix3<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Matrix3<S>where S: RefUnwindSafe,
impl<S> Send for Matrix3<S>where S: Send,
impl<S> Sync for Matrix3<S>where S: Sync,
impl<S> Unpin for Matrix3<S>where S: Unpin,
impl<S> UnwindSafe for Matrix3<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