Struct ultraviolet::mat::DMat3x4
source · #[repr(C)]pub struct DMat3x4 {
pub cols: [DVec3x4; 3],
}
Expand description
A 3x3 square matrix.
Useful for performing linear transformations (rotation, scaling) on 3d vectors, or for performing arbitrary transformations (linear + translation, projection, etc) on homogeneous 2d vectors
Fields§
§cols: [DVec3x4; 3]
Implementations§
source§impl DMat3x4
impl DMat3x4
pub const fn new(col1: DVec3x4, col2: DVec3x4, col3: DVec3x4) -> Self
sourcepub fn from_translation(trans: DVec2x4) -> Self
pub fn from_translation(trans: DVec2x4) -> Self
Assumes homogeneous 2d coordinates.
sourcepub fn from_scale_homogeneous(scale: f64x4) -> Self
pub fn from_scale_homogeneous(scale: f64x4) -> Self
Assumes homogeneous 2d coordinates.
sourcepub fn from_nonuniform_scale_homogeneous(scale: DVec2x4) -> Self
pub fn from_nonuniform_scale_homogeneous(scale: DVec2x4) -> Self
Assumes homogeneous 2d coordinates.
sourcepub fn from_rotation_homogeneous(angle: f64x4) -> Self
pub fn from_rotation_homogeneous(angle: f64x4) -> Self
Builds a homogeneous 2d rotation matrix (in the xy plane) from a given angle in radians.
pub fn from_scale(scale: f64x4) -> Self
pub fn from_nonuniform_scale(scale: DVec3x4) -> Self
pub fn identity() -> Self
sourcepub fn from_euler_angles(roll: f64x4, pitch: f64x4, yaw: f64x4) -> Self
pub fn from_euler_angles(roll: f64x4, pitch: f64x4, yaw: f64x4) -> Self
Angles are applied in the order roll -> pitch -> yaw.
- Yaw is rotation inside the xz plane (“around the y axis”)
- Pitch is rotation inside the yz plane (“around the x axis”)
- Roll is rotation inside the xy plane (“around the z axis”)
sourcepub fn from_rotation_x(angle: f64x4) -> Self
pub fn from_rotation_x(angle: f64x4) -> Self
Create a new rotation matrix from a rotation “around the x axis”. This is here as a convenience function for users coming from other libraries; it is more proper to think of this as a rotation in the yz plane.
sourcepub fn from_rotation_y(angle: f64x4) -> Self
pub fn from_rotation_y(angle: f64x4) -> Self
Create a new rotation matrix from a rotation “around the y axis”. This is here as a convenience function for users coming from other libraries; it is more proper to think of this as a rotation in the xz plane.
sourcepub fn from_rotation_z(angle: f64x4) -> Self
pub fn from_rotation_z(angle: f64x4) -> Self
Create a new rotation matrix from a rotation “around the z axis”. This is here as a convenience function for users coming from other libraries; it is more proper to think of this as a rotation in the xy plane.
sourcepub fn from_rotation_around(axis: DVec3x4, angle: f64x4) -> Self
pub fn from_rotation_around(axis: DVec3x4, angle: f64x4) -> Self
Create a new rotation matrix from a rotation around the given axis. This is here as a convenience function for users coming from other libraries.
sourcepub fn from_angle_plane(angle: f64x4, plane: DBivec3x4) -> Self
pub fn from_angle_plane(angle: f64x4, plane: DBivec3x4) -> Self
Construct a rotation matrix given a bivector which defines a plane and rotation orientation, and a rotation angle.
plane
must be normalized!
This is the equivalent of an axis-angle rotation.
pub fn into_homogeneous(self) -> DMat4x4
pub fn determinant(&self) -> f64x4
sourcepub fn adjugate(&self) -> Self
pub fn adjugate(&self) -> Self
The adjugate of this matrix, i.e. the transpose of the cofactor matrix.
This is equivalent to the inverse but without dividing by the determinant of the matrix, which can be useful in some contexts for better performance.
One such case is when this matrix is interpreted as a a homogeneous transformation matrix, in which case uniform scaling will not affect the resulting projected 3d version of transformed points or vectors.
sourcepub fn inverse(&mut self)
pub fn inverse(&mut self)
If this matrix is not currently invertable, this function will return an invalid inverse. This status is not checked by the library.
sourcepub fn inversed(&self) -> Self
pub fn inversed(&self) -> Self
If this matrix is not currently invertable, this function will return an invalid inverse. This status is not checked by the library.
pub fn transpose(&mut self)
pub fn transposed(&self) -> Self
sourcepub fn transform_vec2(&self, vec: DVec2x4) -> DVec2x4
pub fn transform_vec2(&self, vec: DVec2x4) -> DVec2x4
Transform a Vec2 by self, interpreting it as a vector.
sourcepub fn transform_point2(&self, point: DVec2x4) -> DVec2x4
pub fn transform_point2(&self, point: DVec2x4) -> DVec2x4
Transform a Vec2 by self, interpreting it as a point.
sourcepub fn layout() -> Layout
pub fn layout() -> Layout
Get the core::alloc::Layout
of Self
sourcepub fn as_array(&self) -> &[f64x4; 9]
pub fn as_array(&self) -> &[f64x4; 9]
Interpret self
as a statically sized array of the base numeric type.
sourcepub fn as_mut_array(&mut self) -> &mut [f64x4; 9]
pub fn as_mut_array(&mut self) -> &mut [f64x4; 9]
Interpret self
as a statically sized array of the base numeric type.
sourcepub fn as_component_array(&self) -> &[DVec3x4; 3]
pub fn as_component_array(&self) -> &[DVec3x4; 3]
Interpret self
as a statically sized array of the component (column) vectors.
sourcepub fn as_mut_component_array(&mut self) -> &mut [DVec3x4; 3]
pub fn as_mut_component_array(&mut self) -> &mut [DVec3x4; 3]
Interpret self
as a statically sized array of the component (column) vectors.
sourcepub fn as_component_slice(&self) -> &[DVec3x4]
pub fn as_component_slice(&self) -> &[DVec3x4]
Interpret self
as a slice of the component (column) vectors.
sourcepub fn as_byte_slice(&self) -> &[u8] ⓘ
pub fn as_byte_slice(&self) -> &[u8] ⓘ
Interpret self
as a slice of bytes.
sourcepub fn as_mut_slice(&mut self) -> &mut [f64x4]
pub fn as_mut_slice(&mut self) -> &mut [f64x4]
Interpret self
as a slice of the base numeric type.
sourcepub fn as_mut_component_slice(&mut self) -> &mut [DVec3x4]
pub fn as_mut_component_slice(&mut self) -> &mut [DVec3x4]
Interpret self
as a slice of the component (column) vectors.
sourcepub fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
Interpret self
as a slice of bytes.
sourcepub const fn as_ptr(&self) -> *const f64x4
pub const fn as_ptr(&self) -> *const f64x4
Returns a constant unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
Safety
It is up to the caller to correctly use this pointer and its bounds.
sourcepub fn as_mut_ptr(&mut self) -> *mut f64x4
pub fn as_mut_ptr(&mut self) -> *mut f64x4
Returns a mutable unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
Safety
It is up to the caller to correctly use this pointer and its bounds.
source§impl DMat3x4
impl DMat3x4
sourcepub fn into_rotor3(self) -> DRotor3x4
pub fn into_rotor3(self) -> DRotor3x4
If self
is a rotation matrix, return a Rotor3
representing the same rotation.
If self
is not a rotation matrix, the returned value is a Rotor3
with undefied
properties. The fact that self
is a rotation matrix is not checked by the
library.
Trait Implementations§
source§impl AddAssign<DMat3x4> for DMat3x4
impl AddAssign<DMat3x4> for DMat3x4
source§fn add_assign(&mut self, rhs: DMat3x4)
fn add_assign(&mut self, rhs: DMat3x4)
+=
operation. Read more