Skip to content

Commit

Permalink
Optimized manim.utils.bezier.get_smooth_cubic_bezier_handle_points() (
Browse files Browse the repository at this point in the history
#3767)

* Optimized manim.utils.get_smooth_cubic_bezier_handle_points()

* Fixed typo in docstring regarding vector u

* Add tests for get_smooth_cubic_bezier_handle_points

* Fix backreference in test docstrings

Co-authored-by: adeshpande <[email protected]>

---------

Co-authored-by: adeshpande <[email protected]>
  • Loading branch information
chopan050 and JasonGrace2282 authored Jun 26, 2024
1 parent 0d21a7e commit 64ab9ad
Show file tree
Hide file tree
Showing 3 changed files with 555 additions and 148 deletions.
4 changes: 2 additions & 2 deletions manim/mobject/types/vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from manim.utils.bezier import (
bezier,
bezier_remap,
get_smooth_handle_points,
get_smooth_cubic_bezier_handle_points,
integer_interpolate,
interpolate,
partial_bezier_points,
Expand Down Expand Up @@ -1093,7 +1093,7 @@ def change_anchor_mode(self, mode: Literal["jagged", "smooth"]) -> Self:
# The append is needed as the last element is not reached when slicing with numpy.
anchors = np.append(subpath[::nppcc], subpath[-1:], 0)
if mode == "smooth":
h1, h2 = get_smooth_handle_points(anchors)
h1, h2 = get_smooth_cubic_bezier_handle_points(anchors)
else: # mode == "jagged"
# The following will make the handles aligned with the anchors, thus making the bezier curve a segment
a1 = anchors[:-1]
Expand Down
Loading

0 comments on commit 64ab9ad

Please sign in to comment.