mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Only recalculate outer_vert_indices when points are resized
This commit is contained in:
parent
b9d6dcd67d
commit
bd89056c8e
1 changed files with 12 additions and 3 deletions
|
@ -1053,13 +1053,22 @@ class VMobject(Mobject):
|
|||
vmob.pointwise_become_partial(self, a, b)
|
||||
return vmob
|
||||
|
||||
def resize_points(
|
||||
self,
|
||||
new_length: int,
|
||||
resize_func: Callable[[np.ndarray, int], np.ndarray] = resize_array
|
||||
) -> Self:
|
||||
super().resize_points(new_length, resize_func)
|
||||
|
||||
n_curves = self.get_num_curves()
|
||||
# Creates the pattern (0, 1, 2, 2, 3, 4, 4, 5, 6, ...)
|
||||
self.outer_vert_indices = (np.arange(1, 3 * n_curves + 1) * 2) // 3
|
||||
return self
|
||||
|
||||
def get_outer_vert_indices(self) -> np.ndarray:
|
||||
"""
|
||||
Returns the pattern (0, 1, 2, 2, 3, 4, 4, 5, 6, ...)
|
||||
"""
|
||||
n_curves = self.get_num_curves()
|
||||
if len(self.outer_vert_indices) != 3 * n_curves:
|
||||
self.outer_vert_indices = (np.arange(1, 3 * n_curves + 1) * 2) // 3
|
||||
return self.outer_vert_indices
|
||||
|
||||
# Data for shaders that may need refreshing
|
||||
|
|
Loading…
Add table
Reference in a new issue