SpatialVector

Struct SpatialVector 

Source
pub struct SpatialVector<T = ()> {
    pub top: Vec3,
    pub bottom: Vec3,
    /* private fields */
}
Expand description

A 6D spatial vector representing either motion or force.

Fields§

§top: Vec3

The top (angular) component of the spatial vector.

  • For motion vectors: angular velocity ω
  • For force vectors: moment/torque n
§bottom: Vec3

The bottom (linear) component of the spatial vector.

  • For motion vectors: linear velocity v
  • For force vectors: force f

Implementations§

Source§

impl<T> SpatialVector<T>

Source

pub const ZERO: Self

Zero spatial vector (both angular and linear components are zero).

This is useful for initialization and as the identity element for vector addition operations.

Source

pub const fn from_array(array: [Real; 6]) -> Self

Create a spatial vector from a 6-element array.

§Array Format
  • Motion vectors: [ωx, ωy, ωz, vx, vy, vz] where ω is angular velocity and v is linear velocity
  • Force vectors: [nx, ny, nz, fx, fy, fz] where n is moment/torque and f is force
§Example
use spatial_math::SpatialMotionVector;

let velocity = SpatialMotionVector::from_array([1.0, 0.0, 0.0, 0.0, 1.0, 0.0]);
// ω = [1, 0, 0], v = [0, 1, 0]
Source

pub fn from_vec6(vec: SVector<6>) -> Self

Create a spatial vector from a 6D static vector.

This is useful when converting from other linear algebra representations that use SVector<6>.

Source

pub const fn from_pair(top: Vec3, bottom: Vec3) -> Self

Create a spatial vector from separate 3D top and bottom components.

This is often used when you have separate angular and linear quantities that need to be combined into a spatial vector.

§Arguments
  • top - The angular component (ω for motion, n for force)
  • bottom - The linear component (v for motion, f for force)
Source

pub fn into_array(self) -> [Real; 6]

Convert the spatial vector to a 6-element array.

Returns the components in the same format as expected by from_array(): [top.x, top.y, top.z, bottom.x, bottom.y, bottom.z]

Source

pub fn any_nan(&self) -> bool

Source

pub fn add(&self, rhs: &Self) -> Self

Source

pub fn sub(&self, rhs: &Self) -> Self

Source

pub fn neg(&self) -> Self

Source

pub fn scale(&self, scalar: Real) -> Self

Source

pub fn cross(&self, rhs: &Self) -> Self

Source

pub fn into_vec6(self) -> SVector<6>

Trait Implementations§

Source§

impl<T> Add for SpatialVector<T>

Source§

type Output = SpatialVector<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> AddAssign for SpatialVector<T>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for SpatialVector<T>

Source§

fn clone(&self) -> SpatialVector<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for SpatialVector<T>

Source§

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

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

impl<T: Default> Default for SpatialVector<T>

Source§

fn default() -> SpatialVector<T>

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

impl<T> Display for SpatialVector<T>

Source§

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

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

impl<T> From<SpatialVector<T>> for Vec6

Source§

fn from(v: SpatialVector<T>) -> Self

Converts to this type from the input type.
Source§

impl Mul<SpatialVector<Force>> for PluckerTransform

Source§

type Output = SpatialVector<Force>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpatialForceVector) -> SpatialForceVector

Performs the * operation. Read more
Source§

impl Mul<SpatialVector<Motion>> for &ArticulatedBodyInertia

Source§

type Output = SpatialVector<Force>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpatialMotionVector) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SpatialVector<Motion>> for ArticulatedBodyInertia

Source§

type Output = SpatialVector<Force>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpatialMotionVector) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SpatialVector<Motion>> for PluckerTransform

Source§

type Output = SpatialVector<Motion>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpatialMotionVector) -> SpatialMotionVector

Performs the * operation. Read more
Source§

impl Mul<SpatialVector<Motion>> for RigidBodyInertia

Source§

type Output = SpatialVector<Force>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpatialMotionVector) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<f32> for SpatialVector<T>

Source§

type Output = SpatialVector<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Real) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Neg for SpatialVector<T>

Source§

type Output = SpatialVector<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T: PartialEq> PartialEq for SpatialVector<T>

Source§

fn eq(&self, other: &SpatialVector<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Sub for SpatialVector<T>

Source§

type Output = SpatialVector<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> SubAssign for SpatialVector<T>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<T: Copy> Copy for SpatialVector<T>

Source§

impl<T> StructuralPartialEq for SpatialVector<T>

Auto Trait Implementations§

§

impl<T> Freeze for SpatialVector<T>

§

impl<T> RefUnwindSafe for SpatialVector<T>
where T: RefUnwindSafe,

§

impl<T> Send for SpatialVector<T>
where T: Send,

§

impl<T> Sync for SpatialVector<T>
where T: Sync,

§

impl<T> Unpin for SpatialVector<T>
where T: Unpin,

§

impl<T> UnwindSafe for SpatialVector<T>
where T: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,