mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Added is_in_frame method to camera
This commit is contained in:
parent
1d23a01a3a
commit
49fe36b048
1 changed files with 11 additions and 1 deletions
|
@ -221,7 +221,6 @@ class Camera(object):
|
||||||
excluded_mobjects
|
excluded_mobjects
|
||||||
)
|
)
|
||||||
mobjects = list_difference_update(mobjects, all_excluded)
|
mobjects = list_difference_update(mobjects, all_excluded)
|
||||||
|
|
||||||
if self.use_z_coordinate_for_display_order:
|
if self.use_z_coordinate_for_display_order:
|
||||||
# Should perhaps think about what happens here when include_submobjects is False,
|
# Should perhaps think about what happens here when include_submobjects is False,
|
||||||
# (for now, the onus is then on the caller to ensure this is handled correctly by
|
# (for now, the onus is then on the caller to ensure this is handled correctly by
|
||||||
|
@ -233,6 +232,17 @@ class Camera(object):
|
||||||
else:
|
else:
|
||||||
return mobjects
|
return mobjects
|
||||||
|
|
||||||
|
def is_in_frame(self, mobject):
|
||||||
|
fc = self.get_frame_center()
|
||||||
|
fh = self.get_frame_height()
|
||||||
|
fw = self.get_frame_width()
|
||||||
|
return not reduce(op.or_, [
|
||||||
|
mobject.get_left()[0] < fc[0] - fw,
|
||||||
|
mobject.get_bottom()[1] > fc[1] + fh,
|
||||||
|
mobject.get_right()[0] > fc[0] + fw,
|
||||||
|
mobject.get_top()[1] < fc[1] - fh,
|
||||||
|
])
|
||||||
|
|
||||||
def capture_mobject(self, mobject, **kwargs):
|
def capture_mobject(self, mobject, **kwargs):
|
||||||
return self.capture_mobjects([mobject], **kwargs)
|
return self.capture_mobjects([mobject], **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue