(p0: [f64; 2], p1: [f64; 2], p2: [f64; 2], p3: [f64; 2], t: f64)
| 170 | } |
| 171 | |
| 172 | fn catmull_rom_point(p0: [f64; 2], p1: [f64; 2], p2: [f64; 2], p3: [f64; 2], t: f64) -> [f64; 2] { |
| 173 | let t2 = t * t; |
| 174 | let t3 = t2 * t; |
| 175 | |
| 176 | let x = 0.5 |
| 177 | * ((2.0 * p1[0]) |
| 178 | + (-p0[0] + p2[0]) * t |
| 179 | + (2.0 * p0[0] - 5.0 * p1[0] + 4.0 * p2[0] - p3[0]) * t2 |
| 180 | + (-p0[0] + 3.0 * p1[0] - 3.0 * p2[0] + p3[0]) * t3); |
| 181 | |
| 182 | let y = 0.5 |
| 183 | * ((2.0 * p1[1]) |
| 184 | + (-p0[1] + p2[1]) * t |
| 185 | + (2.0 * p0[1] - 5.0 * p1[1] + 4.0 * p2[1] - p3[1]) * t2 |
| 186 | + (-p0[1] + 3.0 * p1[1] - 3.0 * p2[1] + p3[1]) * t3); |
| 187 | |
| 188 | [x, y] |
| 189 | } |
| 190 | |
| 191 | fn nearest_control_point_index( |
| 192 | control_points: &[[f64; 2]], |
no outgoing calls
no test coverage detected