ThreeDCamera#
Qualified name: manim.camera.three\_d\_camera.ThreeDCamera
- class ThreeDCamera(focal_distance=20.0, shading_factor=0.2, default_distance=5.0, light_source_start_point=array([- 7., - 9., 10.]), should_apply_shading=True, exponential_projection=False, phi=0, theta=- 1.5707963267948966, gamma=0, zoom=1, **kwargs)[source]#
Bases:
Camera
Initializes the ThreeDCamera
- Parameters
*kwargs – Any keyword argument of Camera.
Methods
This method allows the mobject to have a fixed position, even when the camera moves around.
This method allows the mobject to have a fixed orientation, even when the camera moves around.
Capture mobjects by printing them on
pixel_array
.Generates a rotation matrix based off the current position of the camera.
Returns the RGBA array of the fill of the passed VMobject
Returns focal_distance of the Camera.
Returns the rotation of the camera about the vector from the ORIGIN to the Camera.
Used to get the list of mobjects to display with the camera.
Returns the Polar angle (the angle off Z_AXIS) phi.
Returns the matrix corresponding to the current position of the camera.
Gets the RGBA array for the stroke of the passed VMobject.
Returns the Azimuthal i.e the angle that spins the camera around the Z_AXIS.
A list of
ValueTrackers
of phi, theta, focal_distance, gamma and zoom.Returns the zoom amount of the camera.
modified_rgbas
Applies the current rotation_matrix as a projection matrix to the passed point.
Applies the current rotation_matrix as a projection matrix to the passed array of points.
If a mobject was fixed in frame by passing it through
add_fixed_in_frame_mobjects()
, then this undoes that fixing.If a mobject was fixed in its orientation by passing it through
add_fixed_orientation_mobjects()
, then this undoes that fixing.Sets the value of self.rotation_matrix to the matrix corresponding to the current position of the camera
Sets the focal_distance of the Camera.
Sets the angle of rotation of the camera about the vector from the ORIGIN to the Camera.
Sets the polar angle i.e the angle between Z_AXIS and Camera through ORIGIN in radians.
Sets the azimuthal angle i.e the angle that spins the camera around Z_AXIS in radians.
Sets the zoom amount of the camera.
transform_points_pre_display
Attributes
background_color
background_opacity
frame_center
- add_fixed_in_frame_mobjects(*mobjects)[source]#
This method allows the mobject to have a fixed position, even when the camera moves around. E.G If it was passed through this method, at the top of the frame, it will continue to be displayed at the top of the frame.
Highly useful when displaying Titles or formulae or the like.
- Parameters
**mobjects (Mobject) – The mobject to fix in frame.
- add_fixed_orientation_mobjects(*mobjects, use_static_center_func=False, center_func=None)[source]#
This method allows the mobject to have a fixed orientation, even when the camera moves around. E.G If it was passed through this method, facing the camera, it will continue to face the camera even as the camera moves. Highly useful when adding labels to graphs and the like.
- Parameters
*mobjects (Mobject) – The mobject whose orientation must be fixed.
use_static_center_func (bool) – Whether or not to use the function that takes the mobject’s center as centerpoint, by default False
center_func (Callable[[], np.ndarray] | None) – The function which returns the centerpoint with respect to which the mobject will be oriented, by default None
- capture_mobjects(mobjects, **kwargs)[source]#
Capture mobjects by printing them on
pixel_array
.This is the essential function that converts the contents of a Scene into an array, which is then converted to an image or video.
- Parameters
mobjects – Mobjects to capture.
kwargs – Keyword arguments to be passed to
get_mobjects_to_display()
.
Notes
For a list of classes that can currently be rendered, see
display_funcs()
.
- generate_rotation_matrix()[source]#
Generates a rotation matrix based off the current position of the camera.
- Returns
The matrix corresponding to the current position of the camera.
- Return type
np.array
- get_fill_rgbas(vmobject)[source]#
Returns the RGBA array of the fill of the passed VMobject
- Parameters
vmobject – The VMobject
- Returns
The RGBA Array of the fill of the VMobject
- Return type
np.array
- get_focal_distance()[source]#
Returns focal_distance of the Camera.
- Returns
The focal_distance of the Camera in MUnits.
- Return type
float
- get_gamma()[source]#
Returns the rotation of the camera about the vector from the ORIGIN to the Camera.
- Returns
The angle of rotation of the camera about the vector from the ORIGIN to the Camera in radians
- Return type
float
- get_mobjects_to_display(*args, **kwargs)[source]#
Used to get the list of mobjects to display with the camera.
- Parameters
mobjects – The Mobjects
include_submobjects – Whether or not to include the submobjects of mobjects, by default True
excluded_mobjects – Any mobjects to exclude, by default None
- Returns
list of mobjects
- Return type
list
- get_phi()[source]#
Returns the Polar angle (the angle off Z_AXIS) phi.
- Returns
The Polar angle in radians.
- Return type
float
- get_rotation_matrix()[source]#
Returns the matrix corresponding to the current position of the camera.
- Returns
The matrix corresponding to the current position of the camera.
- Return type
np.array
- get_stroke_rgbas(vmobject, background=False)[source]#
Gets the RGBA array for the stroke of the passed VMobject.
- Parameters
vmobject – The VMobject
background – Whether or not to consider the background when getting the stroke RGBAs, by default False
- Returns
The RGBA array of the stroke.
- Return type
np.ndarray
- get_theta()[source]#
Returns the Azimuthal i.e the angle that spins the camera around the Z_AXIS.
- Returns
The Azimuthal angle in radians.
- Return type
float
- get_value_trackers()[source]#
A list of
ValueTrackers
of phi, theta, focal_distance, gamma and zoom.- Returns
list of ValueTracker objects
- Return type
list
- get_zoom()[source]#
Returns the zoom amount of the camera.
- Returns
The zoom amount of the camera.
- Return type
float
- project_point(point)[source]#
Applies the current rotation_matrix as a projection matrix to the passed point.
- Parameters
point (list | np.ndarray) – The point to project.
- Returns
The point after projection.
- Return type
np.array
- project_points(points)[source]#
Applies the current rotation_matrix as a projection matrix to the passed array of points.
- Parameters
points (np.ndarray | list) – The list of points to project.
- Returns
The points after projecting.
- Return type
np.array
- remove_fixed_in_frame_mobjects(*mobjects)[source]#
If a mobject was fixed in frame by passing it through
add_fixed_in_frame_mobjects()
, then this undoes that fixing. The Mobject will no longer be fixed in frame.- Parameters
mobjects (Mobject) – The mobjects which need not be fixed in frame any longer.
- remove_fixed_orientation_mobjects(*mobjects)[source]#
If a mobject was fixed in its orientation by passing it through
add_fixed_orientation_mobjects()
, then this undoes that fixing. The Mobject will no longer have a fixed orientation.- Parameters
mobjects (Mobject) – The mobjects whose orientation need not be fixed any longer.
- reset_rotation_matrix()[source]#
Sets the value of self.rotation_matrix to the matrix corresponding to the current position of the camera
- set_focal_distance(value)[source]#
Sets the focal_distance of the Camera.
- Parameters
value (float) – The focal_distance of the Camera.
- set_gamma(value)[source]#
Sets the angle of rotation of the camera about the vector from the ORIGIN to the Camera.
- Parameters
value (float) – The new angle of rotation of the camera.
- set_phi(value)[source]#
Sets the polar angle i.e the angle between Z_AXIS and Camera through ORIGIN in radians.
- Parameters
value (float) – The new value of the polar angle in radians.