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>where
S: BaseFloat,
impl<S> Matrix4<S>where
S: BaseFloat,
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_dir(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S>
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_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
center
, using up
for orientation.
sourcepub fn from_angle_x<A>(theta: A) -> Matrix4<S>where
A: Into<Rad<S>>,
pub fn from_angle_x<A>(theta: A) -> Matrix4<S>where
A: Into<Rad<S>>,
Create a homogeneous transformation matrix from a rotation around the x
axis (pitch).
sourcepub fn from_angle_y<A>(theta: A) -> Matrix4<S>where
A: Into<Rad<S>>,
pub fn from_angle_y<A>(theta: A) -> Matrix4<S>where
A: Into<Rad<S>>,
Create a homogeneous transformation matrix from a rotation around the y
axis (yaw).
sourcepub fn from_angle_z<A>(theta: A) -> Matrix4<S>where
A: Into<Rad<S>>,
pub fn from_angle_z<A>(theta: A) -> Matrix4<S>where
A: Into<Rad<S>>,
Create a homogeneous transformation matrix from a rotation around the z
axis (roll).
Trait Implementations§
source§impl<S> AddAssign<Matrix4<S>> for Matrix4<S>where
S: BaseFloat + AddAssign<S>,
impl<S> AddAssign<Matrix4<S>> for Matrix4<S>where
S: BaseFloat + AddAssign<S>,
source§fn add_assign(&mut self, other: Matrix4<S>)
fn add_assign(&mut self, other: Matrix4<S>)
+=
operation. Read moresource§impl<S> ApproxEq for Matrix4<S>where
S: BaseFloat,
impl<S> ApproxEq for Matrix4<S>where
S: BaseFloat,
source§fn default_epsilon() -> <S as ApproxEq>::Epsilon
fn default_epsilon() -> <S as ApproxEq>::Epsilon
source§fn default_max_relative() -> <S as ApproxEq>::Epsilon
fn default_max_relative() -> <S as ApproxEq>::Epsilon
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
source§fn relative_eq(
&self,
other: &Matrix4<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_relative: <S as ApproxEq>::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Matrix4<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_relative: <S as ApproxEq>::Epsilon
) -> bool
source§fn ulps_eq(
&self,
other: &Matrix4<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
fn ulps_eq(
&self,
other: &Matrix4<S>,
epsilon: <S as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
§fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
ApproxEq::relative_eq
.source§impl<'de, S> Deserialize<'de> for Matrix4<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Matrix4<S>where
S: Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Matrix4<S>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Matrix4<S>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<S> DivAssign<S> for Matrix4<S>where
S: BaseFloat + DivAssign<S>,
impl<S> DivAssign<S> for Matrix4<S>where
S: BaseFloat + DivAssign<S>,
source§fn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
/=
operation. Read moresource§impl<S, R> From<Decomposed<Vector3<S>, R>> for Matrix4<S>where
S: BaseFloat,
R: Rotation3<S>,
impl<S, R> From<Decomposed<Vector3<S>, R>> for Matrix4<S>where
S: BaseFloat,
R: Rotation3<S>,
source§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> 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 Into<UniformVariable> for Matrix4<f32>
impl Into<UniformVariable> for Matrix4<f32>
source§fn into(self) -> UniformVariable
fn into(self) -> UniformVariable
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>where
S: BaseFloat + MulAssign<S>,
impl<S> MulAssign<S> for Matrix4<S>where
S: BaseFloat + MulAssign<S>,
source§fn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
*=
operation. Read moresource§impl<S> PartialEq<Matrix4<S>> for Matrix4<S>where
S: PartialEq<S>,
impl<S> PartialEq<Matrix4<S>> for Matrix4<S>where
S: PartialEq<S>,
source§impl<S> RemAssign<S> for Matrix4<S>where
S: BaseFloat + RemAssign<S>,
impl<S> RemAssign<S> for Matrix4<S>where
S: BaseFloat + RemAssign<S>,
source§fn rem_assign(&mut self, scalar: S)
fn rem_assign(&mut self, scalar: S)
%=
operation. Read moresource§impl<S> Serialize for Matrix4<S>where
S: Serialize,
impl<S> Serialize for Matrix4<S>where
S: Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§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). Read moresource§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> SubAssign<Matrix4<S>> for Matrix4<S>where
S: BaseFloat + SubAssign<S>,
impl<S> SubAssign<Matrix4<S>> for Matrix4<S>where
S: BaseFloat + SubAssign<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 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. Read moresource§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)
impl<S> Copy for Matrix4<S>where
S: Copy,
impl<S> StructuralPartialEq for Matrix4<S>
impl<S> Transform3<S> for Matrix4<S>where
S: BaseFloat,
Auto Trait Implementations§
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§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more