interpolate_transforms

Function interpolate_transforms 

Source
pub fn interpolate_transforms<T: Interpolate>(
    before: &StampedTransform<T>,
    after: &StampedTransform<T>,
    time: CuTime,
) -> TransformResult<Transform3D<T>>
Expand description

Interpolate between two transforms at a specific time point

This function performs linear interpolation between two transforms for the translation components (last column of the transformation matrix) at the specified time point. The rotation components are not interpolated and are copied from the first transform.

Works with any numeric type implementing the Interpolate trait, including both floating-point (f32, f64) and integer types (i32, i64, u32, u64).

§Arguments

  • before - The transform at an earlier time
  • after - The transform at a later time
  • time - The time at which to interpolate (must be between before.stamp and after.stamp)

§Returns

  • A new interpolated transform at the specified time
  • Error if frames don’t match or time is outside the valid range