manim.camera.three_d_camera.ThreeDCamera

class ThreeDCamera(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, **kwargs)[source]

Bases: manim.camera.camera.Camera

Initializes the ThreeDCamera

Parameters
  • *args – Any argument of Camera

  • *kwargs – Any keyword argument of Camera.

Methods

add_fixed_in_frame_mobjects

This method allows the mobject to have a fixed position, even when the camera moves around.

add_fixed_orientation_mobjects

This method allows the mobject to have a fixed orientation, even when the camera moves around.

capture_mobjects

Capture mobjects by printing them on pixel_array.

generate_rotation_matrix

Generates a rotation matrix based off the current position of the camera.

get_distance

Returns radial distance from ORIGIN.

get_fill_rgbas

Returns the RGBA array of the fill of the passed VMobject

get_gamma

Returns the rotation of the camera about the vector from the ORIGIN to the Camera.

get_mobjects_to_display

Used to get the list of mobjects to display with the camera.

get_phi

Returns the Polar angle (the angle off Z_AXIS) phi.

get_rotation_matrix

Returns the matrix corresponding to the current position of the camera.

get_stroke_rgbas

Gets the RGBA array for the stroke of the passed VMobject.

get_theta

Returns the Azimuthal i.e the angle that spins the camera around the Z_AXIS.

get_value_trackers

Returns list of ValueTrackers of phi, theta, distance and gamma

modified_rgbas

project_point

Applies the current rotation_matrix as a projection matrix to the passed point.

project_points

Applies the current rotation_matrix as a projection matrix to the passed array of points.

remove_fixed_in_frame_mobjects

If a mobject was fixed in frame by passing it through add_fixed_in_frame_mobjects(), then this undoes that fixing.

remove_fixed_orientation_mobjects

If a mobject was fixed in its orientation by passing it through add_fixed_orientation_mobjects(), then this undoes that fixing.

reset_rotation_matrix

Sets the value of self.rotation_matrix to the matrix corresponding to the current position of the camera

set_distance

Sets the radial distance between the camera and ORIGIN.

set_gamma

Sets the angle of rotation of the camera about the vector from the ORIGIN to the Camera.

set_phi

Sets the polar angle i.e the angle between Z_AXIS and Camera through ORIGIN in radians.

set_theta

Sets the azimuthal angle i.e the angle that spins the camera around Z_AXIS in radians.

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, optional) – Whether or not to use the function that takes the mobject’s center as centerpoint, by default False

  • center_func (func, optional) – 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

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_distance()[source]

Returns radial distance from ORIGIN.

Returns

The radial distance from ORIGIN in MUnits.

Return type

float

get_fill_rgbas(vmobject)[source]

Returns the RGBA array of the fill of the passed VMobject

Parameters

vmobject (VMobject) – The VMobject

Returns

The RGBA Array of the fill of the VMobject

Return type

np.array

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 (Mobject) – The Mobjects

  • include_submobjects (bool, optional) – Whether or not to include the submobjects of mobjects, by default True

  • excluded_mobjects (list, optional) – 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 (VMobject) – The VMobject

  • background (bool, optional) – 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]

Returns list of ValueTrackers of phi, theta, distance and gamma

Returns

list of ValueTracker objects

Return type

list

project_point(point)[source]

Applies the current rotation_matrix as a projection matrix to the passed point.

Parameters

point (list, np.array) – 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.array, 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_distance(value)[source]

Sets the radial distance between the camera and ORIGIN.

Parameters

value (int, float) – The new radial distance.

set_gamma(value)[source]

Sets the angle of rotation of the camera about the vector from the ORIGIN to the Camera.

Parameters

value (int, 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 (int, float) – The new value of the polar angle in radians.

set_theta(value)[source]

Sets the azimuthal angle i.e the angle that spins the camera around Z_AXIS in radians.

Parameters

value (int, float) – The new value of the azimuthal angle in radians.