Struct glam::f32::Affine3A[][src]

pub struct Affine3A {
    pub matrix3: Mat3A,
    pub translation: Vec3A,
}
Expand description

A 3D affine transform, which can represent translation, rotation, scaling and shear.

The type is composed of a 3x3 matrix containing a linear transformation (e.g. scale, rotation, shear, reflection) and a 3D vector translation.

Fields

matrix3: Mat3Atranslation: Vec3A

Implementations

impl Affine3A[src]

pub const ZERO: Self[src]

The degenerate zero transform.

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

pub const IDENTITY: Self[src]

The identity transform.

Multiplying a vector with this returns the same vector.

pub fn from_scale(scale: Vec3) -> Self[src]

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

pub fn from_quat(rotation: Quat) -> Self[src]

Creates an affine transform from the given rotation quaternion.

pub fn from_axis_angle(axis: Vec3, angle: f32) -> Self[src]

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

pub fn from_rotation_x(angle: f32) -> Self[src]

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

pub fn from_rotation_y(angle: f32) -> Self[src]

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

pub fn from_rotation_z(angle: f32) -> Self[src]

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

pub fn from_translation(translation: Vec3) -> Self[src]

Creates an affine transformation from the given 3D translation.

pub fn from_mat3(mat3: Mat3) -> Self[src]

Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)

pub fn from_mat3_translation(mat3: Mat3, translation: Vec3) -> Self[src]

Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a translation vector.

Equivalent to Affine3::from_translation(translation) * Affine3::from_mat3(mat3)

pub fn from_scale_rotation_translation(
    scale: Vec3,
    rotation: Quat,
    translation: Vec3
) -> Self
[src]

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

Equivalent to Affine3::from_translation(translation) * Affine3::from_quat(rotation) * Affine3::from_scale(scale)

pub fn from_rotation_translation(rotation: Quat, translation: Vec3) -> Self[src]

Creates an affine transform from the given 3D rotation and translation.

Equivalent to Affine3::from_translation(translation) * Affine3::from_quat(rotation)

pub fn from_mat4(m: Mat4) -> Self[src]

The given Mat4 must be an affine transform, i.e. contain no perspective transform.

pub fn to_scale_rotation_translation(&self) -> (Vec3, Quat, Vec3)[src]

Extracts scale, rotation and translation from self.

The transform is expected to be non-degenerate and without shearing, or the output will be invalid.

pub fn look_at_lh(eye: Vec3, center: Vec3, up: Vec3) -> Self[src]

Creates a left-handed view transform using a camera position, an up direction, and a focal point.

For a view coordinate system with +X=right, +Y=up and +Z=forward.

pub fn look_at_rh(eye: Vec3, center: Vec3, up: Vec3) -> Self[src]

Creates a right-handed view transform using a camera position, an up direction, and a focal point.

For a view coordinate system with +X=right, +Y=up and +Z=back.

pub fn transform_point3(&self, other: Vec3) -> Vec3[src]

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

pub fn transform_vector3(&self, other: Vec3) -> Vec3[src]

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

To also apply translation, use Self::transform_point3 instead.

pub fn is_finite(&self) -> bool[src]

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

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

pub fn is_nan(&self) -> bool[src]

Returns true if any elements are NaN.

pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool[src]

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

This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. The max_abs_diff that should be used used depends on the values being compared against.

For more see comparing floating point numbers.

pub fn inverse(&self) -> Self[src]

Return the inverse of this transform.

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

impl Affine3A[src]

pub fn transform_point3a(&self, other: Vec3A) -> Vec3A[src]

Transforms the given Vec3A, applying shear, scale, rotation and translation.

pub fn transform_vector3a(&self, other: Vec3A) -> Vec3A[src]

Transforms the given Vec3A, applying shear, scale and rotation (but NOT translation).

To also apply translation, use Self::transform_point3 instead.

Trait Implementations

impl Clone for Affine3A[src]

fn clone(&self) -> Affine3A[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Affine3A[src]

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

Formats the value using the given formatter. Read more

impl Default for Affine3A[src]

fn default() -> Self[src]

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

impl Deref for Affine3A[src]

type Target = Columns4<Vec3A>

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl DerefMut for Affine3A[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl From<Affine3A> for Mat4[src]

fn from(m: Affine3A) -> Mat4[src]

Performs the conversion.

impl Mul<Affine3A> for Affine3A[src]

type Output = Affine3A

The resulting type after applying the * operator.

fn mul(self, other: Affine3A) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<Affine3A> for Mat4[src]

type Output = Mat4

The resulting type after applying the * operator.

fn mul(self, rhs: Affine3A) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<Mat4> for Affine3A[src]

type Output = Mat4

The resulting type after applying the * operator.

fn mul(self, rhs: Mat4) -> Self::Output[src]

Performs the * operation. Read more

impl PartialEq<Affine3A> for Affine3A[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> Product<&'a Affine3A> for Affine3A[src]

fn product<I>(iter: I) -> Self where
    I: Iterator<Item = &'a Self>, 
[src]

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

impl Copy for Affine3A[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.