Skip to content

Commit f6cdb54

Browse files
authored
Fix add_points_as_corners not connecting single point to existing path (#4219)
1 parent 5a3dcf7 commit f6cdb54

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

manim/mobject/types/vectorized_mobject.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,22 +1047,21 @@ def add_points_as_corners(self, points: Point3DLike_Array) -> Self:
10471047
The VMobject itself, after appending the straight lines to its
10481048
path.
10491049
"""
1050+
self.throw_error_if_no_points()
1051+
10501052
points = np.asarray(points).reshape(-1, self.dim)
10511053
num_points = points.shape[0]
10521054
if num_points == 0:
10531055
return self
10541056

1057+
start_corners = np.empty((num_points, self.dim))
1058+
start_corners[0] = self.points[-1]
1059+
start_corners[1:] = points[:-1]
1060+
end_corners = points
1061+
10551062
if self.has_new_path_started():
1056-
# Pop the last point from self.points and
1057-
# add it to start_corners
1058-
start_corners = np.empty((num_points, self.dim))
1059-
start_corners[0] = self.points[-1]
1060-
start_corners[1:] = points[:-1]
1061-
end_corners = points
1063+
# Remove the last point from the new path
10621064
self.points = self.points[:-1]
1063-
else:
1064-
start_corners = points[:-1]
1065-
end_corners = points[1:]
10661065

10671066
nppcc = self.n_points_per_cubic_curve
10681067
new_points = np.empty((nppcc * start_corners.shape[0], self.dim))

0 commit comments

Comments
 (0)