(p0: dict, p1: dict, p2: dict, p3: dict, t: float)
| 11 | |
| 12 | |
| 13 | def _catmull_rom(p0: dict, p1: dict, p2: dict, p3: dict, t: float) -> dict[str, float]: |
| 14 | t2 = t * t |
| 15 | t3 = t2 * t |
| 16 | return { |
| 17 | "x": 0.5 |
| 18 | * ( |
| 19 | 2 * p1["x"] |
| 20 | + (-p0["x"] + p2["x"]) * t |
| 21 | + (2 * p0["x"] - 5 * p1["x"] + 4 * p2["x"] - p3["x"]) * t2 |
| 22 | + (-p0["x"] + 3 * p1["x"] - 3 * p2["x"] + p3["x"]) * t3 |
| 23 | ), |
| 24 | "y": 0.5 |
| 25 | * ( |
| 26 | 2 * p1["y"] |
| 27 | + (-p0["y"] + p2["y"]) * t |
| 28 | + (2 * p0["y"] - 5 * p1["y"] + 4 * p2["y"] - p3["y"]) * t2 |
| 29 | + (-p0["y"] + 3 * p1["y"] - 3 * p2["y"] + p3["y"]) * t3 |
| 30 | ), |
| 31 | } |
| 32 | |
| 33 | |
| 34 | def _interpolate_spline( |
no outgoing calls
no test coverage detected