mirror of
https://github.com/3b1b/manim.git
synced 2025-08-20 05:14:12 +00:00
Make alignment between VMobjects conducive to smoother interpolation
This commit is contained in:
parent
d3a4d81a63
commit
f858a439dd
1 changed files with 6 additions and 1 deletions
|
@ -890,6 +890,11 @@ class VMobject(Mobject):
|
|||
# Figure out what the subpaths are, and align
|
||||
subpaths1 = self.get_subpaths()
|
||||
subpaths2 = vmobject.get_subpaths()
|
||||
for subpaths in [subpaths1, subpaths2]:
|
||||
subpaths.sort(key=lambda sp: -sum(
|
||||
get_norm(p2 - p1)
|
||||
for p1, p2 in zip(sp, sp[1:])
|
||||
))
|
||||
n_subpaths = max(len(subpaths1), len(subpaths2))
|
||||
|
||||
# Start building new ones
|
||||
|
@ -898,7 +903,7 @@ class VMobject(Mobject):
|
|||
|
||||
def get_nth_subpath(path_list, n):
|
||||
if n >= len(path_list):
|
||||
return [path_list[-1][-1]]
|
||||
return np.vstack([path_list[0][:-1], path_list[0][::-1]])
|
||||
return path_list[n]
|
||||
|
||||
for n in range(n_subpaths):
|
||||
|
|
Loading…
Add table
Reference in a new issue