Velocity

Struct Velocity 

Source
pub struct Velocity<L, A> { /* private fields */ }
Expand description

Velocity

§Type parameters:

  • L: Linear velocity, usually Vector2 or Vector3
  • A: Angular velocity, usually Scalar or Vector3

Implementations§

Source§

impl<L, A> Velocity<L, A>
where L: Zero, A: Clone + Zero,

Source

pub fn new(linear: L, angular: A) -> Self

Create new velocity object, with both linear and angular velocity

Source

pub fn from_linear(linear: L) -> Self

Create new velocity object with only linear velocity

Source

pub fn set_linear(&mut self, linear: L)

Set linear velocity

Source

pub fn linear(&self) -> &L

Get linear velocity

Source

pub fn set_angular(&mut self, angular: A)

Set angular velocity

Source

pub fn angular(&self) -> &A

Get angular velocity

Source

pub fn apply<P, R>( &self, pose: &BodyPose<P, R>, dt: L::Scalar, ) -> BodyPose<P, R>
where P: EuclideanSpace<Scalar = L::Scalar, Diff = L>, L: VectorSpace, L::Scalar: BaseFloat, R: ApplyAngular<L::Scalar, A> + Rotation<P>,

Apply velocity to pose.

§Parameters:
  • pose: Pose to apply the velocity to
  • dt: Time step
§Type parameters:
  • P: Positional quantity, usually Point2 or Point3
  • R: Rotational quantity, usually Basis2 or Quaternion
Source

pub fn apply_linear<P>(&self, linear: &P, dt: L::Scalar) -> P
where P: EuclideanSpace<Scalar = L::Scalar, Diff = L>, L::Scalar: BaseFloat, L: VectorSpace,

Apply linear velocity to a positional quantity

§Parameters:
  • linear: Positional value
  • dt: Time step
§Type parameters:
  • P: Positional quantity, usually Point2 or Point3
Source

pub fn apply_angular<R>(&self, rotation: &R, dt: L::Scalar) -> R
where R: ApplyAngular<L::Scalar, A>, L: VectorSpace, L::Scalar: BaseFloat,

Apply angular velocity to a rotational quantity

§Parameters:
  • rotation: Rotational value
  • dt: Time step
§Type parameters:
  • R: Rotational quantity, usually Basis2 or Quaternion

Trait Implementations§

Source§

impl<L: Clone, A: Clone> Clone for Velocity<L, A>

Source§

fn clone(&self) -> Velocity<L, A>

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<L: Debug, A: Debug> Debug for Velocity<L, A>

Source§

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

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

impl<L, A> Default for Velocity<L, A>
where L: Zero, A: Clone + Zero,

Source§

fn default() -> Self

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

impl<L: PartialEq, A: PartialEq> PartialEq for Velocity<L, A>

Source§

fn eq(&self, other: &Velocity<L, A>) -> 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<L, A> StructuralPartialEq for Velocity<L, A>

Auto Trait Implementations§

§

impl<L, A> Freeze for Velocity<L, A>
where L: Freeze, A: Freeze,

§

impl<L, A> RefUnwindSafe for Velocity<L, A>

§

impl<L, A> Send for Velocity<L, A>
where L: Send, A: Send,

§

impl<L, A> Sync for Velocity<L, A>
where L: Sync, A: Sync,

§

impl<L, A> Unpin for Velocity<L, A>
where L: Unpin, A: Unpin,

§

impl<L, A> UnwindSafe for Velocity<L, A>
where L: UnwindSafe, A: 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> 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.