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

source

pub const fn new(col1: DVec3x4, col2: DVec3x4, col3: DVec3x4) -> Self

source

pub fn from_translation(trans: DVec2x4) -> Self

Assumes homogeneous 2d coordinates.

source

pub fn from_scale_homogeneous(scale: f64x4) -> Self

Assumes homogeneous 2d coordinates.

source

pub fn from_nonuniform_scale_homogeneous(scale: DVec2x4) -> Self

Assumes homogeneous 2d coordinates.

source

pub fn from_rotation_homogeneous(angle: f64x4) -> Self

Builds a homogeneous 2d rotation matrix (in the xy plane) from a given angle in radians.

source

pub fn from_scale(scale: f64x4) -> Self

source

pub fn from_nonuniform_scale(scale: DVec3x4) -> Self

source

pub fn identity() -> Self

source

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”)
source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn into_homogeneous(self) -> DMat4x4

source

pub fn determinant(&self) -> f64x4

source

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.

source

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.

source

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.

source

pub fn transpose(&mut self)

source

pub fn transposed(&self) -> Self

source

pub fn transform_vec2(&self, vec: DVec2x4) -> DVec2x4

Transform a Vec2 by self, interpreting it as a vector.

source

pub fn transform_point2(&self, point: DVec2x4) -> DVec2x4

Transform a Vec2 by self, interpreting it as a point.

source

pub fn layout() -> Layout

Get the core::alloc::Layout of Self

source

pub fn as_array(&self) -> &[f64x4; 9]

Interpret self as a statically sized array of the base numeric type.

source

pub fn as_mut_array(&mut self) -> &mut [f64x4; 9]

Interpret self as a statically sized array of the base numeric type.

source

pub fn as_component_array(&self) -> &[DVec3x4; 3]

Interpret self as a statically sized array of the component (column) vectors.

source

pub fn as_mut_component_array(&mut self) -> &mut [DVec3x4; 3]

Interpret self as a statically sized array of the component (column) vectors.

source

pub fn as_slice(&self) -> &[f64x4]

Interpret self as a slice of the base numeric type.

source

pub fn as_component_slice(&self) -> &[DVec3x4]

Interpret self as a slice of the component (column) vectors.

source

pub fn as_byte_slice(&self) -> &[u8]

Interpret self as a slice of bytes.

source

pub fn as_mut_slice(&mut self) -> &mut [f64x4]

Interpret self as a slice of the base numeric type.

source

pub fn as_mut_component_slice(&mut self) -> &mut [DVec3x4]

Interpret self as a slice of the component (column) vectors.

source

pub fn as_mut_byte_slice(&mut self) -> &mut [u8]

Interpret self as a slice of bytes.

source

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.

source

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

source

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 Add<DMat3x4> for DMat3x4

§

type Output = DMat3x4

The resulting type after applying the + operator.
source§

fn add(self, rhs: DMat3x4) -> Self

Performs the + operation. Read more
source§

impl AddAssign<DMat3x4> for DMat3x4

source§

fn add_assign(&mut self, rhs: DMat3x4)

Performs the += operation. Read more
source§

impl Clone for DMat3x4

source§

fn clone(&self) -> DMat3x4

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DMat3x4

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DMat3x4

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<&[f64x4; 9]> for DMat3x4

source§

fn from(comps: &[f64x4; 9]) -> Self

Converts to this type from the input type.
source§

impl From<[[f64x4; 3]; 3]> for DMat3x4

source§

fn from(comps: [[f64x4; 3]; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[f64x4; 9]> for DMat3x4

source§

fn from(comps: [f64x4; 9]) -> Self

Converts to this type from the input type.
source§

impl From<DMat3x4> for [[f64x4; 3]; 3]

source§

fn from(mat3: DMat3x4) -> Self

Converts to this type from the input type.
source§

impl From<DRotor3x4> for DMat3x4

source§

fn from(rotor: DRotor3x4) -> DMat3x4

Converts to this type from the input type.
source§

impl Index<usize> for DMat3x4

§

type Output = DVec3x4

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for DMat3x4

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Mul<DMat3x4> for DMat3x4

§

type Output = DMat3x4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl Mul<DMat3x4> for f64x4

§

type Output = DMat3x4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: DMat3x4) -> DMat3x4

Performs the * operation. Read more
source§

impl Mul<DVec3x4> for DMat3x4

§

type Output = DVec3x4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: DVec3x4) -> DVec3x4

Performs the * operation. Read more
source§

impl Mul<f64x4> for DMat3x4

§

type Output = DMat3x4

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f64x4) -> DMat3x4

Performs the * operation. Read more
source§

impl PartialEq<DMat3x4> for DMat3x4

source§

fn eq(&self, other: &DMat3x4) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for DMat3x4

source§

impl StructuralPartialEq for DMat3x4

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.