Skip to main content

SpatialTransformExt

Trait SpatialTransformExt 

Source
pub trait SpatialTransformExt {
    // Required methods
    fn body_to_world_point(&self, p: Vec3) -> Vec3;
    fn world_to_body_point(&self, p: Vec3) -> Vec3;
    fn body_to_world_dir(&self, d: Vec3) -> Vec3;
    fn world_to_body_dir(&self, d: Vec3) -> Vec3;
}
Expand description

Direction-carrying frame conversions for SpatialTransform.

The convention, stated once and authoritatively: in a body transform produced by forward kinematics, rot is the world→body rotation (Featherstone’s E) and pos is the body origin in world coordinates. So mapping a body-frame vector out to world requires rot.transpose(), and mapping a world-frame vector into the body frame requires rot.

Every call site that writes xf.rot * v or xf.rot.transpose() * v by hand must independently remember which direction rot points — and a mistake is invisible at identity, only inverting once the body tilts. These methods exist so no call site ever writes that arithmetic by hand again: the method name carries the direction, and the point/dir split carries whether the translation applies.

  • *_point methods transform positions (rotation and translation).
  • *_dir methods transform directions — axes, forces, velocities, offsets — with rotation only.

Required Methods§

Source

fn body_to_world_point(&self, p: Vec3) -> Vec3

Map a point in body coordinates to world coordinates: pos + rot.transpose() * p.

Source

fn world_to_body_point(&self, p: Vec3) -> Vec3

Map a point in world coordinates to body coordinates: rot * (p - pos).

Source

fn body_to_world_dir(&self, d: Vec3) -> Vec3

Rotate a direction (axis, force, velocity, offset) from body to world: rot.transpose() * d. No translation.

Source

fn world_to_body_dir(&self, d: Vec3) -> Vec3

Rotate a direction (axis, force, velocity, offset) from world to body: rot * d. No translation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§