Skip to content

Commit

Permalink
Typefixes in functions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MathdudeMan committed Jan 25, 2025
1 parent a6990bd commit 8a4fa07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions manim/mobject/graphing/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,29 @@ def generate_points(self) -> Self:
lambda t: self.t_min <= t <= self.t_max,
self.discontinuities,
)
discontinuities = np.array(list(discontinuities))
discontinuities_array = np.array(list(discontinuities))
boundary_times = np.array(
[
self.t_min,
self.t_max,
*(discontinuities - self.dt),
*(discontinuities + self.dt),
*(discontinuities_array - self.dt),
*(discontinuities_array + self.dt),
],
)
boundary_times.sort()
else:
boundary_times = [self.t_min, self.t_max]
boundary_times = np.array([self.t_min, self.t_max])

for t1, t2 in zip(boundary_times[0::2], boundary_times[1::2]):
t_range = np.array(
[
*self.scaling.function(np.arange(t1, t2, self.t_step)),
self.scaling.function(np.arange(t1, t2, self.t_step)),
self.scaling.function(t2),
],
)

if self.use_vectorized:
x, y, z = self.function(t_range)
x, y, z = self.function(*t_range)
if not isinstance(z, np.ndarray):
z = np.zeros_like(x)
points = np.stack([x, y, z], axis=1)
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/graphing/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _ScaleBase:
def __init__(self, custom_labels: bool = False):
self.custom_labels = custom_labels

def function(self, value: float) -> float:
def function(self, value: float | np.ndarray) -> float:
"""The function that will be used to scale the values.
Parameters
Expand Down

0 comments on commit 8a4fa07

Please sign in to comment.