trajectory/
utils.rs

1use num_traits::Float;
2
3pub fn is_inputs_valid<T>(times: &[T], points: &[Vec<T>]) -> bool
4where
5    T: Float,
6{
7    if times.len() != points.len() {
8        return false;
9    }
10    for i in 0..times.len() - 1 {
11        // not sorted time
12        if times[i] >= times[i + 1] {
13            return false;
14        }
15    }
16    if points.is_empty() {
17        return false;
18    }
19    if points[0].is_empty() {
20        return false;
21    }
22    let dim = points[0].len();
23    for p in points {
24        if p.len() != dim {
25            return false;
26        }
27    }
28    true
29}