#[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.source§fn transform_vector(&self, vec: Vector3<S>) -> Vector3<S>
fn transform_vector(&self, vec: Vector3<S>) -> Vector3<S>
source§fn transform_point(&self, point: Point3<S>) -> Point3<S>
fn transform_point(&self, point: Point3<S>) -> Point3<S>
source§fn concat(&self, other: &Matrix4<S>) -> Matrix4<S>
fn concat(&self, other: &Matrix4<S>) -> Matrix4<S>
source§fn inverse_transform(&self) -> Option<Matrix4<S>>
fn inverse_transform(&self) -> Option<Matrix4<S>>
source§fn inverse_transform_vector(
&self,
vec: <P as EuclideanSpace>::Diff,
) -> Option<<P as EuclideanSpace>::Diff>
fn inverse_transform_vector( &self, vec: <P as EuclideanSpace>::Diff, ) -> Option<<P as EuclideanSpace>::Diff>
source§fn concat_self(&mut self, other: &Self)
fn concat_self(&mut self, other: &Self)
source§impl<S> UlpsEq for Matrix4<S>where
S: BaseFloat,
impl<S> UlpsEq for Matrix4<S>where
S: BaseFloat,
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
source§impl<S> VectorSpace for Matrix4<S>where
S: BaseFloat,
impl<S> VectorSpace for Matrix4<S>where
S: BaseFloat,
impl<S> Copy for Matrix4<S>where
S: Copy,
impl<S> StructuralPartialEq for Matrix4<S>
Auto Trait Implementations§
impl<S> Freeze for Matrix4<S>where
S: Freeze,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)