mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Fixed bug with MappingCamera set to allow_object_intrusion
This commit is contained in:
parent
730c94461f
commit
3c86caa488
1 changed files with 15 additions and 6 deletions
21
camera.py
21
camera.py
|
@ -99,10 +99,7 @@ class Camera(object):
|
||||||
])
|
])
|
||||||
))
|
))
|
||||||
|
|
||||||
def capture_mobject(self, mobject):
|
def get_mobjects_to_display(
|
||||||
return self.capture_mobjects([mobject])
|
|
||||||
|
|
||||||
def capture_mobjects(
|
|
||||||
self, mobjects,
|
self, mobjects,
|
||||||
include_submobjects = True,
|
include_submobjects = True,
|
||||||
excluded_mobjects = None,
|
excluded_mobjects = None,
|
||||||
|
@ -116,6 +113,13 @@ class Camera(object):
|
||||||
excluded_mobjects
|
excluded_mobjects
|
||||||
)
|
)
|
||||||
mobjects = list_difference_update(mobjects, all_excluded)
|
mobjects = list_difference_update(mobjects, all_excluded)
|
||||||
|
return mobjects
|
||||||
|
|
||||||
|
def capture_mobject(self, mobject, **kwargs):
|
||||||
|
return self.capture_mobjects([mobject], **kwargs)
|
||||||
|
|
||||||
|
def capture_mobjects(self, mobjects, **kwargs):
|
||||||
|
mobjects = self.get_mobjects_to_display(mobjects, **kwargs)
|
||||||
vmobjects = []
|
vmobjects = []
|
||||||
for mobject in mobjects:
|
for mobject in mobjects:
|
||||||
if isinstance(mobject, VMobject):
|
if isinstance(mobject, VMobject):
|
||||||
|
@ -411,7 +415,7 @@ class MovingCamera(Camera):
|
||||||
class MappingCamera(Camera):
|
class MappingCamera(Camera):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"mapping_func" : lambda p : p,
|
"mapping_func" : lambda p : p,
|
||||||
"min_anchor_points" : 20,
|
"min_anchor_points" : 50,
|
||||||
"allow_object_intrusion" : False
|
"allow_object_intrusion" : False
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +423,7 @@ class MappingCamera(Camera):
|
||||||
return Camera.points_to_pixel_coords(self, np.apply_along_axis(self.mapping_func, 1, points))
|
return Camera.points_to_pixel_coords(self, np.apply_along_axis(self.mapping_func, 1, points))
|
||||||
|
|
||||||
def capture_mobjects(self, mobjects, **kwargs):
|
def capture_mobjects(self, mobjects, **kwargs):
|
||||||
|
mobjects = self.get_mobjects_to_display(mobjects, **kwargs)
|
||||||
if self.allow_object_intrusion:
|
if self.allow_object_intrusion:
|
||||||
mobject_copies = mobjects
|
mobject_copies = mobjects
|
||||||
else:
|
else:
|
||||||
|
@ -427,7 +432,11 @@ class MappingCamera(Camera):
|
||||||
if isinstance(mobject, VMobject) and \
|
if isinstance(mobject, VMobject) and \
|
||||||
0 < mobject.get_num_anchor_points() < self.min_anchor_points:
|
0 < mobject.get_num_anchor_points() < self.min_anchor_points:
|
||||||
mobject.insert_n_anchor_points(self.min_anchor_points)
|
mobject.insert_n_anchor_points(self.min_anchor_points)
|
||||||
Camera.capture_mobjects(self, mobject_copies, **kwargs)
|
Camera.capture_mobjects(
|
||||||
|
self, mobject_copies,
|
||||||
|
include_submobjects = False,
|
||||||
|
excluded_mobjects = None,
|
||||||
|
)
|
||||||
|
|
||||||
# TODO: Put this in different utility/helpers file? Convenient for me (Sridhar); I like it.
|
# TODO: Put this in different utility/helpers file? Convenient for me (Sridhar); I like it.
|
||||||
class DictAsObject(object):
|
class DictAsObject(object):
|
||||||
|
|
Loading…
Add table
Reference in a new issue