mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Allow Mobject subclasses to specify which parts of data should act like points
This commit is contained in:
parent
e55434925e
commit
7e45558c55
1 changed files with 4 additions and 2 deletions
|
@ -73,6 +73,7 @@ class Mobject(object):
|
|||
('rgba', '<f4', (4,)),
|
||||
])
|
||||
aligned_data_keys = ['points']
|
||||
pointlike_data_keys = ['points']
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -205,7 +206,7 @@ class Mobject(object):
|
|||
def apply_points_function(
|
||||
self,
|
||||
func: Callable[[np.ndarray], np.ndarray],
|
||||
about_point: Vect3 = None,
|
||||
about_point: Vect3 | None = None,
|
||||
about_edge: Vect3 = ORIGIN,
|
||||
works_on_bounding_box: bool = False
|
||||
):
|
||||
|
@ -215,7 +216,8 @@ class Mobject(object):
|
|||
for mob in self.get_family():
|
||||
arrs = []
|
||||
if mob.has_points():
|
||||
arrs.append(mob.get_points())
|
||||
for key in mob.pointlike_data_keys:
|
||||
arrs.append(mob.data[key])
|
||||
if works_on_bounding_box:
|
||||
arrs.append(mob.get_bounding_box())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue