mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
Added is_in_frame method to camera
This commit is contained in:
@ -221,7 +221,6 @@ class Camera(object):
|
||||
excluded_mobjects
|
||||
)
|
||||
mobjects = list_difference_update(mobjects, all_excluded)
|
||||
|
||||
if self.use_z_coordinate_for_display_order:
|
||||
# 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
|
||||
@ -233,6 +232,17 @@ class Camera(object):
|
||||
else:
|
||||
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):
|
||||
return self.capture_mobjects([mobject], **kwargs)
|
||||
|
||||
|
Reference in New Issue
Block a user