#[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> Matrix4<S>
impl<S> Matrix4<S>
Source§impl<S> Matrix4<S>where
S: BaseFloat,
impl<S> Matrix4<S>where
S: BaseFloat,
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_dir(
eye: Point3<S>,
dir: Vector3<S>,
up: Vector3<S>,
) -> Matrix4<S>
👎Deprecated: Use Matrix4::look_to_rh
pub fn look_at_dir( eye: Point3<S>, dir: Vector3<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 look_to_rh(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S>
pub fn look_to_rh(eye: Point3<S>, dir: Vector3<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 look_to_lh(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S>
pub fn look_to_lh(eye: Point3<S>, dir: Vector3<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 look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
👎Deprecated: Use Matrix4::look_at_rh
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
center
, using up
for orientation.
Sourcepub fn look_at_rh(
eye: Point3<S>,
center: Point3<S>,
up: Vector3<S>,
) -> Matrix4<S>
pub fn look_at_rh( eye: Point3<S>, center: Point3<S>, up: Vector3<S>, ) -> Matrix4<S>
Create a homogeneous transformation matrix that will cause a vector to point at
center
, using up
for orientation.
Sourcepub fn look_at_lh(
eye: Point3<S>,
center: Point3<S>,
up: Vector3<S>,
) -> Matrix4<S>
pub fn look_at_lh( eye: Point3<S>, center: Point3<S>, up: Vector3<S>, ) -> Matrix4<S>
Create a homogeneous transformation matrix that will cause a vector to point at
center
, using up
for orientation.
Sourcepub fn from_angle_x<A>(theta: A) -> Matrix4<S>
pub fn from_angle_x<A>(theta: A) -> Matrix4<S>
Create a homogeneous transformation matrix from a rotation around the x
axis (pitch).
Sourcepub fn from_angle_y<A>(theta: A) -> Matrix4<S>
pub fn from_angle_y<A>(theta: A) -> Matrix4<S>
Create a homogeneous transformation matrix from a rotation around the y
axis (yaw).
Sourcepub fn from_angle_z<A>(theta: A) -> Matrix4<S>
pub fn from_angle_z<A>(theta: A) -> Matrix4<S>
Create a homogeneous transformation matrix from a rotation around the z
axis (roll).
Sourcepub fn from_axis_angle<A>(axis: Vector3<S>, angle: A) -> Matrix4<S>
pub fn from_axis_angle<A>(axis: Vector3<S>, angle: A) -> Matrix4<S>
Create a homogeneous transformation matrix from an angle around an arbitrary axis.
The specified axis must be normalized, or it represents an invalid rotation.
Trait Implementations§
Source§impl<S> AbsDiffEq for Matrix4<S>where
S: BaseFloat,
impl<S> AbsDiffEq for Matrix4<S>where
S: BaseFloat,
Source§fn default_epsilon() -> <S as AbsDiffEq>::Epsilon
fn default_epsilon() -> <S as AbsDiffEq>::Epsilon
Source§fn abs_diff_eq(
&self,
other: &Matrix4<S>,
epsilon: <S as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_eq( &self, other: &Matrix4<S>, epsilon: <S as AbsDiffEq>::Epsilon, ) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
.Source§impl<S> AddAssign for Matrix4<S>
impl<S> AddAssign 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> DivAssign<S> for Matrix4<S>
impl<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<S> From<Perspective<S>> for Matrix4<S>where
S: BaseFloat,
impl<S> From<Perspective<S>> for Matrix4<S>where
S: BaseFloat,
Source§fn from(persp: Perspective<S>) -> Matrix4<S>
fn from(persp: Perspective<S>) -> Matrix4<S>
Source§impl<S> From<PerspectiveFov<S>> for Matrix4<S>where
S: BaseFloat,
impl<S> From<PerspectiveFov<S>> for Matrix4<S>where
S: BaseFloat,
Source§fn from(persp: PerspectiveFov<S>) -> Matrix4<S>
fn from(persp: PerspectiveFov<S>) -> Matrix4<S>
Source§impl<S> From<Quaternion<S>> for Matrix4<S>where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Matrix4<S>where
S: BaseFloat,
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> Matrix for Matrix4<S>where
S: BaseFloat,
impl<S> Matrix for Matrix4<S>where
S: BaseFloat,
Source§impl<S> MulAssign<S> for Matrix4<S>
impl<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> RelativeEq for Matrix4<S>where
S: BaseFloat,
impl<S> RelativeEq for Matrix4<S>where
S: BaseFloat,
Source§fn default_max_relative() -> <S as AbsDiffEq>::Epsilon
fn default_max_relative() -> <S as AbsDiffEq>::Epsilon
Source§fn relative_eq(
&self,
other: &Matrix4<S>,
epsilon: <S as AbsDiffEq>::Epsilon,
max_relative: <S as AbsDiffEq>::Epsilon,
) -> bool
fn relative_eq( &self, other: &Matrix4<S>, epsilon: <S as AbsDiffEq>::Epsilon, max_relative: <S as AbsDiffEq>::Epsilon, ) -> bool
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
RelativeEq::relative_eq
.Source§impl<S> RemAssign<S> for Matrix4<S>
impl<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> SquareMatrix for Matrix4<S>where
S: BaseFloat,
impl<S> SquareMatrix for Matrix4<S>where
S: BaseFloat,
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_identity(&self) -> boolwhere
Self: UlpsEq,
fn is_identity(&self) -> boolwhere
Self: UlpsEq,
Source§impl<S> SubAssign for Matrix4<S>
impl<S> SubAssign 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> Transform<Point3<S>> for Matrix4<S>where
S: BaseFloat,
impl<S> Transform<Point3<S>> for Matrix4<S>where
S: BaseFloat,
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.Source§fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
center
from
eye
, using up
for orientation.Source§fn look_at_rh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
fn look_at_rh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>
center
from
eye
, using up
for orientation.