|
10 | 10 | ] |
11 | 11 |
|
12 | 12 |
|
13 | | -from typing import Callable |
| 13 | +from typing import TYPE_CHECKING |
14 | 14 |
|
15 | 15 | import numpy as np |
16 | 16 |
|
17 | 17 | from ..constants import OUT |
18 | 18 | from ..utils.bezier import interpolate |
19 | | -from ..utils.deprecation import deprecated_params |
20 | 19 | from ..utils.space_ops import rotation_matrix |
21 | 20 |
|
22 | | -STRAIGHT_PATH_THRESHOLD = 0.01 |
| 21 | +if TYPE_CHECKING: |
| 22 | + from manim.typing import PathFuncType, Vector3D |
| 23 | + |
23 | 24 |
|
24 | | -PATH_FUNC_TYPE = Callable[[np.ndarray, np.ndarray, float], np.ndarray] |
| 25 | +STRAIGHT_PATH_THRESHOLD = 0.01 |
25 | 26 |
|
26 | 27 |
|
27 | | -# Remove `*args` and the `if` inside the functions when removing deprecation |
28 | | -@deprecated_params( |
29 | | - params="start_points, end_points, alpha", |
30 | | - since="v0.14", |
31 | | - until="v0.15", |
32 | | - message="Straight path is now returning interpolating function to make it consistent with other path functions. Use straight_path()(a,b,c) instead of straight_path(a,b,c).", |
33 | | -) |
34 | | -def straight_path(*args) -> PATH_FUNC_TYPE: |
| 28 | +def straight_path(): |
35 | 29 | """Simplest path function. Each point in a set goes in a straight path toward its destination. |
36 | 30 |
|
37 | 31 | Examples |
@@ -74,14 +68,12 @@ def construct(self): |
74 | 68 | self.wait() |
75 | 69 |
|
76 | 70 | """ |
77 | | - if len(args) > 0: |
78 | | - return interpolate(*args) |
79 | 71 | return interpolate |
80 | 72 |
|
81 | 73 |
|
82 | 74 | def path_along_circles( |
83 | | - arc_angle: float, circles_centers: np.ndarray, axis: np.ndarray = OUT |
84 | | -) -> PATH_FUNC_TYPE: |
| 75 | + arc_angle: float, circles_centers: Point3D, axis: Vector3D = OUT |
| 76 | +) -> PathFuncType: |
85 | 77 | """This function transforms each point by moving it roughly along a circle, each with its own specified center. |
86 | 78 |
|
87 | 79 | The path may be seen as each point smoothly changing its orbit from its starting position to its destination. |
@@ -158,7 +150,7 @@ def path(start_points: np.ndarray, end_points: np.ndarray, alpha: float): |
158 | 150 | return path |
159 | 151 |
|
160 | 152 |
|
161 | | -def path_along_arc(arc_angle: float, axis: np.ndarray = OUT) -> PATH_FUNC_TYPE: |
| 153 | +def path_along_arc(arc_angle: float, axis: Vector3D = OUT) -> PathFuncType: |
162 | 154 | """This function transforms each point by moving it along a circular arc. |
163 | 155 |
|
164 | 156 | Parameters |
@@ -225,7 +217,7 @@ def path(start_points: np.ndarray, end_points: np.ndarray, alpha: float): |
225 | 217 | return path |
226 | 218 |
|
227 | 219 |
|
228 | | -def clockwise_path() -> PATH_FUNC_TYPE: |
| 220 | +def clockwise_path() -> PathFuncType: |
229 | 221 | """This function transforms each point by moving clockwise around a half circle. |
230 | 222 |
|
231 | 223 | Examples |
@@ -271,7 +263,7 @@ def construct(self): |
271 | 263 | return path_along_arc(-np.pi) |
272 | 264 |
|
273 | 265 |
|
274 | | -def counterclockwise_path() -> PATH_FUNC_TYPE: |
| 266 | +def counterclockwise_path() -> PathFuncType: |
275 | 267 | """This function transforms each point by moving counterclockwise around a half circle. |
276 | 268 |
|
277 | 269 | Examples |
@@ -317,7 +309,7 @@ def construct(self): |
317 | 309 | return path_along_arc(np.pi) |
318 | 310 |
|
319 | 311 |
|
320 | | -def spiral_path(angle: float, axis: np.ndarray = OUT) -> PATH_FUNC_TYPE: |
| 312 | +def spiral_path(angle: float, axis: Vector3D = OUT) -> PathFuncType: |
321 | 313 | """This function transforms each point by moving along a spiral to its destination. |
322 | 314 |
|
323 | 315 | Parameters |
|
0 commit comments