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
impl IsoTransform
Sourcepub const IDENTITY: Self
pub const IDENTITY: Self
The identity transform: doesn’t transform at all. Like multiplying with 1
.
Sourcepub fn from_rotation_translation(rotation: Quat, translation: Vec3) -> Self
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.
Sourcepub fn from_rotation_around_point(rotation: Quat, point: Vec3) -> Self
pub fn from_rotation_around_point(rotation: Quat, point: Vec3) -> Self
A rotation around a given point
Sourcepub fn from_quat(rotation: Quat) -> Self
pub fn from_quat(rotation: Quat) -> Self
A pure rotation without any translation.
The given rotation should be normalized.
Sourcepub fn from_translation(translation: Vec3) -> Self
pub fn from_translation(translation: Vec3) -> Self
A pure translation without any rotation.
Sourcepub fn from_mat4(t: &Mat4) -> Option<Self>
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.
Sourcepub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<Self>
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.
pub fn rotation(&self) -> Quat
pub fn set_rotation(&mut self, rotation: Quat)
pub fn translation(&self) -> Vec3
pub fn set_translation(&mut self, translation: Vec3)
Sourcepub fn inverse(&self) -> Self
pub fn inverse(&self) -> Self
Get the transform that undoes this transform so that t.inverse() * t == IDENTITY
.
Sourcepub fn normalize(&self) -> Self
pub fn normalize(&self) -> Self
Returns self normalized.
You generally don’t need to call this unless you’ve multiplied A LOT of IsoTransforms
.
Sourcepub fn transform_point3(&self, p: Vec3) -> Vec3
pub fn transform_point3(&self, p: Vec3) -> Vec3
Rotate and translate a point.
Sourcepub fn transform_vector3(&self, v: Vec3) -> Vec3
pub fn transform_vector3(&self, v: Vec3) -> Vec3
Rotate a vector.
Trait Implementations§
Source§impl Clone for IsoTransform
impl Clone for IsoTransform
Source§fn clone(&self) -> IsoTransform
fn clone(&self) -> IsoTransform
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for IsoTransform
impl Debug for IsoTransform
Source§impl Default for IsoTransform
Identity transform
impl Default for IsoTransform
Identity transform
Source§impl From<IsoTransform> for Affine3A
impl From<IsoTransform> for Affine3A
Source§fn from(iso: IsoTransform) -> Self
fn from(iso: IsoTransform) -> Self
Source§impl From<IsoTransform> for Conformal3
impl From<IsoTransform> for Conformal3
Source§fn from(c: IsoTransform) -> Self
fn from(c: IsoTransform) -> Self
Source§impl From<IsoTransform> for Mat4
impl From<IsoTransform> for Mat4
Source§fn from(t: IsoTransform) -> Self
fn from(t: IsoTransform) -> Self
Source§impl Mul<Affine3A> for IsoTransform
iso * affine3a -> affine3a
impl Mul<Affine3A> for IsoTransform
iso * affine3a -> affine3a
Source§impl Mul<Conformal3> for IsoTransform
impl Mul<Conformal3> for IsoTransform
Source§type Output = Conformal3
type Output = Conformal3
*
operator.Source§fn mul(self, rhs: Conformal3) -> Conformal3
fn mul(self, rhs: Conformal3) -> Conformal3
*
operation. Read moreSource§impl Mul<IsoTransform> for &IsoTransform
iso * iso -> iso
impl Mul<IsoTransform> for &IsoTransform
iso * iso -> iso
Source§type Output = IsoTransform
type Output = IsoTransform
*
operator.Source§fn mul(self, rhs: IsoTransform) -> IsoTransform
fn mul(self, rhs: IsoTransform) -> IsoTransform
*
operation. Read moreSource§impl Mul<IsoTransform> for Affine3A
affine3a * iso -> affine3a
impl Mul<IsoTransform> for Affine3A
affine3a * iso -> affine3a
Source§impl Mul<IsoTransform> for Conformal3
impl Mul<IsoTransform> for Conformal3
Source§type Output = Conformal3
type Output = Conformal3
*
operator.Source§fn mul(self, rhs: IsoTransform) -> Self
fn mul(self, rhs: IsoTransform) -> Self
*
operation. Read moreSource§impl Mul<IsoTransform> for Mat4
iso * mat4 -> mat4
impl Mul<IsoTransform> for Mat4
iso * mat4 -> mat4
Source§impl Mul<Mat4> for IsoTransform
mat4 * iso -> mat4
impl Mul<Mat4> for IsoTransform
mat4 * iso -> mat4
Source§impl Mul<Ray3> for IsoTransform
impl Mul<Ray3> for IsoTransform
Source§impl Mul for &IsoTransform
iso * iso -> iso
impl Mul for &IsoTransform
iso * iso -> iso
Source§type Output = IsoTransform
type Output = IsoTransform
*
operator.Source§fn mul(self, rhs: &IsoTransform) -> IsoTransform
fn mul(self, rhs: &IsoTransform) -> IsoTransform
*
operation. Read moreSource§impl Mul for IsoTransform
iso * iso -> iso
impl Mul for IsoTransform
iso * iso -> iso