mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Ensure get_joint_angles works in start-new-path case
This commit is contained in:
parent
9d9e000c63
commit
eccaa8681e
1 changed files with 9 additions and 1 deletions
|
@ -1046,9 +1046,14 @@ class VMobject(Mobject):
|
|||
points = self.get_points()
|
||||
self.data["joint_angle"] = resize_array(self.data["joint_angle"], len(points))
|
||||
|
||||
if(len(points) == 0):
|
||||
if(len(points) < 3):
|
||||
return self.data["joint_angle"]
|
||||
|
||||
append_one = False
|
||||
if(len(points) % 3 == 1):
|
||||
points = points[:-1]
|
||||
append_one = True
|
||||
|
||||
# Unit tangent vectors
|
||||
a0, h, a1 = points[0::3], points[1::3], points[2::3]
|
||||
a0_to_h = normalize_along_axis(h - a0, 1)
|
||||
|
@ -1084,6 +1089,9 @@ class VMobject(Mobject):
|
|||
self.data["joint_angle"][3::3][mis_matches] = 0
|
||||
self.data["joint_angle"][2:-1:3][mis_matches] = 0
|
||||
|
||||
if append_one:
|
||||
self.data["joint_angle"] = np.hstack([self.data["joint_angle"], 0])
|
||||
|
||||
return self.data["joint_angle"]
|
||||
|
||||
def triggers_refreshed_triangulation(func: Callable):
|
||||
|
|
Loading…
Add table
Reference in a new issue