Struct IsoTransform

Source
pub struct IsoTransform {
    pub rotation: Quat,
    pub translation: Vec3A,
}
Expand description

An isometric transform represented by translation * rotation.

An isometric transform conserves distances and angles.

The operations are applied right-to-left, so when transforming a point it will first be rotated and finally translated.

Fields§

§rotation: Quat

Normalized

§translation: Vec3A

Final translation. This is where the input origin will end up, so for many circumstances this can be thought of as the position.

Implementations§

Source§

impl IsoTransform

Source

pub const IDENTITY: Self

The identity transform: doesn’t transform at all. Like multiplying with 1.

Source

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

A transform that first rotates around the origin and then moves all points by a set amount.

Equivalent to IsoTransform::from_translation(translation) * IsoTransform::from_quat(rotation).

The given rotation should be normalized.

Source

pub fn from_rotation_around_point(rotation: Quat, point: Vec3) -> Self

A rotation around a given point

Source

pub fn from_quat(rotation: Quat) -> Self

A pure rotation without any translation.

The given rotation should be normalized.

Source

pub fn from_translation(translation: Vec3) -> Self

A pure translation without any rotation.

Source

pub fn from_mat4(t: &Mat4) -> Option<Self>

Tries to convert a 4x4 matrix to a IsoTransform.

This may return None as a Mat4 can represent things that a IsoTransform cannot, such as scale, shearing and projection.

§Panics

Will panic if the determinant of t is zero and the assert feature is enabled.

Source

pub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<Self>

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

The result transforms from world coordinates to view coordinates.

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

Will return None if any argument is zero, non-finite, or if forward and up are colinear.

Source

pub fn rotation(&self) -> Quat

Source

pub fn set_rotation(&mut self, rotation: Quat)

Source

pub fn translation(&self) -> Vec3

Source

pub fn set_translation(&mut self, translation: Vec3)

Source

pub fn is_finite(&self) -> bool

True if every value is finite

Source

pub fn is_nan(&self) -> bool

Returns true if any elements are NaN.

Source

pub fn to_mat4(self) -> Mat4

Convert to an equivalent Mat4 transformation matrix.

Source

pub fn inverse(&self) -> Self

Get the transform that undoes this transform so that t.inverse() * t == IDENTITY.

Source

pub fn normalize(&self) -> Self

Returns self normalized. You generally don’t need to call this unless you’ve multiplied A LOT of IsoTransforms.

Source

pub fn transform_point3(&self, p: Vec3) -> Vec3

Rotate and translate a point.

Source

pub fn transform_vector3(&self, v: Vec3) -> Vec3

Rotate a vector.

Trait Implementations§

Source§

impl Clone for IsoTransform

Source§

fn clone(&self) -> IsoTransform

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 IsoTransform

Source§

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

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

impl Default for IsoTransform

Identity transform

Source§

fn default() -> Self

Identity transform

Source§

impl From<IsoTransform> for Affine3A

Source§

fn from(iso: IsoTransform) -> Self

Converts to this type from the input type.
Source§

impl From<IsoTransform> for Conformal3

Source§

fn from(c: IsoTransform) -> Self

Converts to this type from the input type.
Source§

impl From<IsoTransform> for Mat4

Source§

fn from(t: IsoTransform) -> Self

Converts to this type from the input type.
Source§

impl Mul<Affine3A> for IsoTransform

iso * affine3a -> affine3a

Source§

type Output = Affine3A

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Conformal3> for IsoTransform

Source§

type Output = Conformal3

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<IsoTransform> for &IsoTransform

iso * iso -> iso

Source§

type Output = IsoTransform

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<IsoTransform> for Affine3A

affine3a * iso -> affine3a

Source§

type Output = Affine3A

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<IsoTransform> for Conformal3

Source§

type Output = Conformal3

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<IsoTransform> for Mat4

iso * mat4 -> mat4

Source§

type Output = Mat4

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Mat4> for IsoTransform

mat4 * iso -> mat4

Source§

type Output = Mat4

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Ray3> for IsoTransform

Source§

type Output = Ray3

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for &IsoTransform

iso * iso -> iso

Source§

type Output = IsoTransform

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &IsoTransform) -> IsoTransform

Performs the * operation. Read more
Source§

impl Mul for IsoTransform

iso * iso -> iso

Source§

type Output = IsoTransform

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl PartialEq for IsoTransform

Source§

fn eq(&self, other: &IsoTransform) -> 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 Copy for IsoTransform

Source§

impl StructuralPartialEq for IsoTransform

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.