Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typefixes in mobject/graphing/functions.py #4135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading