Skip to main content

Twist

Struct Twist 

Source
#[repr(C)]
pub struct Twist { pub omega: Vec3, pub v: Vec3, }
Expand description

A body-frame (right) twist: angular velocity ω (rad/s) and linear velocity v (m/s), both expressed in the moving frame.

See the module docs for the convention and why it is load-bearing. 48 bytes, repr(C), no interior padding — so it is Pod and a &[Twist] can be handed to a C ABI as [ωx ωy ωz vx vy vz] pairs without a copy.

Fields§

§omega: Vec3

Angular velocity, body frame, rad/s.

§v: Vec3

Linear velocity, body frame, m/s.

Implementations§

Source§

impl Twist

Source

pub const ZERO: Twist

The zero twist — a stationary body.

Source

pub const fn new(omega: Vec3, v: Vec3) -> Twist

Construct from angular and linear parts.

Source

pub const fn from_se3(xi: [f64; 6]) -> Twist

Reinterpret an [ω, v] twist array — the ordering log_se3 returns.

Source

pub const fn to_se3(self) -> [f64; 6]

The [ω, v] array — the ordering exp_se3 consumes.

Source

pub const fn scale(self, k: f64) -> Twist

Scale both parts. Used to turn a per-unit-s screw twist into a per-second one: ξ / Δt.

Source

pub const fn add(self, rhs: Twist) -> Twist

Component-wise sum — the + V_bc^c of the composition identity.

Source

pub const fn sub(self, rhs: Twist) -> Twist

Component-wise difference.

Source

pub const fn neg(self) -> Twist

Negate both parts.

Source

pub fn to_spatial(&self, t: &Iso3) -> Twist

The spatial (left) twist of the same motion: Ad(T)·V^b.

t is the pose the body twist was taken at — normally the pose returned alongside it. Getting this argument wrong produces a valid-looking twist in the wrong frame, which is the failure mode this method exists to make explicit rather than to let a caller open-code.

Source

pub fn amax(self) -> f64

Largest absolute component, for tolerance comparisons in tests.

Trait Implementations§

Source§

impl Clone for Twist

Source§

fn clone(&self) -> Twist

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 Twist

Source§

impl Debug for Twist

Source§

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

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

impl PartialEq for Twist

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Pod for Twist

Source§

impl StructuralPartialEq for Twist

Source§

impl Zeroable for Twist

Source§

fn zeroed() -> Self

Auto Trait Implementations§

§

impl Freeze for Twist

§

impl RefUnwindSafe for Twist

§

impl Send for Twist

§

impl Sync for Twist

§

impl Unpin for Twist

§

impl UnsafeUnpin for Twist

§

impl UnwindSafe for Twist

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> AnyBitPattern for T
where T: Pod,

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> NoUninit for T
where T: Pod,

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 = !

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.