mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Fix output type of VMobject.get_subpaths_from_points
This commit is contained in:
parent
b817e6f15f
commit
3e8738de2a
1 changed files with 4 additions and 8 deletions
|
@ -644,24 +644,20 @@ class VMobject(Mobject):
|
||||||
def get_subpaths_from_points(
|
def get_subpaths_from_points(
|
||||||
self,
|
self,
|
||||||
points: Vect3Array
|
points: Vect3Array
|
||||||
) -> Vect3Array:
|
) -> list[Vect3Array]:
|
||||||
nppc = self.n_points_per_curve
|
nppc = self.n_points_per_curve
|
||||||
diffs = points[nppc - 1:-1:nppc] - points[nppc::nppc]
|
diffs = points[nppc - 1:-1:nppc] - points[nppc::nppc]
|
||||||
splits = (diffs * diffs).sum(1) > self.tolerance_for_point_equality
|
splits = (diffs * diffs).sum(1) > self.tolerance_for_point_equality
|
||||||
split_indices = np.arange(nppc, len(points), nppc, dtype=int)[splits]
|
split_indices = np.arange(nppc, len(points), nppc, dtype=int)[splits]
|
||||||
|
|
||||||
# split_indices = filter(
|
|
||||||
# lambda n: not self.consider_points_equals(points[n - 1], points[n]),
|
|
||||||
# range(nppc, len(points), nppc)
|
|
||||||
# )
|
|
||||||
split_indices = [0, *split_indices, len(points)]
|
split_indices = [0, *split_indices, len(points)]
|
||||||
return np.array([
|
return [
|
||||||
points[i1:i2]
|
points[i1:i2]
|
||||||
for i1, i2 in zip(split_indices, split_indices[1:])
|
for i1, i2 in zip(split_indices, split_indices[1:])
|
||||||
if (i2 - i1) >= nppc
|
if (i2 - i1) >= nppc
|
||||||
])
|
]
|
||||||
|
|
||||||
def get_subpaths(self) -> Vect3Array:
|
def get_subpaths(self) -> list[Vect3Array]:
|
||||||
return self.get_subpaths_from_points(self.get_points())
|
return self.get_subpaths_from_points(self.get_points())
|
||||||
|
|
||||||
def get_nth_curve_points(self, n: int) -> Vect3:
|
def get_nth_curve_points(self, n: int) -> Vect3:
|
||||||
|
|
Loading…
Add table
Reference in a new issue