pub struct VelocityTransform<T: Copy + Debug + 'static> {
pub linear: [T; 3],
pub angular: [T; 3],
}
Expand description
A struct representing linear and angular velocity in 3D space
The VelocityTransform
encapsulates both linear and angular velocity components
of a rigid body in 3D space. It complements the Transform3D
struct which
represents position and orientation.
Linear velocity is represented as a 3D vector [vx, vy, vz] in meters per second. Angular velocity is represented as a 3D vector [wx, wy, wz] in radians per second, where the vector represents the axis of rotation and the magnitude is the rate.
§Examples
use cu_transform::VelocityTransform;
// Create a velocity with 1 m/s forward and 0.5 rad/s rotation around Z axis
let velocity = VelocityTransform::<f32> {
linear: [1.0, 0.0, 0.0],
angular: [0.0, 0.0, 0.5],
};
Velocities can be transformed between coordinate frames using the
transform_velocity
function, and new velocities can be computed from time-stamped
transforms using StampedTransform::compute_velocity
.
When using the TransformTree to look up velocities with lookup_velocity
, results
are automatically cached for improved performance on repeated lookups. The cache is
invalidated when new transforms are added or when entries exceed their age limit.
Fields§
§linear: [T; 3]
Linear velocity components [vx, vy, vz] in meters per second
angular: [T; 3]
Angular velocity components [wx, wy, wz] in radians per second
Implementations§
Source§impl<T> VelocityTransform<T>
impl<T> VelocityTransform<T>
Source§impl VelocityTransform<f64>
impl VelocityTransform<f64>
Sourcepub fn linear_velocity(&self) -> [Velocity64; 3]
pub fn linear_velocity(&self) -> [Velocity64; 3]
Get linear velocity components with units
Sourcepub fn angular_velocity(&self) -> [AngularVelocity64; 3]
pub fn angular_velocity(&self) -> [AngularVelocity64; 3]
Get angular velocity components with units
Source§impl VelocityTransform<f32>
impl VelocityTransform<f32>
Sourcepub fn linear_velocity(&self) -> [Velocity32; 3]
pub fn linear_velocity(&self) -> [Velocity32; 3]
Get linear velocity components with units
Sourcepub fn angular_velocity(&self) -> [AngularVelocity32; 3]
pub fn angular_velocity(&self) -> [AngularVelocity32; 3]
Get angular velocity components with units
Trait Implementations§
Source§impl<T> Add for VelocityTransform<T>
impl<T> Add for VelocityTransform<T>
Source§impl<'__de, T, __Context> BorrowDecode<'__de, __Context> for VelocityTransform<T>
impl<'__de, T, __Context> BorrowDecode<'__de, __Context> for VelocityTransform<T>
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl<T: Clone + Copy + Debug + 'static> Clone for VelocityTransform<T>
impl<T: Clone + Copy + Debug + 'static> Clone for VelocityTransform<T>
Source§fn clone(&self) -> VelocityTransform<T>
fn clone(&self) -> VelocityTransform<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T, __Context> Decode<__Context> for VelocityTransform<T>
impl<T, __Context> Decode<__Context> for VelocityTransform<T>
Source§impl<'de, T> Deserialize<'de> for VelocityTransform<T>
impl<'de, T> Deserialize<'de> for VelocityTransform<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T> Encode for VelocityTransform<T>
impl<T> Encode for VelocityTransform<T>
Source§impl<T> Neg for VelocityTransform<T>
impl<T> Neg for VelocityTransform<T>
Source§impl<T> Serialize for VelocityTransform<T>
impl<T> Serialize for VelocityTransform<T>
Auto Trait Implementations§
impl<T> Freeze for VelocityTransform<T>where
T: Freeze,
impl<T> RefUnwindSafe for VelocityTransform<T>where
T: RefUnwindSafe,
impl<T> Send for VelocityTransform<T>where
T: Send,
impl<T> Sync for VelocityTransform<T>where
T: Sync,
impl<T> Unpin for VelocityTransform<T>where
T: Unpin,
impl<T> UnwindSafe for VelocityTransform<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EncodableKey for Twhere
T: Serialize,
impl<T> EncodableKey for Twhere
T: Serialize,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more