mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Fix IndexError in get_nth_subpath() and ensure it always returns a NumPy array (#4630)
* fix #3569 and #4629 * Add changes to opengl_vectorized_mobject.py --------- Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
This commit is contained in:
parent
ebb230f6f1
commit
21cf9998cc
2 changed files with 6 additions and 2 deletions
|
|
@ -1227,7 +1227,9 @@ class OpenGLVMobject(OpenGLMobject):
|
||||||
def get_nth_subpath(path_list, n):
|
def get_nth_subpath(path_list, n):
|
||||||
if n >= len(path_list):
|
if n >= len(path_list):
|
||||||
# Create a null path at the very end
|
# Create a null path at the very end
|
||||||
return [path_list[-1][-1]] * nppc
|
if len(path_list) == 0:
|
||||||
|
return np.tile(np.zeros(3), (nppc, 1))
|
||||||
|
return np.tile(path_list[-1][-1], (nppc, 1))
|
||||||
path = path_list[n]
|
path = path_list[n]
|
||||||
# Check for useless points at the end of the path and remove them
|
# Check for useless points at the end of the path and remove them
|
||||||
# https://github.com/ManimCommunity/manim/issues/1959
|
# https://github.com/ManimCommunity/manim/issues/1959
|
||||||
|
|
|
||||||
|
|
@ -1785,7 +1785,9 @@ class VMobject(Mobject):
|
||||||
def get_nth_subpath(path_list, n):
|
def get_nth_subpath(path_list, n):
|
||||||
if n >= len(path_list):
|
if n >= len(path_list):
|
||||||
# Create a null path at the very end
|
# Create a null path at the very end
|
||||||
return [path_list[-1][-1]] * nppcc
|
if len(path_list) == 0:
|
||||||
|
return np.tile(np.zeros(3), (nppcc, 1))
|
||||||
|
return np.tile(path_list[-1][-1], (nppcc, 1))
|
||||||
path = path_list[n]
|
path = path_list[n]
|
||||||
# Check for useless points at the end of the path and remove them
|
# Check for useless points at the end of the path and remove them
|
||||||
# https://github.com/ManimCommunity/manim/issues/1959
|
# https://github.com/ManimCommunity/manim/issues/1959
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue