DTransform3

Struct DTransform3 

Source
#[repr(C)]
pub struct DTransform3 { pub translation: DVec3, pub rotation: DQuat, pub scale: DVec3, }

Fields§

§translation: DVec3§rotation: DQuat§scale: DVec3

Implementations§

Source§

impl DTransform3

Source

pub const ZERO: Self

The degenerate zero transform.

This transforms any finite vector and point to zero. The zero transform is non-invertible.

Source

pub const IDENTITY: Self

The identity transform.

Multiplying a vector with this returns the same vector.

Source

pub const NAN: Self

All NAN:s.

Source

pub fn new(translation: DVec3, rotation: DQuat, scale: DVec3) -> Self

Creates a new transform.

Source

pub fn from_scale(scale: DVec3) -> Self

Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.

Source

pub fn from_quat(rotation: DQuat) -> Self

Creates a transform transform from the given rotation quaternion.

Source

pub fn from_axis_angle(axis: DVec3, angle: f64) -> Self

Creates a transform transform containing a 3D rotation around a normalized rotation axis of angle (in radians).

Source

pub fn from_rotation_x(angle: f64) -> Self

Creates a transform transform containing a 3D rotation around the x axis of angle (in radians).

Source

pub fn from_rotation_y(angle: f64) -> Self

Creates a transform transform containing a 3D rotation around the y axis of angle (in radians).

Source

pub fn from_rotation_z(angle: f64) -> Self

Creates a transform transform containing a 3D rotation around the z axis of angle (in radians).

Source

pub fn from_translation(translation: DVec3) -> Self

Creates a transform transformation from the given 3D translation.

Source

pub fn from_rotation_translation(rotation: DQuat, translation: DVec3) -> Self

Creates a transform from the given 3D rotation and translation.

Source

pub fn from_scale_rotation_translation( scale: DVec3, rotation: DQuat, translation: DVec3, ) -> Self

Creates a transform from the given 3D scale, rotation and translation.

Source

pub fn from_mat3(mat3: DMat3) -> Self

Creates a transform from a 3x3 matrix (expressing scale and rotation)

Note if the input matrix is non-uniform or shear, the result transform will be ill-defined.

Source

pub fn from_mat3_translation(mat3: DMat3, translation: DVec3) -> Self

Creates a transform from a 3x3 matrix (expressing scale and rotation)

Note if the input matrix is non-uniform or shear, the result transform will be ill-defined.

Source

pub fn from_mat4(mat4: DMat4) -> Self

Creates a transform from a 4x4 matrix.

Note if the input matrix is non-uniform or shear, the result transform will be ill-defined.

Source

pub fn to_scale_rotation_translation(&self) -> (DVec3, DQuat, DVec3)

Extracts scale, rotation and translation from self.

Source

pub fn transform_point3(&self, rhs: DVec3) -> DVec3

Transforms the given 3D points, applying scale, rotation and translation.

Source

pub fn transform_vector3(&self, rhs: DVec3) -> DVec3

Transforms the given 3D vector, applying scale and rotation (but NOT translation).

Source

pub fn is_finite(&self) -> bool

Returns true if, and only if, all elements are finite.

If any element is either NaN, positive or negative infinity, this will return false.

Source

pub fn is_nan(&self) -> bool

Returns true if any elements are NaN.

Source

pub fn abs_diff_eq(self, rhs: Self, max_abs_diff: f64) -> bool

Returns true if the absolute difference of all elements between self and rhs is less than or equal to max_abs_diff.

Source

pub fn inverse(&self) -> Self

Return the inverse of this transform.

Note that if the transform is not invertible the result will be invalid.

Trait Implementations§

Source§

impl AbsDiffEq for DTransform3

Available on crate feature approx only.
Source§

type Epsilon = <f64 as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl Clone for DTransform3

Source§

fn clone(&self) -> DTransform3

Returns a duplicate 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 DTransform3

Source§

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

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

impl Default for DTransform3

Source§

fn default() -> DTransform3

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

impl From<DTransform3> for DAffine3

Source§

fn from(t: DTransform3) -> DAffine3

Converts to this type from the input type.
Source§

impl From<DTransform3> for DMat4

Source§

fn from(t: DTransform3) -> DMat4

Converts to this type from the input type.
Source§

impl Mul<DMat4> for DTransform3

Source§

type Output = DMat4

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<DTransform3> for DMat4

Source§

type Output = DMat4

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for DTransform3

Source§

type Output = DTransform3

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign for DTransform3

Source§

fn mul_assign(&mut self, rhs: DTransform3)

Performs the *= operation. Read more
Source§

impl PartialEq for DTransform3

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RelativeEq for DTransform3

Available on crate feature approx only.
Source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl UlpsEq for DTransform3

Available on crate feature approx only.
Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
Source§

impl Copy for DTransform3

Source§

impl StructuralPartialEq for DTransform3

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.