Struct ultraviolet::mat::Mat3x4
source · [−]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: [Vec3x4; 3]
Implementations
sourceimpl Mat3x4
impl Mat3x4
pub const fn new(col1: Vec3x4, col2: Vec3x4, col3: Vec3x4) -> Self
sourcepub fn from_translation(trans: Vec2x4) -> Self
pub fn from_translation(trans: Vec2x4) -> Self
Assumes homogeneous 2d coordinates.
sourcepub fn from_scale_homogeneous(scale: f32x4) -> Self
pub fn from_scale_homogeneous(scale: f32x4) -> Self
Assumes homogeneous 2d coordinates.
sourcepub fn from_nonuniform_scale_homogeneous(scale: Vec2x4) -> Self
pub fn from_nonuniform_scale_homogeneous(scale: Vec2x4) -> Self
Assumes homogeneous 2d coordinates.
sourcepub fn from_rotation_homogeneous(angle: f32x4) -> Self
pub fn from_rotation_homogeneous(angle: f32x4) -> Self
Builds a homogeneous 2d rotation matrix (in the xy plane) from a given angle in radians.
pub fn from_scale(scale: f32x4) -> Self
pub fn from_nonuniform_scale(scale: Vec3x4) -> Self
pub fn identity() -> Self
sourcepub fn from_euler_angles(roll: f32x4, pitch: f32x4, yaw: f32x4) -> Self
pub fn from_euler_angles(roll: f32x4, pitch: f32x4, yaw: f32x4) -> 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”)
Important: This function assumes a right-handed, y-up coordinate space where:
- +X axis points right
- +Y axis points up
- +Z axis points towards the viewer (i.e. out of the screen)
This means that you may see unexpected behavior when used with OpenGL or DirectX
as they use a different coordinate system. You should use the appropriate
projection matrix in projection
module to fit your use case to remedy this.
sourcepub fn from_rotation_x(angle: f32x4) -> Self
pub fn from_rotation_x(angle: f32x4) -> 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.
Important: This function assumes a right-handed, y-up coordinate space where:
- +X axis points right
- +Y axis points up
- +Z axis points towards the viewer (i.e. out of the screen)
This means that you may see unexpected behavior when used with OpenGL or DirectX
as they use a different coordinate system. You should use the appropriate
projection matrix in projection
module to fit your use case to remedy this.
sourcepub fn from_rotation_y(angle: f32x4) -> Self
pub fn from_rotation_y(angle: f32x4) -> 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.
Important: This function assumes a right-handed, y-up coordinate space where:
- +X axis points right
- +Y axis points up
- +Z axis points towards the viewer (i.e. out of the screen)
This means that you may see unexpected behavior when used with OpenGL or DirectX
as they use a different coordinate system. You should use the appropriate
projection matrix in projection
module to fit your use case to remedy this.
sourcepub fn from_rotation_z(angle: f32x4) -> Self
pub fn from_rotation_z(angle: f32x4) -> 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.
Important: This function assumes a right-handed, y-up coordinate space where:
- +X axis points right
- +Y axis points up
- +Z axis points towards the viewer (i.e. out of the screen)
This means that you may see unexpected behavior when used with OpenGL or DirectX
as they use a different coordinate system. You should use the appropriate
projection matrix in projection
module to fit your use case to remedy this.
sourcepub fn from_rotation_around(axis: Vec3x4, angle: f32x4) -> Self
pub fn from_rotation_around(axis: Vec3x4, angle: f32x4) -> 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.
Important: This function assumes a right-handed, y-up coordinate space where:
- +X axis points right
- +Y axis points up
- +Z axis points towards the viewer (i.e. out of the screen)
This means that you may see unexpected behavior when used with OpenGL or DirectX
as they use a different coordinate system. You should use the appropriate
projection matrix in projection
module to fit your use case to remedy this.
sourcepub fn from_angle_plane(angle: f32x4, plane: Bivec3x4) -> Self
pub fn from_angle_plane(angle: f32x4, plane: Bivec3x4) -> 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) -> Mat4x4
pub fn determinant(&self) -> f32x4
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: Vec2x4) -> Vec2x4
pub fn transform_vec2(&self, vec: Vec2x4) -> Vec2x4
Transform a Vec2 by self, interpreting it as a vector.
sourcepub fn transform_point2(&self, point: Vec2x4) -> Vec2x4
pub fn transform_point2(&self, point: Vec2x4) -> Vec2x4
Transform a Vec2 by self, interpreting it as a point.
pub fn layout() -> Layout
pub fn as_array(&self) -> &[f32x4; 9]
pub fn as_component_array(&self) -> &[Vec3x4; 3]
pub fn as_slice(&self) -> &[f32x4]
pub fn as_component_slice(&self) -> &[Vec3x4]
pub fn as_byte_slice(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn as_mut_slice(&mut self) -> &mut [f32x4]
pub fn as_mut_component_slice(&mut self) -> &mut [Vec3x4]
pub fn as_mut_byte_slice(&mut self) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
sourcepub const fn as_ptr(&self) -> *const f32x4
pub const fn as_ptr(&self) -> *const f32x4
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 f32x4
pub fn as_mut_ptr(&mut self) -> *mut f32x4
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.
sourceimpl Mat3x4
impl Mat3x4
sourcepub fn into_rotor3(self) -> Rotor3x4
pub fn into_rotor3(self) -> Rotor3x4
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
sourceimpl AddAssign<Mat3x4> for Mat3x4
impl AddAssign<Mat3x4> for Mat3x4
sourcefn add_assign(&mut self, rhs: Mat3x4)
fn add_assign(&mut self, rhs: Mat3x4)
Performs the +=
operation. Read more
impl Copy for Mat3x4
impl StructuralPartialEq for Mat3x4
Auto Trait Implementations
impl RefUnwindSafe for Mat3x4
impl Send for Mat3x4
impl Sync for Mat3x4
impl Unpin for Mat3x4
impl UnwindSafe for Mat3x4
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more