@@ -1293,15 +1293,13 @@ def get_subpath_split_indices_from_points(
1293
1293
n_dims : int = 3 ,
1294
1294
strip_null_end_curves : bool = False ,
1295
1295
) -> npt .NDArray [ManimInt ]:
1296
+ points = np .asarray (points )
1297
+
1296
1298
nppcc = self .n_points_per_cubic_curve
1297
1299
starts = points [::nppcc ]
1298
1300
ends = points [nppcc - 1 :: nppcc ]
1299
1301
# This ensures that there are no more starts than ends.
1300
- # TODO: ends.shape[0] would be more efficient, but some test cases
1301
- # regarding Flash and ShowPassingFlash expect a Python list instead of
1302
- # an ndarray, so ends.shape[0] breaks those test cases.
1303
- # Fix these inconsistencies.
1304
- n_curves = len (ends )
1302
+ n_curves = ends .shape [0 ]
1305
1303
starts = starts [:n_curves ]
1306
1304
1307
1305
# Zero curves case: if nothing was done to handle this, the statement
@@ -1910,16 +1908,34 @@ def align_points(self, vmobject: VMobject) -> Self:
1910
1908
self_new_path [max_start :max_end ] = self_subpath
1911
1909
vmob_new_path [max_start :max_end ] = vmob_subpath
1912
1910
1911
+ # Because strip_null_end_curves=True, maybe the old points have to
1912
+ # be cut earlier. Extract the end points from the split indices
1913
+ self_end , vmob_end = self_split_i [- 1 , 1 ], vmob_split_i [- 1 , 1 ]
1914
+
1913
1915
# If any of the original paths had more subpaths than the other,
1914
1916
# add them to the corresponding new path and complete the other
1915
1917
# one by appending its last anchor as many times as necessary.
1916
1918
if self_n_subpaths < vmob_n_subpaths :
1917
1919
vmob_start = vmob_split_i [least_n_subpaths , 0 ]
1918
1920
self_new_path [max_n_points :] = self_new_path [max_n_points - 1 ]
1919
- vmob_new_path [max_n_points :] = vmobject .points [vmob_start :]
1921
+ vmob_new_path [max_n_points :] = vmobject .points [vmob_start :vmob_end ]
1920
1922
elif self_n_subpaths > vmob_n_subpaths :
1921
1923
self_start = self_split_i [least_n_subpaths , 0 ]
1922
- self_new_path [max_n_points :] = self .points [self_start :]
1924
+ try :
1925
+ self_new_path [max_n_points :] = self .points [self_start :self_end ]
1926
+ except Exception as e :
1927
+ print ("SELF SHAPE:" , self .points .shape )
1928
+ print ("VMOB SHAPE:" , vmobject .points .shape )
1929
+ print ("SELF SUBSPLIT:" , self_split_i )
1930
+ print ("VMOB SUBSPLIT:" , vmob_split_i )
1931
+ print ("MAX SUBSPLIT:" , max_split_i )
1932
+ print ("Least subpaths:" , least_n_subpaths )
1933
+ print ("Max points:" , max_n_points )
1934
+ print ("Remainder points:" , remainder_n_points )
1935
+ print ("Self start:" , self_start )
1936
+ print ("SELF NEW SHAPE:" , self_new_path .shape )
1937
+ print ("VMOB NEW SHAPE:" , vmob_new_path .shape )
1938
+ raise e
1923
1939
vmob_new_path [max_n_points :] = vmob_new_path [max_n_points - 1 ]
1924
1940
1925
1941
self .set_points (self_new_path )
0 commit comments