Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manim/_config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ def quality(self):
keys = ["pixel_width", "pixel_height", "frame_rate"]
q = {k: self[k] for k in keys}
for qual in constants.QUALITIES:
if all([q[k] == constants.QUALITIES[qual][k] for k in keys]):
if all(q[k] == constants.QUALITIES[qual][k] for k in keys):
return qual
return None

Expand Down
30 changes: 19 additions & 11 deletions manim/camera/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,10 @@ def display_point_cloud(
thickness: float,
pixel_array: np.ndarray,
):
"""Displays a PMobject by modifying the Pixel array suitably..
"""Displays a PMobject by modifying the pixel array suitably.

TODO: Write a description for the rgbas argument.

Parameters
----------
pmobject
Expand Down Expand Up @@ -1122,17 +1124,19 @@ def on_screen_pixels(self, pixel_coords: np.ndarray):
],
)

def adjusted_thickness(self, thickness: float):
"""
def adjusted_thickness(self, thickness: float) -> float:
"""Computes the adjusted stroke width for a zoomed camera.

Parameters
----------
thickness
The stroke width of a mobject.

Returns
-------
float

The adjusted stroke width that reflects zooming in with
the camera.
"""
# TODO: This seems...unsystematic
big_sum = op.add(config["pixel_height"], config["pixel_width"])
Expand All @@ -1141,7 +1145,8 @@ def adjusted_thickness(self, thickness: float):
return 1 + (thickness - 1) * factor

def get_thickening_nudges(self, thickness: float):
"""
"""Determine a list of vectors used to nudge
two-dimensional pixel coordinates.

Parameters
----------
Expand Down Expand Up @@ -1215,13 +1220,16 @@ def get_coords_of_all_pixels(self):
# NOTE: The methods of the following class have not been mentioned outside of their definitions.
# Their DocStrings are not as detailed as preferred.
class BackgroundColoredVMobjectDisplayer:
"""Auxiliary class that handles displaying vectorized mobjects with
a set background image.

Parameters
----------
camera
Camera object to use.
"""

def __init__(self, camera: Camera):
"""
Parameters
----------
camera
Camera object to use.
"""
self.camera = camera
self.file_name_to_pixel_array_map = {}
self.pixel_array = np.array(camera.pixel_array)
Expand Down
10 changes: 7 additions & 3 deletions manim/mobject/geometry/arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ def __init__(self, width: float = 2, height: float = 1, **kwargs):


class AnnularSector(Arc):
"""
"""A sector of an annulus.


Parameters
----------
inner_radius
Expand Down Expand Up @@ -862,7 +864,8 @@ def generate_points(self):


class Sector(AnnularSector):
"""
"""A sector of a circle.

Examples
--------
.. manim:: ExampleSector
Expand Down Expand Up @@ -935,7 +938,8 @@ def generate_points(self):


class CubicBezier(VMobject, metaclass=ConvertToOpenGL):
"""
"""A cubic Bézier curve.

Example
-------
.. manim:: BezierSplineExample
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/graphing/probability.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@


class SampleSpace(Rectangle):
"""
"""A mobject representing a twodimensional rectangular
sampling space.

Examples
--------
Expand Down
14 changes: 7 additions & 7 deletions manim/mobject/graphing/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@


class _ScaleBase:
"""Scale baseclass for graphing/functions."""
"""Scale baseclass for graphing/functions.

Parameters
----------
custom_labels
Whether to create custom labels when plotted on a :class:`~.NumberLine`.
"""

def __init__(self, custom_labels: bool = False):
"""
Parameters
----------
custom_labels
Whether to create custom labels when plotted on a :class:`~.NumberLine`.
"""
self.custom_labels = custom_labels

def function(self, value: float) -> float:
Expand Down
70 changes: 33 additions & 37 deletions manim/mobject/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ def matrix_to_mobject(matrix):
class Matrix(VMobject, metaclass=ConvertToOpenGL):
"""A mobject that displays a matrix on the screen.

Parameters
----------
matrix
A numpy 2d array or list of lists.
v_buff
Vertical distance between elements, by default 0.8.
h_buff
Horizontal distance between elements, by default 1.3.
bracket_h_buff
Distance of the brackets from the matrix, by default ``MED_SMALL_BUFF``.
bracket_v_buff
Height of the brackets, by default ``MED_SMALL_BUFF``.
add_background_rectangles_to_entries
``True`` if should add backgraound rectangles to entries, by default ``False``.
include_background_rectangle
``True`` if should include background rectangle, by default ``False``.
element_to_mobject
The mobject class used to construct the elements, by default :class:`~.MathTex`.
element_to_mobject_config
Additional arguments to be passed to the constructor in ``element_to_mobject``,
by default ``{}``.
element_alignment_corner
The corner to which elements are aligned, by default ``DR``.
left_bracket
The left bracket type, by default ``"["``.
right_bracket
The right bracket type, by default ``"]"``.
stretch_brackets
``True`` if should stretch the brackets to fit the height of matrix contents, by default ``True``.
bracket_config
Additional arguments to be passed to :class:`~.MathTex` when constructing
the brackets.

Examples
--------
The first example shows a variety of uses of this module while the second example
Expand Down Expand Up @@ -146,43 +179,6 @@ def __init__(
bracket_config: dict = {},
**kwargs,
):
"""

Parameters
----------
matrix
A numpy 2d array or list of lists.
v_buff
Vertical distance between elements, by default 0.8.
h_buff
Horizontal distance between elements, by default 1.3.
bracket_h_buff
Distance of the brackets from the matrix, by default ``MED_SMALL_BUFF``.
bracket_v_buff
Height of the brackets, by default ``MED_SMALL_BUFF``.
add_background_rectangles_to_entries
``True`` if should add backgraound rectangles to entries, by default ``False``.
include_background_rectangle
``True`` if should include background rectangle, by default ``False``.
element_to_mobject
The mobject class used to construct the elements, by default :class:`~.MathTex`.
element_to_mobject_config
Additional arguments to be passed to the constructor in ``element_to_mobject``,
by default ``{}``.
element_alignment_corner
The corner to which elements are aligned, by default ``DR``.
left_bracket
The left bracket type, by default ``"["``.
right_bracket
The right bracket type, by default ``"]"``.
stretch_brackets
``True`` if should stretch the brackets to fit the height of matrix contents, by default ``True``.
bracket_config
Additional arguments to be passed to :class:`~.MathTex` when constructing
the brackets.

"""

self.v_buff = v_buff
self.h_buff = h_buff
self.bracket_h_buff = bracket_h_buff
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/opengl/opengl_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2725,7 +2725,7 @@ def throw_error_if_no_points(self):

class OpenGLGroup(OpenGLMobject):
def __init__(self, *mobjects, **kwargs):
if not all([isinstance(m, OpenGLMobject) for m in mobjects]):
if not all(isinstance(m, OpenGLMobject) for m in mobjects):
raise Exception("All submobjects must be of type OpenGLMobject")
super().__init__(**kwargs)
self.add(*mobjects)
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/opengl/opengl_point_cloud_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def get_mobject_type_class():

class OpenGLPGroup(OpenGLPMobject):
def __init__(self, *pmobs, **kwargs):
if not all([isinstance(m, OpenGLPMobject) for m in pmobs]):
if not all(isinstance(m, OpenGLPMobject) for m in pmobs):
raise Exception("All submobjects must be of type OpenglPMObject")
super().__init__(**kwargs)
self.add(*pmobs)
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/opengl/opengl_vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ def construct(self):
"""

def __init__(self, *vmobjects, **kwargs):
if not all([isinstance(m, OpenGLVMobject) for m in vmobjects]):
if not all(isinstance(m, OpenGLVMobject) for m in vmobjects):
raise Exception("All submobjects must be of type OpenGLVMobject")
super().__init__(**kwargs)
self.add(*vmobjects)
Expand Down
76 changes: 37 additions & 39 deletions manim/mobject/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,43 @@ def construct(self):
class Table(VGroup):
"""A mobject that displays a table on the screen.

Parameters
----------
table
A 2D array or list of lists. Content of the table has to be a valid input
for the callable set in ``element_to_mobject``.
row_labels
List of :class:`~.VMobject` representing the labels of each row.
col_labels
List of :class:`~.VMobject` representing the labels of each column.
top_left_entry
The top-left entry of the table, can only be specified if row and
column labels are given.
v_buff
Vertical buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 0.8.
h_buff
Horizontal buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 1.3.
include_outer_lines
``True`` if the table should include outer lines, by default False.
add_background_rectangles_to_entries
``True`` if background rectangles should be added to entries, by default ``False``.
entries_background_color
Background color of entries if ``add_background_rectangles_to_entries`` is ``True``.
include_background_rectangle
``True`` if the table should have a background rectangle, by default ``False``.
background_rectangle_color
Background color of table if ``include_background_rectangle`` is ``True``.
element_to_mobject
The :class:`~.Mobject` class applied to the table entries. by default :class:`~.Paragraph`. For common choices, see :mod:`~.text_mobject`/:mod:`~.tex_mobject`.
element_to_mobject_config
Custom configuration passed to :attr:`element_to_mobject`, by default {}.
arrange_in_grid_config
Dict passed to :meth:`~.Mobject.arrange_in_grid`, customizes the arrangement of the table.
line_config
Dict passed to :class:`~.Line`, customizes the lines of the table.
kwargs
Additional arguments to be passed to :class:`~.VGroup`.

Examples
--------

Expand Down Expand Up @@ -172,45 +209,6 @@ def __init__(
line_config: dict = {},
**kwargs,
):
"""
Parameters
----------
table
A 2D array or list of lists. Content of the table has to be a valid input
for the callable set in ``element_to_mobject``.
row_labels
List of :class:`~.VMobject` representing the labels of each row.
col_labels
List of :class:`~.VMobject` representing the labels of each column.
top_left_entry
The top-left entry of the table, can only be specified if row and
column labels are given.
v_buff
Vertical buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 0.8.
h_buff
Horizontal buffer passed to :meth:`~.Mobject.arrange_in_grid`, by default 1.3.
include_outer_lines
``True`` if the table should include outer lines, by default False.
add_background_rectangles_to_entries
``True`` if background rectangles should be added to entries, by default ``False``.
entries_background_color
Background color of entries if ``add_background_rectangles_to_entries`` is ``True``.
include_background_rectangle
``True`` if the table should have a background rectangle, by default ``False``.
background_rectangle_color
Background color of table if ``include_background_rectangle`` is ``True``.
element_to_mobject
The :class:`~.Mobject` class applied to the table entries. by default :class:`~.Paragraph`. For common choices, see :mod:`~.text_mobject`/:mod:`~.tex_mobject`.
element_to_mobject_config
Custom configuration passed to :attr:`element_to_mobject`, by default {}.
arrange_in_grid_config
Dict passed to :meth:`~.Mobject.arrange_in_grid`, customizes the arrangement of the table.
line_config
Dict passed to :class:`~.Line`, customizes the lines of the table.
kwargs
Additional arguments to be passed to :class:`~.VGroup`.
"""

self.row_labels = row_labels
self.col_labels = col_labels
self.top_left_entry = top_left_entry
Expand Down
6 changes: 4 additions & 2 deletions manim/mobject/text/tex_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ def __init__(


class BulletedList(Tex):
"""
"""A bulleted list.

Examples
--------

Expand Down Expand Up @@ -508,7 +509,8 @@ def fade_all_but(self, index_or_string, opacity=0.5):


class Title(Tex):
"""
"""A mobject representing an underlined title.

Examples
--------
.. manim:: TitleExample
Expand Down
10 changes: 6 additions & 4 deletions manim/mobject/types/point_cloud_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ def __init__(self, density=DEFAULT_POINT_DENSITY_2D, **kwargs):


class PGroup(PMobject):
"""
"""A group for several point mobjects.

Examples
--------

Expand All @@ -266,7 +267,7 @@ def construct(self):
"""

def __init__(self, *pmobs, **kwargs):
if not all([isinstance(m, (PMobject, OpenGLPMobject)) for m in pmobs]):
if not all(isinstance(m, (PMobject, OpenGLPMobject)) for m in pmobs):
raise ValueError(
"All submobjects must be of type PMobject or OpenGLPMObject"
" if using the opengl renderer",
Expand All @@ -281,7 +282,8 @@ def fade_to(self, color, alpha, family=True):


class PointCloudDot(Mobject1D):
"""A disc made of a cloud of Dots
"""A disc made of a cloud of dots.

Examples
--------
.. manim:: PointCloudDotExample
Expand Down Expand Up @@ -347,7 +349,7 @@ def generate_points(self):


class Point(PMobject):
"""
"""A mobject representing a point.

Examples
--------
Expand Down
Loading