Skip to content

Commit

Permalink
Handle make_jagged for empty VMobjects
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Aug 16, 2023
1 parent f2ad9a7 commit eafd095
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manimlib/mobject/types/vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ def set_anchors_and_handles(
anchors: Vect3Array,
handles: Vect3Array,
) -> Self:
if len(anchors) == 0:
self.clear_points()
return self
assert(len(anchors) == len(handles) + 1)
points = resize_array(self.get_points(), 2 * len(anchors) - 1)
points[0::2] = anchors
Expand Down Expand Up @@ -644,6 +647,8 @@ def is_smooth(self) -> bool:

def change_anchor_mode(self, mode: str) -> Self:
assert(mode in ("jagged", "approx_smooth", "true_smooth"))
if self.get_num_points() == 0:
return self
subpaths = self.get_subpaths()
self.clear_points()
for subpath in subpaths:
Expand Down

0 comments on commit eafd095

Please sign in to comment.