Skip to main content

Pose

Struct Pose 

Source
pub struct Pose { /* private fields */ }
Expand description

A rotation and a translation: where a domain’s own coordinates sit in the world.

Cheap to copy. Composition is then and reads left to right.

Implementations§

Source§

impl Pose

Source

pub const IDENTITY: Pose

At the origin, unrotated. What a domain has until something places it.

Source

pub fn new(translation: LengthVec, rotation: DQuat) -> Pose

A rotation and a translation.

The rotation is normalised on the way in. A quaternion accumulated by repeated multiplication drifts off the unit sphere, and an unnormalised one stretches space — which is exactly the thing this type exists not to do.

Source

pub fn at(translation: LengthVec) -> Pose

Moved, not turned.

Source

pub fn turned(rotation: DQuat) -> Pose

Turned, not moved.

Source

pub fn translation(&self) -> LengthVec

Where the local origin sits in the world.

Source

pub fn rotation(&self) -> DQuat

How the local axes are turned. Always a unit quaternion.

Source

pub fn point_to_world(&self, local: LengthVec) -> LengthVec

A point in local coordinates, in the world.

Source

pub fn point_to_local(&self, world: LengthVec) -> LengthVec

A point in world coordinates, in the local frame.

The exact inverse of point_to_world up to rounding — a rigid motion has an exact inverse, unlike anything that scales.

Source

pub fn direction_to_world(&self, local: DVec3) -> DVec3

A direction in local coordinates, in the world.

Rotated and not translated, which is the whole difference between a direction and a point. A surface normal moved by a translation would stop being normal to anything.

Source

pub fn direction_to_local(&self, world: DVec3) -> DVec3

A direction in world coordinates, in the local frame.

Source

pub fn then(&self, outer: Pose) -> Pose

This pose, then outer: the result of placing something by self inside a frame that is itself placed by outer.

Reads left to right, so a.then(b).then(c) applies a first. Associative, and a test says so — matrix composition order is the classic place a sign or an order gets lost, and it is silent when it does.

Source

pub fn inverse(&self) -> Pose

The pose that undoes this one.

Source

pub fn is_identity(&self, tol: f64) -> bool

Whether this pose moves anything, within a tolerance.

For a caller that can take a fast path when nothing is placed — sampling a field through an identity pose should cost nothing.

Trait Implementations§

Source§

impl Clone for Pose

Source§

fn clone(&self) -> Pose

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Pose

Source§

impl Debug for Pose

Source§

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

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

impl Default for Pose

Source§

fn default() -> Pose

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

impl PartialEq for Pose

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Pose

Auto Trait Implementations§

§

impl Freeze for Pose

§

impl RefUnwindSafe for Pose

§

impl Send for Pose

§

impl Sync for Pose

§

impl Unpin for Pose

§

impl UnsafeUnpin for Pose

§

impl UnwindSafe for Pose

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.