#[repr(C)]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
This type is marked as #[repr(C)]
.
Fields§
§x: Vector4<S>
The first column of the matrix.
y: Vector4<S>
The second column of the matrix.
z: Vector4<S>
The third column of the matrix.
w: Vector4<S>
The fourth column of the matrix.
Implementations§
source§impl<S: BaseFloat> Matrix4<S>
impl<S: BaseFloat> Matrix4<S>
sourcepub fn new(
c0r0: S,
c0r1: S,
c0r2: S,
c0r3: S,
c1r0: S,
c1r1: S,
c1r2: S,
c1r3: S,
c2r0: S,
c2r1: S,
c2r2: S,
c2r3: S,
c3r0: S,
c3r1: S,
c3r2: S,
c3r3: S
) -> Matrix4<S>
pub fn new( c0r0: S, c0r1: S, c0r2: S, c0r3: S, c1r0: S, c1r1: S, c1r2: S, c1r3: S, c2r0: S, c2r1: S, c2r2: S, c2r3: S, c3r0: S, c3r1: S, c3r2: S, c3r3: S ) -> Matrix4<S>
Create a new matrix, providing values for each index.
sourcepub fn from_cols(
c0: Vector4<S>,
c1: Vector4<S>,
c2: Vector4<S>,
c3: Vector4<S>
) -> Matrix4<S>
pub fn from_cols( c0: Vector4<S>, c1: Vector4<S>, c2: Vector4<S>, c3: Vector4<S> ) -> Matrix4<S>
Create a new matrix, providing columns.
sourcepub fn from_translation(v: Vector3<S>) -> Matrix4<S>
pub fn from_translation(v: Vector3<S>) -> Matrix4<S>
Create a homogeneous transformation matrix from a translation vector.
sourcepub fn from_scale(value: S) -> Matrix4<S>
pub fn from_scale(value: S) -> Matrix4<S>
Create a homogeneous transformation matrix from a scale value.
sourcepub fn from_nonuniform_scale(x: S, y: S, z: S) -> Matrix4<S>
pub fn from_nonuniform_scale(x: S, y: S, z: S) -> Matrix4<S>
Create a homogeneous transformation matrix from a set of scale values.
sourcepub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
pub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
Create a homogeneous transformation matrix that will cause a vector to point at
dir
, using up
for orientation.
sourcepub fn from_angle_x<A: Into<Rad<S>>>(theta: A) -> Matrix4<S>
pub fn from_angle_x<A: Into<Rad<S>>>(theta: A) -> Matrix4<S>
Create a homogeneous transformation matrix from a rotation around the x
axis (pitch).
sourcepub fn from_angle_y<A: Into<Rad<S>>>(theta: A) -> Matrix4<S>
pub fn from_angle_y<A: Into<Rad<S>>>(theta: A) -> Matrix4<S>
Create a homogeneous transformation matrix from a rotation around the y
axis (yaw).
sourcepub fn from_angle_z<A: Into<Rad<S>>>(theta: A) -> Matrix4<S>
pub fn from_angle_z<A: Into<Rad<S>>>(theta: A) -> Matrix4<S>
Create a homogeneous transformation matrix from a rotation around the z
axis (roll).
Trait Implementations§
source§impl<S: BaseFloat + AddAssign<S>> AddAssign<Matrix4<S>> for Matrix4<S>
impl<S: BaseFloat + AddAssign<S>> AddAssign<Matrix4<S>> for Matrix4<S>
source§fn add_assign(&mut self, other: Matrix4<S>)
fn add_assign(&mut self, other: Matrix4<S>)
+=
operation. Read moresource§impl<S: BaseFloat> ApproxEq for Matrix4<S>
impl<S: BaseFloat> ApproxEq for Matrix4<S>
source§fn default_epsilon() -> S::Epsilon
fn default_epsilon() -> S::Epsilon
source§fn default_max_relative() -> S::Epsilon
fn default_max_relative() -> S::Epsilon
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
source§fn relative_eq(
&self,
other: &Self,
epsilon: S::Epsilon,
max_relative: S::Epsilon
) -> bool
fn relative_eq( &self, other: &Self, epsilon: S::Epsilon, max_relative: S::Epsilon ) -> bool
source§fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool
fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool
source§impl<S: BaseFloat + DivAssign<S>> DivAssign<S> for Matrix4<S>
impl<S: BaseFloat + DivAssign<S>> DivAssign<S> for Matrix4<S>
source§fn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
/=
operation. Read moresource§impl<A> From<Euler<A>> for Matrix4<<A as Angle>::Unitless>where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
impl<A> From<Euler<A>> for Matrix4<<A as Angle>::Unitless>where A: Angle + Into<Rad<<A as Angle>::Unitless>>,
source§impl<S: BaseFloat> From<Perspective<S>> for Matrix4<S>
impl<S: BaseFloat> From<Perspective<S>> for Matrix4<S>
source§fn from(persp: Perspective<S>) -> Matrix4<S>
fn from(persp: Perspective<S>) -> Matrix4<S>
source§impl<S: BaseFloat> From<PerspectiveFov<S>> for Matrix4<S>
impl<S: BaseFloat> From<PerspectiveFov<S>> for Matrix4<S>
source§fn from(persp: PerspectiveFov<S>) -> Matrix4<S>
fn from(persp: PerspectiveFov<S>) -> Matrix4<S>
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§impl<S: BaseFloat + MulAssign<S>> MulAssign<S> for Matrix4<S>
impl<S: BaseFloat + MulAssign<S>> MulAssign<S> for Matrix4<S>
source§fn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
*=
operation. Read moresource§impl<S: PartialEq> PartialEq<Matrix4<S>> for Matrix4<S>
impl<S: PartialEq> PartialEq<Matrix4<S>> for Matrix4<S>
source§impl<S: BaseFloat + RemAssign<S>> RemAssign<S> for Matrix4<S>
impl<S: BaseFloat + RemAssign<S>> RemAssign<S> for Matrix4<S>
source§fn rem_assign(&mut self, scalar: S)
fn rem_assign(&mut self, scalar: S)
%=
operation. Read moresource§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>
source§fn from_diagonal(value: Vector4<S>) -> Matrix4<S>
fn from_diagonal(value: Vector4<S>) -> Matrix4<S>
source§fn transpose_self(&mut self)
fn transpose_self(&mut self)
source§fn determinant(&self) -> S
fn determinant(&self) -> S
source§fn invert(&self) -> Option<Matrix4<S>>
fn invert(&self) -> Option<Matrix4<S>>
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
source§fn is_symmetric(&self) -> bool
fn is_symmetric(&self) -> bool
source§fn identity() -> Self
fn identity() -> Self
source§fn trace(&self) -> Self::Scalar
fn trace(&self) -> Self::Scalar
source§fn is_invertible(&self) -> bool
fn is_invertible(&self) -> bool
source§fn is_identity(&self) -> bool
fn is_identity(&self) -> bool
source§impl<S: BaseFloat + SubAssign<S>> SubAssign<Matrix4<S>> for Matrix4<S>
impl<S: BaseFloat + SubAssign<S>> SubAssign<Matrix4<S>> for Matrix4<S>
source§fn sub_assign(&mut self, other: Matrix4<S>)
fn sub_assign(&mut self, other: Matrix4<S>)
-=
operation. Read moresource§impl<S: BaseFloat> Transform<Point3<S>> for Matrix4<S>
impl<S: BaseFloat> Transform<Point3<S>> for Matrix4<S>
source§fn one() -> Matrix4<S>
fn one() -> Matrix4<S>
source§fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
center
from
eye
, using up
for orientation.