#[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: BaseFloat> Matrix4<S>
impl<S: BaseFloat> Matrix4<S>
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: 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> AbsDiffEq<Matrix4<S>> for Matrix4<S>
impl<S: BaseFloat> AbsDiffEq<Matrix4<S>> for Matrix4<S>
source§fn default_epsilon() -> S::Epsilon
fn default_epsilon() -> S::Epsilon
source§fn abs_diff_eq(&self, other: &Self, epsilon: S::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: S::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: 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 + 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::Unitless>where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
impl<A> From<Euler<A>> for Matrix4<A::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> RelativeEq<Matrix4<S>> for Matrix4<S>
impl<S: BaseFloat> RelativeEq<Matrix4<S>> for Matrix4<S>
source§fn default_max_relative() -> S::Epsilon
fn default_max_relative() -> S::Epsilon
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 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: 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_identity(&self) -> boolwhere
Self: UlpsEq,
fn is_identity(&self) -> boolwhere Self: UlpsEq,
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 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.