Function openrr_planner::interpolate

source ·
pub fn interpolate<T>(
    points: &[Vec<T>],
    total_duration: T,
    unit_duration: T,
) -> Option<Vec<TrajectoryPoint<T>>>
where T: Float,
Expand description

Interpolate position vectors

returns vector of (position, velocity, acceleration)

§Example

let points = openrr_planner::interpolate(&[vec![0.0, 1.0], vec![2.0, 0.0]], 1.0, 0.1).unwrap();
assert_eq!(points.len(), 12);
assert_eq!(points[0].position[0], 0.0);
assert_eq!(points[0].position[1], 1.0);
assert_eq!(points[1].position[0], 0.2);
assert_eq!(points[1].position[1], 0.9);