@@ -104,7 +104,7 @@ def construct(self):
104
104
105
105
def __init__ (
106
106
self ,
107
- function : Callable [[float ], Point3DLike ],
107
+ function : Callable [[float | np . ndarray ], Point3DLike ],
108
108
t_range : tuple [float , float ] | tuple [float , float , float ] = (0 , 1 ),
109
109
scaling : _ScaleBase = LinearBase (),
110
110
dt : float = 1e-8 ,
@@ -113,7 +113,7 @@ def __init__(
113
113
use_vectorized : bool = False ,
114
114
** kwargs ,
115
115
):
116
- def internal_parametric_function (t : float ) -> Point3D :
116
+ def internal_parametric_function (t : float | np . ndarray ) -> Point3D :
117
117
"""Wrap ``function``'s output inside a NumPy array."""
118
118
return np .asarray (function (t ))
119
119
@@ -143,23 +143,23 @@ def generate_points(self) -> Self:
143
143
lambda t : self .t_min <= t <= self .t_max ,
144
144
self .discontinuities ,
145
145
)
146
- discontinuities = np .array (list (discontinuities ))
146
+ discontinuities_array = np .array (list (discontinuities ))
147
147
boundary_times = np .array (
148
148
[
149
149
self .t_min ,
150
150
self .t_max ,
151
- * (discontinuities - self .dt ),
152
- * (discontinuities + self .dt ),
151
+ * (discontinuities_array + self .dt ),
152
+ * (discontinuities_array - self .dt ),
153
153
],
154
154
)
155
155
boundary_times .sort ()
156
156
else :
157
- boundary_times = [self .t_min , self .t_max ]
157
+ boundary_times = np . array ( [self .t_min , self .t_max ])
158
158
159
159
for t1 , t2 in zip (boundary_times [0 ::2 ], boundary_times [1 ::2 ]):
160
160
t_range = np .array (
161
161
[
162
- * self .scaling .function (np .arange (t1 , t2 , self .t_step )),
162
+ * ( self .scaling .function (t ) for t in np .arange (t1 , t2 , self .t_step )),
163
163
self .scaling .function (t2 ),
164
164
],
165
165
)
0 commit comments