Struct ark_api::IsoTransform
source · pub struct IsoTransform { /* private fields */ }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.
Implementations§
source§impl IsoTransform
impl IsoTransform
sourcepub const IDENTITY: IsoTransform = Self{ rotation: Quat::IDENTITY, translation: Vec3A::ZERO,}
pub const IDENTITY: IsoTransform = Self{ rotation: Quat::IDENTITY, translation: Vec3A::ZERO,}
The identity transform: doesn’t transform at all. Like multiplying with 1.
sourcepub fn from_rotation_translation(
rotation: Quat,
translation: Vec3
) -> IsoTransform
pub fn from_rotation_translation( rotation: Quat, translation: Vec3 ) -> IsoTransform
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) -> IsoTransform
pub fn from_rotation_around_point(rotation: Quat, point: Vec3) -> IsoTransform
A rotation around a given point
sourcepub fn from_quat(rotation: Quat) -> IsoTransform
pub fn from_quat(rotation: Quat) -> IsoTransform
A pure rotation without any translation.
The given rotation should be normalized.
sourcepub fn from_translation(translation: Vec3) -> IsoTransform
pub fn from_translation(translation: Vec3) -> IsoTransform
A pure translation without any rotation.
sourcepub fn from_mat4(t: &Mat4) -> Option<IsoTransform>
pub fn from_mat4(t: &Mat4) -> Option<IsoTransform>
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<IsoTransform>
pub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<IsoTransform>
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) -> IsoTransform
pub fn inverse(&self) -> IsoTransform
Get the transform that undoes this transform so that t.inverse() * t == IDENTITY.
sourcepub fn normalize(&self) -> IsoTransform
pub fn normalize(&self) -> IsoTransform
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
impl Default for IsoTransform
Identity transform
source§fn default() -> IsoTransform
fn default() -> IsoTransform
Identity transform
source§impl<'de> Deserialize<'de> for IsoTransform
impl<'de> Deserialize<'de> for IsoTransform
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<IsoTransform, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<IsoTransform, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl From<IsoTransform> for Affine3A
impl From<IsoTransform> for Affine3A
source§fn from(iso: IsoTransform) -> Affine3A
fn from(iso: IsoTransform) -> Affine3A
source§impl From<IsoTransform> for Conformal3
impl From<IsoTransform> for Conformal3
source§fn from(c: IsoTransform) -> Conformal3
fn from(c: IsoTransform) -> Conformal3
source§impl From<IsoTransform> for Mat4
impl From<IsoTransform> for Mat4
source§fn from(t: IsoTransform) -> Mat4
fn from(t: IsoTransform) -> Mat4
source§impl Mul<&IsoTransform> for &IsoTransform
impl Mul<&IsoTransform> for &IsoTransform
iso * iso -> iso
§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<Affine3A> for IsoTransform
impl Mul<Affine3A> for IsoTransform
iso * affine3a -> affine3a
source§impl Mul<Conformal3> for IsoTransform
impl Mul<Conformal3> for IsoTransform
§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
impl Mul<IsoTransform> for &IsoTransform
iso * iso -> iso
§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
impl Mul<IsoTransform> for Affine3A
affine3a * iso -> affine3a
source§impl Mul<IsoTransform> for Conformal3
impl Mul<IsoTransform> for Conformal3
§type Output = Conformal3
type Output = Conformal3
* operator.source§fn mul(self, rhs: IsoTransform) -> Conformal3
fn mul(self, rhs: IsoTransform) -> Conformal3
* operation. Read moresource§impl Mul<IsoTransform> for IsoTransform
impl Mul<IsoTransform> for IsoTransform
iso * iso -> iso
§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 Mat4
impl Mul<IsoTransform> for Mat4
iso * mat4 -> mat4
source§impl Mul<Mat4> for IsoTransform
impl Mul<Mat4> for IsoTransform
mat4 * iso -> mat4
source§impl Mul<Ray3> for IsoTransform
impl Mul<Ray3> for IsoTransform
source§impl PartialEq<IsoTransform> for IsoTransform
impl PartialEq<IsoTransform> for IsoTransform
source§fn eq(&self, other: &IsoTransform) -> bool
fn eq(&self, other: &IsoTransform) -> bool
self and other values to be equal, and is used
by ==.