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
impl Pose
Sourcepub const IDENTITY: Pose
pub const IDENTITY: Pose
At the origin, unrotated. What a domain has until something places it.
Sourcepub fn new(translation: LengthVec, rotation: DQuat) -> Pose
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.
Sourcepub fn translation(&self) -> LengthVec
pub fn translation(&self) -> LengthVec
Where the local origin sits in the world.
Sourcepub fn point_to_world(&self, local: LengthVec) -> LengthVec
pub fn point_to_world(&self, local: LengthVec) -> LengthVec
A point in local coordinates, in the world.
Sourcepub fn point_to_local(&self, world: LengthVec) -> LengthVec
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.
Sourcepub fn direction_to_world(&self, local: DVec3) -> DVec3
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.
Sourcepub fn direction_to_local(&self, world: DVec3) -> DVec3
pub fn direction_to_local(&self, world: DVec3) -> DVec3
A direction in world coordinates, in the local frame.
Sourcepub fn then(&self, outer: Pose) -> Pose
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.
Sourcepub fn is_identity(&self, tol: f64) -> bool
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.