mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Improved structure of the :mod:.mobject module (#2476)
* group graphing and update its references * group text and update its references * group opengl and update its references * group three_d and update its references * group geometry and update (most) references * move some chaning.py + updater files into animation * refactor arc.py * refactor line.py * refactor polygram.py * refactor tips.py * black + isort * import new files in __init__.py * refactor places where geometry was used * black + isort again * remove unused imports * update reference.rst * add descriptions to files * fix circular imports * forgot ArrowTip * fix tests * fix doctests * satisfy mypy? * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix ALL merge conflicts * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * one VMobject import slipped through * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * re-add imports to `manim/opengl/__init__.py` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix reference manual * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ignore unknown directive type * fix arrow tip imports in docstrings Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
This commit is contained in:
parent
99b11da9c5
commit
e040bcacd3
107 changed files with 3707 additions and 3530 deletions
2
.flake8
2
.flake8
|
|
@ -40,4 +40,4 @@ extend-ignore = E203, W503, D202, D212, D213, D404
|
|||
|
||||
# Plug-in: flake8-rst-docstrings
|
||||
RST201, RST203, RST210, RST212, RST213, RST215,
|
||||
RST301,
|
||||
RST301, RST303,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Animations
|
|||
|
||||
.. inheritance-diagram::
|
||||
manim.animation.animation
|
||||
manim.animation.changing
|
||||
manim.animation.composition
|
||||
manim.animation.creation
|
||||
manim.animation.fading
|
||||
|
|
@ -27,7 +28,9 @@ Animations
|
|||
manim.animation.specialized
|
||||
manim.animation.transform
|
||||
manim.animation.transform_matching_parts
|
||||
manim.animation.update
|
||||
manim.animation.updaters.mobject_update_utils
|
||||
manim.animation.updaters.update
|
||||
manim.animation.updaters.value_tracker
|
||||
:parts: 1
|
||||
:top-classes: manim.animation.animation.Animation
|
||||
|
||||
|
|
@ -47,34 +50,36 @@ Mobjects
|
|||
********
|
||||
|
||||
.. inheritance-diagram::
|
||||
manim.mobject.boolean_ops
|
||||
manim.mobject.changing
|
||||
manim.mobject.coordinate_systems
|
||||
manim.mobject.frame
|
||||
manim.mobject.functions
|
||||
manim.mobject.geometry
|
||||
manim.mobject.geometry.arc
|
||||
manim.mobject.geometry.boolean_ops
|
||||
manim.mobject.geometry.line
|
||||
manim.mobject.geometry.polygram
|
||||
manim.mobject.geometry.shape_matchers
|
||||
manim.mobject.geometry.tips
|
||||
manim.mobject.graph
|
||||
manim.mobject.graphing.coordinate_system
|
||||
manim.mobject.graphing.functions
|
||||
manim.mobject.graphing.number_line
|
||||
manim.mobject.graphing.probability
|
||||
manim.mobject.graphing.scale
|
||||
manim.mobject.logo
|
||||
manim.mobject.matrix
|
||||
manim.mobject.mobject
|
||||
manim.mobject.mobject_update_utils
|
||||
manim.mobject.number_line
|
||||
manim.mobject.numbers
|
||||
manim.mobject.probability
|
||||
manim.mobject.shape_matchers
|
||||
manim.mobject.table
|
||||
manim.mobject.three_d_utils
|
||||
manim.mobject.three_dimensions
|
||||
manim.mobject.value_tracker
|
||||
manim.mobject.vector_field
|
||||
manim.mobject.three_d.polyhedra
|
||||
manim.mobject.three_d.three_d_utils
|
||||
manim.mobject.three_d.three_dimensions
|
||||
manim.mobject.svg.brace
|
||||
manim.mobject.svg.code_mobject
|
||||
manim.mobject.svg.svg_mobject
|
||||
manim.mobject.svg.tex_mobject
|
||||
manim.mobject.svg.text_mobject
|
||||
manim.mobject.text.code_mobject
|
||||
manim.mobject.text.tex_mobject
|
||||
manim.mobject.text.text_mobject
|
||||
manim.mobject.text.numbers
|
||||
manim.mobject.types.image_mobject
|
||||
manim.mobject.types.point_cloud_mobject
|
||||
manim.mobject.types.vectorized_mobject
|
||||
manim.mobject.vector_field
|
||||
:parts: 1
|
||||
:top-classes: manim.mobject.mobject.Mobject
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Animations
|
|||
:toctree: ../reference
|
||||
|
||||
~animation.animation
|
||||
~animation.changing
|
||||
~animation.composition
|
||||
~animation.creation
|
||||
~animation.fading
|
||||
|
|
@ -18,4 +19,4 @@ Animations
|
|||
~animation.specialized
|
||||
~animation.transform
|
||||
~animation.transform_matching_parts
|
||||
~animation.update
|
||||
~animation.updaters
|
||||
|
|
|
|||
|
|
@ -6,34 +6,16 @@ Mobjects
|
|||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~mobject.boolean_ops
|
||||
~mobject.changing
|
||||
~mobject.coordinate_systems
|
||||
~mobject.frame
|
||||
~mobject.functions
|
||||
~mobject.geometry
|
||||
~mobject.graph
|
||||
~mobject.graphing
|
||||
~mobject.logo
|
||||
~mobject.matrix
|
||||
~mobject.mobject
|
||||
~mobject.mobject_update_utils
|
||||
~mobject.number_line
|
||||
~mobject.numbers
|
||||
~mobject.polyhedra
|
||||
~mobject.probability
|
||||
~mobject.shape_matchers
|
||||
~mobject.svg
|
||||
~mobject.table
|
||||
~mobject.three_d_utils
|
||||
~mobject.three_dimensions
|
||||
~mobject.value_tracker
|
||||
~mobject.text
|
||||
~mobject.three_d
|
||||
~mobject.types
|
||||
~mobject.vector_field
|
||||
~mobject.svg.brace
|
||||
~mobject.svg.code_mobject
|
||||
~mobject.svg.style_utils
|
||||
~mobject.svg.svg_path
|
||||
~mobject.svg.svg_mobject
|
||||
~mobject.svg.tex_mobject
|
||||
~mobject.svg.text_mobject
|
||||
~mobject.types.image_mobject
|
||||
~mobject.types.point_cloud_mobject
|
||||
~mobject.types.vectorized_mobject
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ Module Index
|
|||
~utils.iterables
|
||||
~utils.paths
|
||||
~utils.rate_functions
|
||||
~utils.scale
|
||||
~utils.simple_functions
|
||||
~utils.sounds
|
||||
~utils.space_ops
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ for i, arg in enumerate(sys.argv):
|
|||
from .utils.commands import * # isort:skip
|
||||
|
||||
from .animation.animation import *
|
||||
from .animation.changing import *
|
||||
from .animation.composition import *
|
||||
from .animation.creation import *
|
||||
from .animation.fading import *
|
||||
|
|
@ -45,43 +46,46 @@ from .animation.rotation import *
|
|||
from .animation.specialized import *
|
||||
from .animation.transform import *
|
||||
from .animation.transform_matching_parts import *
|
||||
from .animation.update import *
|
||||
from .animation.updaters.mobject_update_utils import *
|
||||
from .animation.updaters.update import *
|
||||
from .animation.updaters.value_tracker import *
|
||||
from .camera.camera import *
|
||||
from .camera.mapping_camera import *
|
||||
from .camera.moving_camera import *
|
||||
from .camera.multi_camera import *
|
||||
from .camera.three_d_camera import *
|
||||
from .constants import *
|
||||
from .mobject.boolean_ops import *
|
||||
from .mobject.changing import *
|
||||
from .mobject.coordinate_systems import *
|
||||
from .mobject.frame import *
|
||||
from .mobject.functions import *
|
||||
from .mobject.geometry import *
|
||||
from .mobject.geometry.arc import *
|
||||
from .mobject.geometry.boolean_ops import *
|
||||
from .mobject.geometry.line import *
|
||||
from .mobject.geometry.polygram import *
|
||||
from .mobject.geometry.shape_matchers import *
|
||||
from .mobject.geometry.tips import *
|
||||
from .mobject.graph import *
|
||||
from .mobject.graphing.coordinate_systems import *
|
||||
from .mobject.graphing.functions import *
|
||||
from .mobject.graphing.number_line import *
|
||||
from .mobject.graphing.probability import *
|
||||
from .mobject.graphing.scale import *
|
||||
from .mobject.logo import *
|
||||
from .mobject.matrix import *
|
||||
from .mobject.mobject import *
|
||||
from .mobject.mobject_update_utils import *
|
||||
from .mobject.number_line import *
|
||||
from .mobject.numbers import *
|
||||
from .mobject.polyhedra import *
|
||||
from .mobject.probability import *
|
||||
from .mobject.shape_matchers import *
|
||||
from .mobject.opengl.dot_cloud import *
|
||||
from .mobject.opengl.opengl_point_cloud_mobject import *
|
||||
from .mobject.svg.brace import *
|
||||
from .mobject.svg.code_mobject import *
|
||||
from .mobject.svg.svg_mobject import *
|
||||
from .mobject.svg.tex_mobject import *
|
||||
from .mobject.svg.text_mobject import *
|
||||
from .mobject.table import *
|
||||
from .mobject.three_d_utils import *
|
||||
from .mobject.three_dimensions import *
|
||||
from .mobject.types.dot_cloud import *
|
||||
from .mobject.text.code_mobject import *
|
||||
from .mobject.text.numbers import *
|
||||
from .mobject.text.tex_mobject import *
|
||||
from .mobject.text.text_mobject import *
|
||||
from .mobject.three_d.polyhedra import *
|
||||
from .mobject.three_d.three_d_utils import *
|
||||
from .mobject.three_d.three_dimensions import *
|
||||
from .mobject.types.image_mobject import *
|
||||
from .mobject.types.opengl_point_cloud_mobject import *
|
||||
from .mobject.types.point_cloud_mobject import *
|
||||
from .mobject.types.vectorized_mobject import *
|
||||
from .mobject.value_tracker import *
|
||||
from .mobject.vector_field import *
|
||||
from .renderer.cairo_renderer import *
|
||||
from .scene.moving_camera_scene import *
|
||||
|
|
@ -101,7 +105,6 @@ from .utils.images import *
|
|||
from .utils.iterables import *
|
||||
from .utils.paths import *
|
||||
from .utils.rate_functions import *
|
||||
from .utils.scale import *
|
||||
from .utils.simple_functions import *
|
||||
from .utils.sounds import *
|
||||
from .utils.space_ops import *
|
||||
|
|
|
|||
|
|
@ -1188,10 +1188,11 @@ class ManimConfig(MutableMapping):
|
|||
def renderer(self, val: str) -> None:
|
||||
"""Renderer for animations."""
|
||||
try:
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.opengl_compatibility import ConvertToOpenGL
|
||||
from ..mobject.opengl_mobject import OpenGLMobject
|
||||
from ..mobject.types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from ..mobject.types.vectorized_mobject import VMobject
|
||||
|
||||
for cls in ConvertToOpenGL._converted_classes:
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
|
||||
from .. import config, logger
|
||||
from ..mobject import mobject, opengl_mobject
|
||||
from ..mobject import mobject
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLMobject
|
||||
from ..mobject.opengl import opengl_mobject
|
||||
from ..utils.rate_functions import smooth
|
||||
|
||||
__all__ = ["Animation", "Wait", "override_animation"]
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ from typing import Callable
|
|||
|
||||
from colour import Color
|
||||
|
||||
from .._config import config
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.color import BLUE_B, BLUE_D, BLUE_E, GREY_BROWN, WHITE
|
||||
from ..utils.rate_functions import smooth
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
from manim._config import config
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.utils.color import BLUE_B, BLUE_D, BLUE_E, GREY_BROWN, WHITE
|
||||
from manim.utils.rate_functions import smooth
|
||||
|
||||
|
||||
class AnimatedBoundary(VGroup):
|
||||
|
|
@ -7,16 +7,18 @@ from typing import TYPE_CHECKING, Callable, Sequence
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLGroup
|
||||
|
||||
from .._config import config
|
||||
from ..animation.animation import Animation, prepare_animation
|
||||
from ..mobject.mobject import Group, Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLGroup
|
||||
from ..scene.scene import Scene
|
||||
from ..utils.iterables import remove_list_redundancies
|
||||
from ..utils.rate_functions import linear
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..mobject.types.opengl_vectorized_mobject import OpenGLVGroup
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVGroup
|
||||
|
||||
from ..mobject.types.vectorized_mobject import VGroup
|
||||
|
||||
__all__ = ["AnimationGroup", "Succession", "LaggedStart", "LaggedStartMap"]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import annotations
|
||||
|
||||
r"""Animate the display or removal of a mobject from a scene.
|
||||
|
||||
.. manim:: CreationModule
|
||||
|
|
@ -57,6 +55,7 @@ r"""Animate the display or removal of a mobject from a scene.
|
|||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"Create",
|
||||
|
|
@ -79,13 +78,14 @@ import numpy as np
|
|||
from colour import Color
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manim.mobject.svg.text_mobject import Text
|
||||
from manim.mobject.text.text_mobject import Text
|
||||
|
||||
from manim.mobject.opengl.opengl_surface import OpenGLSurface
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
from ..animation.animation import Animation
|
||||
from ..animation.composition import Succession
|
||||
from ..mobject.mobject import Group, Mobject
|
||||
from ..mobject.types.opengl_surface import OpenGLSurface
|
||||
from ..mobject.types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from ..mobject.types.vectorized_mobject import VMobject
|
||||
from ..utils.bezier import integer_interpolate
|
||||
from ..utils.rate_functions import double_smooth, linear, smooth
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ __all__ = [
|
|||
"FadeIn",
|
||||
]
|
||||
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
|
||||
from ..animation.transform import Transform
|
||||
from ..constants import ORIGIN
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ from ..constants import PI
|
|||
from ..utils.paths import spiral_path
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from ..mobject.geometry import Arrow
|
||||
from manim.mobject.geometry.line import Arrow
|
||||
|
||||
from ..mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ from typing import Callable, Iterable, Optional, Tuple, Type, Union
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.geometry.arc import Circle, Dot
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import Rectangle
|
||||
from manim.mobject.geometry.shape_matchers import SurroundingRectangle
|
||||
|
||||
from .. import config
|
||||
from ..animation.animation import Animation
|
||||
from ..animation.composition import AnimationGroup, Succession
|
||||
|
|
@ -50,9 +55,7 @@ from ..animation.fading import FadeIn, FadeOut
|
|||
from ..animation.movement import Homotopy
|
||||
from ..animation.transform import Transform
|
||||
from ..constants import *
|
||||
from ..mobject.geometry import Circle, Dot, Line, Rectangle
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.shape_matchers import SurroundingRectangle
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.bezier import interpolate, inverse_interpolate
|
||||
from ..utils.color import GREY, YELLOW
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from ..animation.animation import Animation
|
|||
from ..utils.rate_functions import linear
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.mobject import Mobject, VMobject
|
||||
|
||||
|
||||
class Homotopy(Animation):
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ __all__ = ["ChangingDecimal", "ChangeDecimalToValue"]
|
|||
|
||||
import typing
|
||||
|
||||
from manim.mobject.text.numbers import DecimalNumber
|
||||
|
||||
from ..animation.animation import Animation
|
||||
from ..mobject.numbers import DecimalNumber
|
||||
from ..utils.bezier import interpolate
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ from __future__ import annotations
|
|||
|
||||
__all__ = ["Rotating", "Rotate"]
|
||||
|
||||
import typing
|
||||
from typing import Callable, Sequence
|
||||
from typing import TYPE_CHECKING, Callable, Sequence
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
|
@ -14,7 +13,7 @@ from ..animation.transform import Transform
|
|||
from ..constants import OUT, PI, TAU
|
||||
from ..utils.rate_functions import linear
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
if TYPE_CHECKING:
|
||||
from ..mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,12 @@ from typing import TYPE_CHECKING, Any, Callable, Iterable, Sequence
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLGroup, OpenGLMobject
|
||||
|
||||
from .. import config
|
||||
from ..animation.animation import Animation
|
||||
from ..constants import DEFAULT_POINTWISE_FUNCTION_RUN_TIME, DEGREES, ORIGIN, OUT
|
||||
from ..mobject.mobject import Group, Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLGroup, OpenGLMobject
|
||||
from ..utils.paths import path_along_arc, path_along_circles
|
||||
from ..utils.rate_functions import smooth, squish_rate_func
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@ from typing import TYPE_CHECKING
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLGroup, OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVGroup, OpenGLVMobject
|
||||
|
||||
from .._config import config
|
||||
from ..mobject.mobject import Group, Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLGroup, OpenGLMobject
|
||||
from ..mobject.types.opengl_vectorized_mobject import OpenGLVGroup, OpenGLVMobject
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from .composition import AnimationGroup
|
||||
from .fading import FadeIn, FadeOut
|
||||
|
|
|
|||
12
manim/animation/updaters/__init__.py
Normal file
12
manim/animation/updaters/__init__.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"""Animations and utility mobjects related to update functions.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~mobject_update_utils
|
||||
~update
|
||||
~value_tracker
|
||||
"""
|
||||
|
|
@ -18,8 +18,8 @@ import inspect
|
|||
|
||||
import numpy as np
|
||||
|
||||
from ..constants import DEGREES, RIGHT
|
||||
from ..mobject.mobject import Mobject
|
||||
from manim.constants import DEGREES, RIGHT
|
||||
from manim.mobject.mobject import Mobject
|
||||
|
||||
|
||||
def assert_is_mobject_method(method):
|
||||
|
|
@ -8,10 +8,10 @@ __all__ = ["UpdateFromFunc", "UpdateFromAlphaFunc", "MaintainPositionRelativeTo"
|
|||
import operator as op
|
||||
import typing
|
||||
|
||||
from ..animation.animation import Animation
|
||||
from manim.animation.animation import Animation
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from ..mobject.mobject import Mobject
|
||||
from manim.mobject.mobject import Mobject
|
||||
|
||||
|
||||
class UpdateFromFunc(Animation):
|
||||
|
|
@ -7,9 +7,9 @@ __all__ = ["ValueTracker", "ComplexValueTracker"]
|
|||
|
||||
import numpy as np
|
||||
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..utils.paths import straight_path
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.mobject import Mobject
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.utils.paths import straight_path
|
||||
|
||||
|
||||
class ValueTracker(Mobject, metaclass=ConvertToOpenGL):
|
||||
|
|
@ -7,17 +7,18 @@ __all__ = ["ThreeDCamera"]
|
|||
|
||||
import numpy as np
|
||||
|
||||
from .. import config
|
||||
from ..camera.camera import Camera
|
||||
from ..constants import *
|
||||
from ..mobject.three_d_utils import (
|
||||
from manim.animation.updaters.value_tracker import ValueTracker
|
||||
from manim.mobject.three_d.three_d_utils import (
|
||||
get_3d_vmob_end_corner,
|
||||
get_3d_vmob_end_corner_unit_normal,
|
||||
get_3d_vmob_start_corner,
|
||||
get_3d_vmob_start_corner_unit_normal,
|
||||
)
|
||||
|
||||
from .. import config
|
||||
from ..camera.camera import Camera
|
||||
from ..constants import *
|
||||
from ..mobject.types.point_cloud_mobject import Point
|
||||
from ..mobject.value_tracker import ValueTracker
|
||||
from ..utils.color import get_shaded_rgb
|
||||
from ..utils.family import extract_mobject_family_members
|
||||
from ..utils.space_ops import rotation_about_z, rotation_matrix
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import click
|
||||
from cloup import option, option_group
|
||||
|
||||
from ... import logger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cloup._option_groups import OptionGroupDecorator
|
||||
|
||||
|
||||
def validate_gui_location(ctx, param, value):
|
||||
if value:
|
||||
|
|
@ -18,7 +22,7 @@ def validate_gui_location(ctx, param, value):
|
|||
exit()
|
||||
|
||||
|
||||
global_options = option_group(
|
||||
global_options: OptionGroupDecorator = option_group(
|
||||
"Global options",
|
||||
option(
|
||||
"-c",
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@ from concurrent import futures
|
|||
|
||||
import grpc
|
||||
|
||||
from manim.animation.updaters.value_tracker import ValueTracker
|
||||
|
||||
from ... import config, logger
|
||||
from ...constants import WEBGL_RENDERER_INFO
|
||||
from ...mobject.types.image_mobject import ImageMobject
|
||||
from ...mobject.types.vectorized_mobject import VMobject
|
||||
from ...mobject.value_tracker import ValueTracker
|
||||
from ...renderer.webgl_renderer import WebGLRenderer
|
||||
from ...utils.family import extract_mobject_family_members
|
||||
from ...utils.module_ops import scene_classes_from_file
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ __all__ = [
|
|||
]
|
||||
|
||||
|
||||
from manim.mobject.geometry.polygram import Rectangle
|
||||
|
||||
from .. import config
|
||||
from ..mobject.geometry import Rectangle
|
||||
|
||||
|
||||
class ScreenRectangle(Rectangle):
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
15
manim/mobject/geometry/__init__.py
Normal file
15
manim/mobject/geometry/__init__.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"""Various geometric Mobjects.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~arc
|
||||
~boolean_ops
|
||||
~line
|
||||
~polygram
|
||||
~shape_matchers
|
||||
~tips
|
||||
"""
|
||||
1195
manim/mobject/geometry/arc.py
Normal file
1195
manim/mobject/geometry/arc.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +1,5 @@
|
|||
"""Boolean operations for two-dimensional mobjects."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import typing
|
||||
|
|
@ -6,9 +8,9 @@ import numpy as np
|
|||
from pathops import Path as SkiaPath
|
||||
from pathops import PathVerb, difference, intersection, union, xor
|
||||
|
||||
from .. import config
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
from .types.vectorized_mobject import VMobject
|
||||
from manim import config
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.types.vectorized_mobject import VMobject
|
||||
|
||||
__all__ = ["Union", "Intersection", "Difference", "Exclusion"]
|
||||
|
||||
1066
manim/mobject/geometry/line.py
Normal file
1066
manim/mobject/geometry/line.py
Normal file
File diff suppressed because it is too large
Load diff
694
manim/mobject/geometry/polygram.py
Normal file
694
manim/mobject/geometry/polygram.py
Normal file
|
|
@ -0,0 +1,694 @@
|
|||
r"""Mobjects that are simple geometric shapes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"Polygram",
|
||||
"Polygon",
|
||||
"RegularPolygram",
|
||||
"RegularPolygon",
|
||||
"Star",
|
||||
"Triangle",
|
||||
"Rectangle",
|
||||
"Square",
|
||||
"RoundedRectangle",
|
||||
"Cutout",
|
||||
]
|
||||
|
||||
from typing import Iterable, Sequence
|
||||
|
||||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.arc import ArcBetweenPoints
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.utils.color import *
|
||||
from manim.utils.iterables import adjacent_n_tuples, adjacent_pairs
|
||||
from manim.utils.space_ops import angle_between_vectors, normalize, regular_vertices
|
||||
|
||||
|
||||
class Polygram(VMobject, metaclass=ConvertToOpenGL):
|
||||
"""A generalized :class:`Polygon`, allowing for disconnected sets of edges.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
vertex_groups
|
||||
The groups of vertices making up the :class:`Polygram`.
|
||||
|
||||
The first vertex in each group is repeated to close the shape.
|
||||
Each point must be 3-dimensional: ``[x,y,z]``
|
||||
color
|
||||
The color of the :class:`Polygram`.
|
||||
kwargs
|
||||
Forwarded to the parent constructor.
|
||||
|
||||
Examples
|
||||
--------
|
||||
.. manim:: PolygramExample
|
||||
|
||||
import numpy as np
|
||||
|
||||
class PolygramExample(Scene):
|
||||
def construct(self):
|
||||
hexagram = Polygram(
|
||||
[[0, 2, 0], [-np.sqrt(3), -1, 0], [np.sqrt(3), -1, 0]],
|
||||
[[-np.sqrt(3), 1, 0], [0, -2, 0], [np.sqrt(3), 1, 0]],
|
||||
)
|
||||
self.add(hexagram)
|
||||
|
||||
dot = Dot()
|
||||
self.play(MoveAlongPath(dot, hexagram), run_time=5, rate_func=linear)
|
||||
self.remove(dot)
|
||||
self.wait()
|
||||
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, *vertex_groups: Iterable[Sequence[float]], color=BLUE, **kwargs):
|
||||
super().__init__(color=color, **kwargs)
|
||||
|
||||
for vertices in vertex_groups:
|
||||
first_vertex, *vertices = vertices
|
||||
first_vertex = np.array(first_vertex)
|
||||
|
||||
self.start_new_path(first_vertex)
|
||||
self.add_points_as_corners(
|
||||
[*(np.array(vertex) for vertex in vertices), first_vertex],
|
||||
)
|
||||
|
||||
def get_vertices(self) -> np.ndarray:
|
||||
"""Gets the vertices of the :class:`Polygram`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`numpy.ndarray`
|
||||
The vertices of the :class:`Polygram`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> sq = Square()
|
||||
>>> sq.get_vertices()
|
||||
array([[ 1., 1., 0.],
|
||||
[-1., 1., 0.],
|
||||
[-1., -1., 0.],
|
||||
[ 1., -1., 0.]])
|
||||
"""
|
||||
|
||||
return self.get_start_anchors()
|
||||
|
||||
def get_vertex_groups(self) -> np.ndarray:
|
||||
"""Gets the vertex groups of the :class:`Polygram`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`numpy.ndarray`
|
||||
The vertex groups of the :class:`Polygram`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> poly = Polygram([ORIGIN, RIGHT, UP], [LEFT, LEFT + UP, 2 * LEFT])
|
||||
>>> poly.get_vertex_groups()
|
||||
array([[[ 0., 0., 0.],
|
||||
[ 1., 0., 0.],
|
||||
[ 0., 1., 0.]],
|
||||
<BLANKLINE>
|
||||
[[-1., 0., 0.],
|
||||
[-1., 1., 0.],
|
||||
[-2., 0., 0.]]])
|
||||
"""
|
||||
|
||||
vertex_groups = []
|
||||
|
||||
group = []
|
||||
for start, end in zip(self.get_start_anchors(), self.get_end_anchors()):
|
||||
group.append(start)
|
||||
|
||||
if self.consider_points_equals(end, group[0]):
|
||||
vertex_groups.append(group)
|
||||
group = []
|
||||
|
||||
return np.array(vertex_groups)
|
||||
|
||||
def round_corners(self, radius: float = 0.5):
|
||||
"""Rounds off the corners of the :class:`Polygram`.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
radius
|
||||
The curvature of the corners of the :class:`Polygram`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: PolygramRoundCorners
|
||||
:save_last_frame:
|
||||
|
||||
class PolygramRoundCorners(Scene):
|
||||
def construct(self):
|
||||
star = Star(outer_radius=2)
|
||||
|
||||
shapes = VGroup(star)
|
||||
shapes.add(star.copy().round_corners(radius=0.1))
|
||||
shapes.add(star.copy().round_corners(radius=0.25))
|
||||
|
||||
shapes.arrange(RIGHT)
|
||||
self.add(shapes)
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`RoundedRectangle`
|
||||
"""
|
||||
|
||||
if radius == 0:
|
||||
return self
|
||||
|
||||
new_points = []
|
||||
|
||||
for vertices in self.get_vertex_groups():
|
||||
arcs = []
|
||||
for v1, v2, v3 in adjacent_n_tuples(vertices, 3):
|
||||
vect1 = v2 - v1
|
||||
vect2 = v3 - v2
|
||||
unit_vect1 = normalize(vect1)
|
||||
unit_vect2 = normalize(vect2)
|
||||
|
||||
angle = angle_between_vectors(vect1, vect2)
|
||||
# Negative radius gives concave curves
|
||||
angle *= np.sign(radius)
|
||||
|
||||
# Distance between vertex and start of the arc
|
||||
cut_off_length = radius * np.tan(angle / 2)
|
||||
|
||||
# Determines counterclockwise vs. clockwise
|
||||
sign = np.sign(np.cross(vect1, vect2)[2])
|
||||
|
||||
arc = ArcBetweenPoints(
|
||||
v2 - unit_vect1 * cut_off_length,
|
||||
v2 + unit_vect2 * cut_off_length,
|
||||
angle=sign * angle,
|
||||
)
|
||||
arcs.append(arc)
|
||||
|
||||
# To ensure that we loop through starting with last
|
||||
arcs = [arcs[-1], *arcs[:-1]]
|
||||
from manim.mobject.geometry.line import Line
|
||||
|
||||
for arc1, arc2 in adjacent_pairs(arcs):
|
||||
new_points.extend(arc1.points)
|
||||
|
||||
line = Line(arc1.get_end(), arc2.get_start())
|
||||
|
||||
# Make sure anchors are evenly distributed
|
||||
len_ratio = line.get_length() / arc1.get_arc_length()
|
||||
|
||||
line.insert_n_curves(int(arc1.get_num_curves() * len_ratio))
|
||||
|
||||
new_points.extend(line.points)
|
||||
|
||||
self.set_points(new_points)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
class Polygon(Polygram):
|
||||
"""A shape consisting of one closed loop of vertices.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
vertices
|
||||
The vertices of the :class:`Polygon`.
|
||||
kwargs
|
||||
Forwarded to the parent constructor.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: PolygonExample
|
||||
:save_last_frame:
|
||||
|
||||
class PolygonExample(Scene):
|
||||
def construct(self):
|
||||
isosceles = Polygon([-5, 1.5, 0], [-2, 1.5, 0], [-3.5, -2, 0])
|
||||
position_list = [
|
||||
[4, 1, 0], # middle right
|
||||
[4, -2.5, 0], # bottom right
|
||||
[0, -2.5, 0], # bottom left
|
||||
[0, 3, 0], # top left
|
||||
[2, 1, 0], # middle
|
||||
[4, 3, 0], # top right
|
||||
]
|
||||
square_and_triangles = Polygon(*position_list, color=PURPLE_B)
|
||||
self.add(isosceles, square_and_triangles)
|
||||
"""
|
||||
|
||||
def __init__(self, *vertices: Sequence[float], **kwargs):
|
||||
super().__init__(vertices, **kwargs)
|
||||
|
||||
|
||||
class RegularPolygram(Polygram):
|
||||
"""A :class:`Polygram` with regularly spaced vertices.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
num_vertices
|
||||
The number of vertices.
|
||||
density
|
||||
The density of the :class:`RegularPolygram`.
|
||||
|
||||
Can be thought of as how many vertices to hop
|
||||
to draw a line between them. Every ``density``-th
|
||||
vertex is connected.
|
||||
radius
|
||||
The radius of the circle that the vertices are placed on.
|
||||
start_angle
|
||||
The angle the vertices start at; the rotation of
|
||||
the :class:`RegularPolygram`.
|
||||
kwargs
|
||||
Forwarded to the parent constructor.
|
||||
|
||||
Examples
|
||||
--------
|
||||
.. manim:: RegularPolygramExample
|
||||
:save_last_frame:
|
||||
|
||||
class RegularPolygramExample(Scene):
|
||||
def construct(self):
|
||||
pentagram = RegularPolygram(5, radius=2)
|
||||
self.add(pentagram)
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
num_vertices: int,
|
||||
*,
|
||||
density: int = 2,
|
||||
radius: float = 1,
|
||||
start_angle: float | None = None,
|
||||
**kwargs,
|
||||
):
|
||||
# Regular polygrams can be expressed by the number of their vertices
|
||||
# and their density. This relation can be expressed as its Schläfli
|
||||
# symbol: {num_vertices/density}.
|
||||
#
|
||||
# For instance, a pentagon can be expressed as {5/1} or just {5}.
|
||||
# A pentagram, however, can be expressed as {5/2}.
|
||||
# A hexagram *would* be expressed as {6/2}, except that 6 and 2
|
||||
# are not coprime, and it can be simplified to 2{3}, which corresponds
|
||||
# to the fact that a hexagram is actually made up of 2 triangles.
|
||||
#
|
||||
# See https://en.wikipedia.org/wiki/Polygram_(geometry)#Generalized_regular_polygons
|
||||
# for more information.
|
||||
|
||||
num_gons = np.gcd(num_vertices, density)
|
||||
num_vertices //= num_gons
|
||||
density //= num_gons
|
||||
|
||||
# Utility function for generating the individual
|
||||
# polygon vertices.
|
||||
def gen_polygon_vertices(start_angle):
|
||||
reg_vertices, start_angle = regular_vertices(
|
||||
num_vertices,
|
||||
radius=radius,
|
||||
start_angle=start_angle,
|
||||
)
|
||||
|
||||
vertices = []
|
||||
i = 0
|
||||
while True:
|
||||
vertices.append(reg_vertices[i])
|
||||
|
||||
i += density
|
||||
i %= num_vertices
|
||||
if i == 0:
|
||||
break
|
||||
|
||||
return vertices, start_angle
|
||||
|
||||
first_group, self.start_angle = gen_polygon_vertices(start_angle)
|
||||
vertex_groups = [first_group]
|
||||
|
||||
for i in range(1, num_gons):
|
||||
start_angle = self.start_angle + (i / num_gons) * TAU / num_vertices
|
||||
group, _ = gen_polygon_vertices(start_angle)
|
||||
|
||||
vertex_groups.append(group)
|
||||
|
||||
super().__init__(*vertex_groups, **kwargs)
|
||||
|
||||
|
||||
class RegularPolygon(RegularPolygram):
|
||||
"""An n-sided regular :class:`Polygon`.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
n
|
||||
The number of sides of the :class:`RegularPolygon`.
|
||||
kwargs
|
||||
Forwarded to the parent constructor.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: RegularPolygonExample
|
||||
:save_last_frame:
|
||||
|
||||
class RegularPolygonExample(Scene):
|
||||
def construct(self):
|
||||
poly_1 = RegularPolygon(n=6)
|
||||
poly_2 = RegularPolygon(n=6, start_angle=30*DEGREES, color=GREEN)
|
||||
poly_3 = RegularPolygon(n=10, color=RED)
|
||||
|
||||
poly_group = Group(poly_1, poly_2, poly_3).scale(1.5).arrange(buff=1)
|
||||
self.add(poly_group)
|
||||
"""
|
||||
|
||||
def __init__(self, n: int = 6, **kwargs):
|
||||
super().__init__(n, density=1, **kwargs)
|
||||
|
||||
|
||||
class Star(Polygon):
|
||||
"""A regular polygram without the intersecting lines.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
n
|
||||
How many points on the :class:`Star`.
|
||||
outer_radius
|
||||
The radius of the circle that the outer vertices are placed on.
|
||||
inner_radius
|
||||
The radius of the circle that the inner vertices are placed on.
|
||||
|
||||
If unspecified, the inner radius will be
|
||||
calculated such that the edges of the :class:`Star`
|
||||
perfectly follow the edges of its :class:`RegularPolygram`
|
||||
counterpart.
|
||||
density
|
||||
The density of the :class:`Star`. Only used if
|
||||
``inner_radius`` is unspecified.
|
||||
|
||||
See :class:`RegularPolygram` for more information.
|
||||
start_angle
|
||||
The angle the vertices start at; the rotation of
|
||||
the :class:`Star`.
|
||||
kwargs
|
||||
Forwardeds to the parent constructor.
|
||||
|
||||
Raises
|
||||
------
|
||||
:exc:`ValueError`
|
||||
If ``inner_radius`` is unspecified and ``density``
|
||||
is not in the range ``[1, n/2)``.
|
||||
|
||||
Examples
|
||||
--------
|
||||
.. manim:: StarExample
|
||||
:save_as_gif:
|
||||
|
||||
class StarExample(Scene):
|
||||
def construct(self):
|
||||
pentagram = RegularPolygram(5, radius=2)
|
||||
star = Star(outer_radius=2, color=RED)
|
||||
|
||||
self.add(pentagram)
|
||||
self.play(Create(star), run_time=3)
|
||||
self.play(FadeOut(star), run_time=2)
|
||||
|
||||
.. manim:: DifferentDensitiesExample
|
||||
:save_last_frame:
|
||||
|
||||
class DifferentDensitiesExample(Scene):
|
||||
def construct(self):
|
||||
density_2 = Star(7, outer_radius=2, density=2, color=RED)
|
||||
density_3 = Star(7, outer_radius=2, density=3, color=PURPLE)
|
||||
|
||||
self.add(VGroup(density_2, density_3).arrange(RIGHT))
|
||||
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
n: int = 5,
|
||||
*,
|
||||
outer_radius: float = 1,
|
||||
inner_radius: float | None = None,
|
||||
density: int = 2,
|
||||
start_angle: float | None = TAU / 4,
|
||||
**kwargs,
|
||||
):
|
||||
inner_angle = TAU / (2 * n)
|
||||
|
||||
if inner_radius is None:
|
||||
# See https://math.stackexchange.com/a/2136292 for an
|
||||
# overview of how to calculate the inner radius of a
|
||||
# perfect star.
|
||||
|
||||
if density <= 0 or density >= n / 2:
|
||||
raise ValueError(
|
||||
f"Incompatible density {density} for number of points {n}",
|
||||
)
|
||||
|
||||
outer_angle = TAU * density / n
|
||||
inverse_x = 1 - np.tan(inner_angle) * (
|
||||
(np.cos(outer_angle) - 1) / np.sin(outer_angle)
|
||||
)
|
||||
|
||||
inner_radius = outer_radius / (np.cos(inner_angle) * inverse_x)
|
||||
|
||||
outer_vertices, self.start_angle = regular_vertices(
|
||||
n,
|
||||
radius=outer_radius,
|
||||
start_angle=start_angle,
|
||||
)
|
||||
inner_vertices, _ = regular_vertices(
|
||||
n,
|
||||
radius=inner_radius,
|
||||
start_angle=self.start_angle + inner_angle,
|
||||
)
|
||||
|
||||
vertices = []
|
||||
for pair in zip(outer_vertices, inner_vertices):
|
||||
vertices.extend(pair)
|
||||
|
||||
super().__init__(*vertices, **kwargs)
|
||||
|
||||
|
||||
class Triangle(RegularPolygon):
|
||||
"""An equilateral triangle.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
kwargs : Any
|
||||
Additional arguments to be passed to :class:`RegularPolygon`
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: TriangleExample
|
||||
:save_last_frame:
|
||||
|
||||
class TriangleExample(Scene):
|
||||
def construct(self):
|
||||
triangle_1 = Triangle()
|
||||
triangle_2 = Triangle().scale(2).rotate(60*DEGREES)
|
||||
tri_group = Group(triangle_1, triangle_2).arrange(buff=1)
|
||||
self.add(tri_group)
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(n=3, **kwargs)
|
||||
|
||||
|
||||
class Rectangle(Polygon):
|
||||
"""A quadrilateral with two sets of parallel sides.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
color : :class:`~.Colors`, optional
|
||||
The color of the rectangle.
|
||||
height : :class:`float`, optional
|
||||
The vertical height of the rectangle.
|
||||
width : :class:`float`, optional
|
||||
The horizontal width of the rectangle.
|
||||
grid_xstep : :class:`float`, optional
|
||||
Space between vertical grid lines.
|
||||
grid_ystep : :class:`float`, optional
|
||||
Space between horizontal grid lines.
|
||||
mark_paths_closed : :class:`bool`, optional
|
||||
No purpose.
|
||||
close_new_points : :class:`bool`, optional
|
||||
No purpose.
|
||||
kwargs : Any
|
||||
Additional arguments to be passed to :class:`Polygon`
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
.. manim:: RectangleExample
|
||||
:save_last_frame:
|
||||
|
||||
class RectangleExample(Scene):
|
||||
def construct(self):
|
||||
rect1 = Rectangle(width=4.0, height=2.0, grid_xstep=1.0, grid_ystep=0.5)
|
||||
rect2 = Rectangle(width=1.0, height=4.0)
|
||||
|
||||
rects = Group(rect1,rect2).arrange(buff=1)
|
||||
self.add(rects)
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
color: Color = WHITE,
|
||||
height: float = 2.0,
|
||||
width: float = 4.0,
|
||||
grid_xstep: float | None = None,
|
||||
grid_ystep: float | None = None,
|
||||
mark_paths_closed=True,
|
||||
close_new_points=True,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(UR, UL, DL, DR, color=color, **kwargs)
|
||||
self.stretch_to_fit_width(width)
|
||||
self.stretch_to_fit_height(height)
|
||||
v = self.get_vertices()
|
||||
if grid_xstep is not None:
|
||||
from manim.mobject.geometry.line import Line
|
||||
|
||||
grid_xstep = abs(grid_xstep)
|
||||
count = int(width / grid_xstep)
|
||||
grid = VGroup(
|
||||
*(
|
||||
Line(
|
||||
v[1] + i * grid_xstep * RIGHT,
|
||||
v[1] + i * grid_xstep * RIGHT + height * DOWN,
|
||||
color=color,
|
||||
)
|
||||
for i in range(1, count)
|
||||
)
|
||||
)
|
||||
self.add(grid)
|
||||
if grid_ystep is not None:
|
||||
grid_ystep = abs(grid_ystep)
|
||||
count = int(height / grid_ystep)
|
||||
grid = VGroup(
|
||||
*(
|
||||
Line(
|
||||
v[1] + i * grid_ystep * DOWN,
|
||||
v[1] + i * grid_ystep * DOWN + width * RIGHT,
|
||||
color=color,
|
||||
)
|
||||
for i in range(1, count)
|
||||
)
|
||||
)
|
||||
self.add(grid)
|
||||
|
||||
|
||||
class Square(Rectangle):
|
||||
"""A rectangle with equal side lengths.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
side_length : :class:`float`, optional
|
||||
The length of the sides of the square.
|
||||
kwargs : Any
|
||||
Additional arguments to be passed to :class:`Rectangle`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: SquareExample
|
||||
:save_last_frame:
|
||||
|
||||
class SquareExample(Scene):
|
||||
def construct(self):
|
||||
square_1 = Square(side_length=2.0).shift(DOWN)
|
||||
square_2 = Square(side_length=1.0).next_to(square_1, direction=UP)
|
||||
square_3 = Square(side_length=0.5).next_to(square_2, direction=UP)
|
||||
self.add(square_1, square_2, square_3)
|
||||
"""
|
||||
|
||||
def __init__(self, side_length=2.0, **kwargs):
|
||||
self.side_length = side_length
|
||||
super().__init__(height=side_length, width=side_length, **kwargs)
|
||||
|
||||
|
||||
class RoundedRectangle(Rectangle):
|
||||
"""A rectangle with rounded corners.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
corner_radius : :class:`float`, optional
|
||||
The curvature of the corners of the rectangle.
|
||||
kwargs : Any
|
||||
Additional arguments to be passed to :class:`Rectangle`
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. manim:: RoundedRectangleExample
|
||||
:save_last_frame:
|
||||
|
||||
class RoundedRectangleExample(Scene):
|
||||
def construct(self):
|
||||
rect_1 = RoundedRectangle(corner_radius=0.5)
|
||||
rect_2 = RoundedRectangle(corner_radius=1.5, height=4.0, width=4.0)
|
||||
|
||||
rect_group = Group(rect_1, rect_2).arrange(buff=1)
|
||||
self.add(rect_group)
|
||||
"""
|
||||
|
||||
def __init__(self, corner_radius=0.5, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.corner_radius = corner_radius
|
||||
self.round_corners(self.corner_radius)
|
||||
|
||||
|
||||
class Cutout(VMobject, metaclass=ConvertToOpenGL):
|
||||
"""A shape with smaller cutouts.
|
||||
|
||||
.. warning::
|
||||
|
||||
Technically, this class behaves similar to a symmetric difference: if
|
||||
parts of the ``mobjects`` are not located within the ``main_shape``,
|
||||
these parts will be added to the resulting :class:`~.VMobject`.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
main_shape : :class:`~.VMobject`
|
||||
The primary shape from which cutouts are made.
|
||||
mobjects : :class:`~.VMobject`
|
||||
The smaller shapes which are to be cut out of the ``main_shape``.
|
||||
kwargs
|
||||
Further keyword arguments that are passed to the constructor of
|
||||
:class:`~.VMobject`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
.. manim:: CutoutExample
|
||||
|
||||
class CutoutExample(Scene):
|
||||
def construct(self):
|
||||
s1 = Square().scale(2.5)
|
||||
s2 = Triangle().shift(DOWN + RIGHT).scale(0.5)
|
||||
s3 = Square().shift(UP + RIGHT).scale(0.5)
|
||||
s4 = RegularPolygon(5).shift(DOWN + LEFT).scale(0.5)
|
||||
s5 = RegularPolygon(6).shift(UP + LEFT).scale(0.5)
|
||||
c = Cutout(s1, s2, s3, s4, s5, fill_opacity=1, color=BLUE, stroke_color=RED)
|
||||
self.play(Write(c), run_time=4)
|
||||
self.wait()
|
||||
"""
|
||||
|
||||
def __init__(self, main_shape, *mobjects, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.append_points(main_shape.points)
|
||||
if main_shape.get_direction() == "CW":
|
||||
sub_direction = "CCW"
|
||||
else:
|
||||
sub_direction = "CW"
|
||||
for mobject in mobjects:
|
||||
self.append_points(mobject.force_direction(sub_direction).points)
|
||||
|
|
@ -4,15 +4,13 @@ from __future__ import annotations
|
|||
|
||||
__all__ = ["SurroundingRectangle", "BackgroundRectangle", "Cross", "Underline"]
|
||||
|
||||
|
||||
from manim.utils.color import Color
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..mobject.geometry import Line, RoundedRectangle
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.types.vectorized_mobject import VGroup
|
||||
from ..utils.color import BLACK, RED, YELLOW, Colors
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import RoundedRectangle
|
||||
from manim.mobject.mobject import Mobject
|
||||
from manim.mobject.types.vectorized_mobject import VGroup
|
||||
from manim.utils.color import BLACK, RED, YELLOW, Color, Colors
|
||||
|
||||
|
||||
class SurroundingRectangle(RoundedRectangle):
|
||||
266
manim/mobject/geometry/tips.py
Normal file
266
manim/mobject/geometry/tips.py
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
r"""A collection of tip mobjects for use with :class:`~.TipableVMobject`."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"ArrowTip",
|
||||
"ArrowCircleFilledTip",
|
||||
"ArrowCircleTip",
|
||||
"ArrowSquareTip",
|
||||
"ArrowSquareFilledTip",
|
||||
]
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.arc import Circle
|
||||
from manim.mobject.geometry.polygram import Square, Triangle
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.types.vectorized_mobject import VMobject
|
||||
from manim.utils.space_ops import angle_of_vector
|
||||
|
||||
|
||||
class ArrowTip(VMobject, metaclass=ConvertToOpenGL):
|
||||
r"""Base class for arrow tips.
|
||||
|
||||
See Also
|
||||
--------
|
||||
:class:`ArrowTriangleTip`
|
||||
:class:`ArrowTriangleFilledTip`
|
||||
:class:`ArrowCircleTip`
|
||||
:class:`ArrowCircleFilledTip`
|
||||
:class:`ArrowSquareTip`
|
||||
:class:`ArrowSquareFilledTip`
|
||||
|
||||
Examples
|
||||
--------
|
||||
Cannot be used directly, only intended for inheritance::
|
||||
|
||||
>>> tip = ArrowTip()
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
NotImplementedError: Has to be implemented in inheriting subclasses.
|
||||
|
||||
Instead, use one of the pre-defined ones, or make
|
||||
a custom one like this:
|
||||
|
||||
.. manim:: CustomTipExample
|
||||
|
||||
>>> from manim import RegularPolygon, Arrow
|
||||
>>> class MyCustomArrowTip(ArrowTip, RegularPolygon):
|
||||
... def __init__(self, length=0.35, **kwargs):
|
||||
... RegularPolygon.__init__(self, n=5, **kwargs)
|
||||
... self.width = length
|
||||
... self.stretch_to_fit_height(length)
|
||||
>>> arr = Arrow(np.array([-2, -2, 0]), np.array([2, 2, 0]),
|
||||
... tip_shape=MyCustomArrowTip)
|
||||
>>> isinstance(arr.tip, RegularPolygon)
|
||||
True
|
||||
>>> from manim import Scene, Create
|
||||
>>> class CustomTipExample(Scene):
|
||||
... def construct(self):
|
||||
... self.play(Create(arr))
|
||||
|
||||
Using a class inherited from :class:`ArrowTip` to get a non-filled
|
||||
tip is a shorthand to manually specifying the arrow tip style as follows::
|
||||
|
||||
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([1, 1, 0]),
|
||||
... tip_style={'fill_opacity': 0, 'stroke_width': 3})
|
||||
|
||||
The following example illustrates the usage of all of the predefined
|
||||
arrow tips.
|
||||
|
||||
.. manim:: ArrowTipsShowcase
|
||||
:save_last_frame:
|
||||
|
||||
from manim.mobject.geometry.tips import ArrowTriangleTip,\
|
||||
ArrowSquareTip, ArrowSquareFilledTip,\
|
||||
ArrowCircleTip, ArrowCircleFilledTip
|
||||
class ArrowTipsShowcase(Scene):
|
||||
def construct(self):
|
||||
a00 = Arrow(start=[-2, 3, 0], end=[2, 3, 0], color=YELLOW)
|
||||
a11 = Arrow(start=[-2, 2, 0], end=[2, 2, 0], tip_shape=ArrowTriangleTip)
|
||||
a12 = Arrow(start=[-2, 1, 0], end=[2, 1, 0])
|
||||
a21 = Arrow(start=[-2, 0, 0], end=[2, 0, 0], tip_shape=ArrowSquareTip)
|
||||
a22 = Arrow([-2, -1, 0], [2, -1, 0], tip_shape=ArrowSquareFilledTip)
|
||||
a31 = Arrow([-2, -2, 0], [2, -2, 0], tip_shape=ArrowCircleTip)
|
||||
a32 = Arrow([-2, -3, 0], [2, -3, 0], tip_shape=ArrowCircleFilledTip)
|
||||
b11 = a11.copy().scale(0.5, scale_tips=True).next_to(a11, RIGHT)
|
||||
b12 = a12.copy().scale(0.5, scale_tips=True).next_to(a12, RIGHT)
|
||||
b21 = a21.copy().scale(0.5, scale_tips=True).next_to(a21, RIGHT)
|
||||
self.add(a00, a11, a12, a21, a22, a31, a32, b11, b12, b21)
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
raise NotImplementedError("Has to be implemented in inheriting subclasses.")
|
||||
|
||||
@property
|
||||
def base(self):
|
||||
r"""The base point of the arrow tip.
|
||||
|
||||
This is the point connecting to the arrow line.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> from manim import Arrow
|
||||
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([2, 0, 0]), buff=0)
|
||||
>>> arrow.tip.base.round(2) + 0. # add 0. to avoid negative 0 in output
|
||||
array([1.65, 0. , 0. ])
|
||||
|
||||
"""
|
||||
return self.point_from_proportion(0.5)
|
||||
|
||||
@property
|
||||
def tip_point(self):
|
||||
r"""The tip point of the arrow tip.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> from manim import Arrow
|
||||
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([2, 0, 0]), buff=0)
|
||||
>>> arrow.tip.tip_point.round(2) + 0.
|
||||
array([2., 0., 0.])
|
||||
|
||||
"""
|
||||
return self.points[0]
|
||||
|
||||
@property
|
||||
def vector(self):
|
||||
r"""The vector pointing from the base point to the tip point.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> from manim import Arrow
|
||||
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([2, 2, 0]), buff=0)
|
||||
>>> arrow.tip.vector.round(2) + 0.
|
||||
array([0.25, 0.25, 0. ])
|
||||
|
||||
"""
|
||||
return self.tip_point - self.base
|
||||
|
||||
@property
|
||||
def tip_angle(self):
|
||||
r"""The angle of the arrow tip.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> from manim import Arrow
|
||||
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([1, 1, 0]), buff=0)
|
||||
>>> round(arrow.tip.tip_angle, 5) == round(PI/4, 5)
|
||||
True
|
||||
|
||||
"""
|
||||
return angle_of_vector(self.vector)
|
||||
|
||||
@property
|
||||
def length(self):
|
||||
r"""The length of the arrow tip.
|
||||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
>>> from manim import Arrow
|
||||
>>> arrow = Arrow(np.array([0, 0, 0]), np.array([1, 2, 0]))
|
||||
>>> round(arrow.tip.length, 3)
|
||||
0.35
|
||||
|
||||
"""
|
||||
return np.linalg.norm(self.vector)
|
||||
|
||||
|
||||
class ArrowTriangleTip(ArrowTip, Triangle):
|
||||
r"""Triangular arrow tip."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
fill_opacity=0,
|
||||
stroke_width=3,
|
||||
length=DEFAULT_ARROW_TIP_LENGTH,
|
||||
start_angle=PI,
|
||||
**kwargs,
|
||||
):
|
||||
Triangle.__init__(
|
||||
self,
|
||||
fill_opacity=fill_opacity,
|
||||
stroke_width=stroke_width,
|
||||
start_angle=start_angle,
|
||||
**kwargs,
|
||||
)
|
||||
self.width = length
|
||||
self.stretch_to_fit_height(length)
|
||||
|
||||
|
||||
class ArrowTriangleFilledTip(ArrowTriangleTip):
|
||||
r"""Triangular arrow tip with filled tip.
|
||||
|
||||
This is the default arrow tip shape.
|
||||
"""
|
||||
|
||||
def __init__(self, fill_opacity=1, stroke_width=0, **kwargs):
|
||||
super().__init__(fill_opacity=fill_opacity, stroke_width=stroke_width, **kwargs)
|
||||
|
||||
|
||||
class ArrowCircleTip(ArrowTip, Circle):
|
||||
r"""Circular arrow tip."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
fill_opacity=0,
|
||||
stroke_width=3,
|
||||
length=DEFAULT_ARROW_TIP_LENGTH,
|
||||
start_angle=PI,
|
||||
**kwargs,
|
||||
):
|
||||
self.start_angle = start_angle
|
||||
Circle.__init__(
|
||||
self, fill_opacity=fill_opacity, stroke_width=stroke_width, **kwargs
|
||||
)
|
||||
self.width = length
|
||||
self.stretch_to_fit_height(length)
|
||||
|
||||
|
||||
class ArrowCircleFilledTip(ArrowCircleTip):
|
||||
r"""Circular arrow tip with filled tip."""
|
||||
|
||||
def __init__(self, fill_opacity=1, stroke_width=0, **kwargs):
|
||||
super().__init__(fill_opacity=fill_opacity, stroke_width=stroke_width, **kwargs)
|
||||
|
||||
|
||||
class ArrowSquareTip(ArrowTip, Square):
|
||||
r"""Square arrow tip."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
fill_opacity=0,
|
||||
stroke_width=3,
|
||||
length=DEFAULT_ARROW_TIP_LENGTH,
|
||||
start_angle=PI,
|
||||
**kwargs,
|
||||
):
|
||||
self.start_angle = start_angle
|
||||
Square.__init__(
|
||||
self,
|
||||
fill_opacity=fill_opacity,
|
||||
stroke_width=stroke_width,
|
||||
side_length=length,
|
||||
**kwargs,
|
||||
)
|
||||
self.width = length
|
||||
self.stretch_to_fit_height(length)
|
||||
|
||||
|
||||
class ArrowSquareFilledTip(ArrowSquareTip):
|
||||
r"""Square arrow tip with filled tip."""
|
||||
|
||||
def __init__(self, fill_opacity=1, stroke_width=0, **kwargs):
|
||||
super().__init__(fill_opacity=fill_opacity, stroke_width=stroke_width, **kwargs)
|
||||
|
|
@ -13,15 +13,16 @@ from typing import Hashable, Iterable
|
|||
import networkx as nx
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.geometry.arc import Dot, LabeledDot
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.text.tex_mobject import MathTex
|
||||
|
||||
from ..animation.composition import AnimationGroup
|
||||
from ..animation.creation import Create, Uncreate
|
||||
from ..utils.color import BLACK
|
||||
from .geometry import Dot, LabeledDot, Line
|
||||
from .mobject import Mobject, override_animate
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
from .svg.tex_mobject import MathTex
|
||||
from .types.vectorized_mobject import VMobject
|
||||
|
||||
|
||||
|
|
|
|||
14
manim/mobject/graphing/__init__.py
Normal file
14
manim/mobject/graphing/__init__.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"""Coordinate systems and function graphing related mobjects.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~coordinate_systems
|
||||
~functions
|
||||
~number_line
|
||||
~probability
|
||||
~scale
|
||||
"""
|
||||
|
|
@ -14,37 +14,28 @@ __all__ = [
|
|||
|
||||
import fractions as fr
|
||||
import numbers
|
||||
from typing import Any, Callable, Iterable, Sequence
|
||||
from typing import TYPE_CHECKING, Any, Callable, Iterable, Sequence
|
||||
|
||||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.utils.scale import LinearBase
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..mobject.functions import ImplicitFunction, ParametricFunction
|
||||
from ..mobject.geometry import (
|
||||
Arrow,
|
||||
Circle,
|
||||
DashedLine,
|
||||
Dot,
|
||||
Line,
|
||||
Polygon,
|
||||
Rectangle,
|
||||
RegularPolygon,
|
||||
)
|
||||
from ..mobject.number_line import NumberLine
|
||||
from ..mobject.svg.tex_mobject import MathTex
|
||||
from ..mobject.types.vectorized_mobject import (
|
||||
Mobject,
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.arc import Circle, Dot
|
||||
from manim.mobject.geometry.line import Arrow, DashedLine, Line
|
||||
from manim.mobject.geometry.polygram import Polygon, Rectangle, RegularPolygon
|
||||
from manim.mobject.graphing.functions import ImplicitFunction, ParametricFunction
|
||||
from manim.mobject.graphing.number_line import NumberLine
|
||||
from manim.mobject.graphing.scale import LinearBase
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.text.tex_mobject import MathTex
|
||||
from manim.mobject.types.vectorized_mobject import (
|
||||
VDict,
|
||||
VectorizedPoint,
|
||||
VGroup,
|
||||
VMobject,
|
||||
)
|
||||
from ..utils.color import (
|
||||
from manim.utils.color import (
|
||||
BLACK,
|
||||
BLUE,
|
||||
BLUE_D,
|
||||
|
|
@ -54,9 +45,12 @@ from ..utils.color import (
|
|||
color_gradient,
|
||||
invert_color,
|
||||
)
|
||||
from ..utils.config_ops import merge_dicts_recursively, update_dict_recursively
|
||||
from ..utils.simple_functions import binary_search
|
||||
from ..utils.space_ops import angle_of_vector
|
||||
from manim.utils.config_ops import merge_dicts_recursively, update_dict_recursively
|
||||
from manim.utils.simple_functions import binary_search
|
||||
from manim.utils.space_ops import angle_of_vector
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manim.mobject.mobject import Mobject
|
||||
|
||||
|
||||
class CoordinateSystem:
|
||||
|
|
@ -10,11 +10,11 @@ from typing import Callable, Iterable, Sequence
|
|||
import numpy as np
|
||||
from isosurfaces import plot_isoline
|
||||
|
||||
from .. import config
|
||||
from ..mobject.types.vectorized_mobject import VMobject
|
||||
from ..utils.color import YELLOW
|
||||
from ..utils.scale import LinearBase, _ScaleBase
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
from manim import config
|
||||
from manim.mobject.graphing.scale import LinearBase, _ScaleBase
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.types.vectorized_mobject import VMobject
|
||||
from manim.utils.color import YELLOW
|
||||
|
||||
|
||||
class ParametricFunction(VMobject, metaclass=ConvertToOpenGL):
|
||||
|
|
@ -8,17 +8,16 @@ from typing import Iterable, Sequence
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.svg.tex_mobject import MathTex, Tex
|
||||
from manim.utils.scale import LinearBase, _ScaleBase
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..mobject.geometry import Line
|
||||
from ..mobject.numbers import DecimalNumber
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.bezier import interpolate
|
||||
from ..utils.config_ops import merge_dicts_recursively
|
||||
from ..utils.space_ops import normalize
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.graphing.scale import LinearBase, _ScaleBase
|
||||
from manim.mobject.text.numbers import DecimalNumber
|
||||
from manim.mobject.text.tex_mobject import MathTex, Tex
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.utils.bezier import interpolate
|
||||
from manim.utils.config_ops import merge_dicts_recursively
|
||||
from manim.utils.space_ops import normalize
|
||||
|
||||
|
||||
class NumberLine(Line):
|
||||
|
|
@ -10,16 +10,16 @@ from typing import Iterable, Sequence
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..mobject.coordinate_systems import Axes
|
||||
from ..mobject.geometry import Rectangle
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLMobject
|
||||
from ..mobject.svg.brace import Brace
|
||||
from ..mobject.svg.tex_mobject import MathTex, Tex
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.color import (
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.polygram import Rectangle
|
||||
from manim.mobject.graphing.coordinate_systems import Axes
|
||||
from manim.mobject.mobject import Mobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.svg.brace import Brace
|
||||
from manim.mobject.text.tex_mobject import MathTex, Tex
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.utils.color import (
|
||||
BLUE_E,
|
||||
DARK_GREY,
|
||||
GREEN_E,
|
||||
|
|
@ -28,7 +28,7 @@ from ..utils.color import (
|
|||
YELLOW,
|
||||
color_gradient,
|
||||
)
|
||||
from ..utils.iterables import tuplify
|
||||
from manim.utils.iterables import tuplify
|
||||
|
||||
EPSILON = 0.0001
|
||||
|
||||
|
|
@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any, Iterable
|
|||
|
||||
__all__ = ["LogBase", "LinearBase"]
|
||||
|
||||
from ..mobject.numbers import Integer
|
||||
from manim.mobject.text.numbers import Integer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manim.mobject.mobject import Mobject
|
||||
|
|
@ -162,7 +162,7 @@ class LogBase(_ScaleBase):
|
|||
|
||||
val_range
|
||||
The iterable of values used to create the labels. Determines the exponent.
|
||||
units_decimal_places
|
||||
unit_decimal_places
|
||||
The number of decimal places to include in the exponent
|
||||
base_config
|
||||
Additional arguments to be passed to :class:`~.Integer`.
|
||||
|
|
@ -4,14 +4,16 @@ from __future__ import annotations
|
|||
|
||||
__all__ = ["ManimBanner"]
|
||||
|
||||
from manim.animation.updaters.update import UpdateFromAlphaFunc
|
||||
from manim.mobject.geometry.arc import Circle
|
||||
from manim.mobject.geometry.polygram import Square, Triangle
|
||||
from manim.mobject.text.tex_mobject import MathTex, Tex
|
||||
|
||||
from ..animation.animation import override_animation
|
||||
from ..animation.composition import AnimationGroup, Succession
|
||||
from ..animation.creation import Create
|
||||
from ..animation.fading import FadeIn
|
||||
from ..animation.update import UpdateFromAlphaFunc
|
||||
from ..constants import DOWN, LEFT, ORIGIN, RIGHT, TAU, UP
|
||||
from ..mobject.geometry import Circle, Square, Triangle
|
||||
from ..mobject.svg.tex_mobject import MathTex, Tex
|
||||
from ..mobject.types.vectorized_mobject import VGroup
|
||||
from ..utils.rate_functions import ease_in_out_cubic, ease_out_sine, smooth
|
||||
from ..utils.tex_templates import TexFontTemplates
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import annotations
|
||||
|
||||
r"""Mobjects representing matrices.
|
||||
|
||||
Examples
|
||||
|
|
@ -28,6 +26,8 @@ Examples
|
|||
self.add(g)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"Matrix",
|
||||
"DecimalMatrix",
|
||||
|
|
@ -44,11 +44,12 @@ from typing import Iterable, Sequence
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.text.numbers import DecimalNumber, Integer
|
||||
from manim.mobject.text.tex_mobject import MathTex, Tex
|
||||
|
||||
from ..constants import *
|
||||
from ..mobject.numbers import DecimalNumber, Integer
|
||||
from ..mobject.svg.tex_mobject import MathTex, Tex
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
|
||||
# TO DO : The following two functions are not used in this file.
|
||||
# Not sure if we should keep it or not.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ from typing import (
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..utils.color import (
|
||||
|
|
@ -46,7 +48,6 @@ from ..utils.iterables import list_update, remove_list_redundancies
|
|||
from ..utils.paths import straight_path
|
||||
from ..utils.simple_functions import get_parameters
|
||||
from ..utils.space_ops import angle_between_vectors, normalize, rotation_matrix
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
|
||||
# TODO: Explain array_attrs
|
||||
|
||||
|
|
@ -1677,7 +1678,7 @@ class Mobject:
|
|||
|
||||
# TODO, this does not behave well when the mobject has points,
|
||||
# since it gets displayed on top
|
||||
from ..mobject.shape_matchers import BackgroundRectangle
|
||||
from manim.mobject.geometry.shape_matchers import BackgroundRectangle
|
||||
|
||||
self.background_rectangle = BackgroundRectangle(
|
||||
self, color=color, fill_opacity=opacity, **kwargs
|
||||
|
|
@ -2238,7 +2239,7 @@ class Mobject:
|
|||
|
||||
|
||||
"""
|
||||
from .geometry import Line
|
||||
from manim.mobject.geometry.line import Line
|
||||
|
||||
mobs = self.submobjects.copy()
|
||||
start_pos = self.get_center()
|
||||
|
|
|
|||
0
manim/mobject/opengl/__init__.py
Normal file
0
manim/mobject/opengl/__init__.py
Normal file
|
|
@ -4,9 +4,9 @@ __all__ = ["TrueDot", "DotCloud"]
|
|||
|
||||
import numpy as np
|
||||
|
||||
from ...constants import ORIGIN, RIGHT, UP
|
||||
from ...utils.color import YELLOW
|
||||
from .opengl_point_cloud_mobject import OpenGLPMobject
|
||||
from manim.constants import ORIGIN, RIGHT, UP
|
||||
from manim.mobject.opengl.opengl_point_cloud_mobject import OpenGLPMobject
|
||||
from manim.utils.color import YELLOW
|
||||
|
||||
|
||||
class DotCloud(OpenGLPMobject):
|
||||
|
|
@ -2,11 +2,11 @@ from __future__ import annotations
|
|||
|
||||
from abc import ABCMeta
|
||||
|
||||
from .. import config
|
||||
from .opengl_mobject import OpenGLMobject
|
||||
from .opengl_three_dimensions import OpenGLSurface
|
||||
from .types.opengl_point_cloud_mobject import OpenGLPMobject
|
||||
from .types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from manim import config
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_point_cloud_mobject import OpenGLPMobject
|
||||
from manim.mobject.opengl.opengl_three_dimensions import OpenGLSurface
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
|
||||
class ConvertToOpenGL(ABCMeta):
|
||||
|
|
@ -2,17 +2,17 @@ from __future__ import annotations
|
|||
|
||||
import numpy as np
|
||||
|
||||
from ..constants import *
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.types.opengl_vectorized_mobject import (
|
||||
from manim.constants import *
|
||||
from manim.mobject.mobject import Mobject
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import (
|
||||
OpenGLDashedVMobject,
|
||||
OpenGLVGroup,
|
||||
OpenGLVMobject,
|
||||
)
|
||||
from ..utils.color import *
|
||||
from ..utils.iterables import adjacent_n_tuples, adjacent_pairs
|
||||
from ..utils.simple_functions import clip
|
||||
from ..utils.space_ops import (
|
||||
from manim.utils.color import *
|
||||
from manim.utils.iterables import adjacent_n_tuples, adjacent_pairs
|
||||
from manim.utils.simple_functions import clip
|
||||
from manim.utils.space_ops import (
|
||||
angle_between_vectors,
|
||||
angle_of_vector,
|
||||
compass_directions,
|
||||
|
|
@ -12,15 +12,15 @@ import moderngl
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..utils.bezier import integer_interpolate, interpolate
|
||||
from ..utils.color import *
|
||||
from ..utils.color import Colors
|
||||
from ..utils.config_ops import _Data, _Uniforms
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.utils.bezier import integer_interpolate, interpolate
|
||||
from manim.utils.color import *
|
||||
from manim.utils.color import Colors
|
||||
from manim.utils.config_ops import _Data, _Uniforms
|
||||
|
||||
# from ..utils.iterables import batch_by_property
|
||||
from ..utils.iterables import (
|
||||
from manim.utils.iterables import (
|
||||
batch_by_property,
|
||||
list_update,
|
||||
listify,
|
||||
|
|
@ -30,9 +30,9 @@ from ..utils.iterables import (
|
|||
resize_with_interpolation,
|
||||
uniq_chain,
|
||||
)
|
||||
from ..utils.paths import straight_path
|
||||
from ..utils.simple_functions import get_parameters
|
||||
from ..utils.space_ops import (
|
||||
from manim.utils.paths import straight_path
|
||||
from manim.utils.simple_functions import get_parameters
|
||||
from manim.utils.space_ops import (
|
||||
angle_between_vectors,
|
||||
normalize,
|
||||
rotation_matrix_transpose,
|
||||
|
|
@ -983,7 +983,7 @@ class OpenGLMobject:
|
|||
|
||||
|
||||
"""
|
||||
from .geometry import Line
|
||||
from manim.mobject.geometry.line import Line
|
||||
|
||||
mobs = self.submobjects.copy()
|
||||
start_pos = self.get_center()
|
||||
|
|
@ -2014,7 +2014,7 @@ class OpenGLMobject:
|
|||
:class:`~.BackgroundRectangle`
|
||||
|
||||
"""
|
||||
from ..mobject.shape_matchers import BackgroundRectangle
|
||||
from manim.mobject.geometry.shape_matchers import BackgroundRectangle
|
||||
|
||||
self.background_rectangle = BackgroundRectangle(
|
||||
self, color=color, fill_opacity=opacity, **kwargs
|
||||
|
|
@ -2581,7 +2581,7 @@ class OpenGLMobject:
|
|||
# return self
|
||||
|
||||
def get_shader_wrapper(self):
|
||||
from ..renderer.shader_wrapper import ShaderWrapper
|
||||
from manim.renderer.shader_wrapper import ShaderWrapper
|
||||
|
||||
self.shader_wrapper = ShaderWrapper(
|
||||
vert_data=self.get_shader_data(),
|
||||
|
|
@ -2756,7 +2756,7 @@ class _AnimationBuilder:
|
|||
return update_target
|
||||
|
||||
def build(self):
|
||||
from ..animation.transform import _MethodAnimation
|
||||
from manim.animation.transform import _MethodAnimation
|
||||
|
||||
if self.overridden_animation:
|
||||
anim = self.overridden_animation
|
||||
|
|
@ -5,12 +5,12 @@ __all__ = ["OpenGLPMobject", "OpenGLPGroup", "OpenGLPMPoint"]
|
|||
import moderngl
|
||||
import numpy as np
|
||||
|
||||
from ...constants import *
|
||||
from ...mobject.opengl_mobject import OpenGLMobject
|
||||
from ...utils.bezier import interpolate
|
||||
from ...utils.color import BLACK, WHITE, YELLOW, color_gradient, color_to_rgba
|
||||
from ...utils.config_ops import _Uniforms
|
||||
from ...utils.iterables import resize_with_interpolation
|
||||
from manim.constants import *
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.utils.bezier import interpolate
|
||||
from manim.utils.color import BLACK, WHITE, YELLOW, color_gradient, color_to_rgba
|
||||
from manim.utils.config_ops import _Uniforms
|
||||
from manim.utils.iterables import resize_with_interpolation
|
||||
|
||||
|
||||
class OpenGLPMobject(OpenGLMobject):
|
||||
|
|
@ -3,14 +3,14 @@ from __future__ import annotations
|
|||
import moderngl
|
||||
import numpy as np
|
||||
|
||||
from ...constants import *
|
||||
from ...mobject.opengl_mobject import OpenGLMobject
|
||||
from ...utils.bezier import integer_interpolate, interpolate
|
||||
from ...utils.color import *
|
||||
from ...utils.config_ops import _Data, _Uniforms
|
||||
from ...utils.images import get_full_raster_image_path
|
||||
from ...utils.iterables import listify
|
||||
from ...utils.space_ops import normalize_along_axis
|
||||
from manim.constants import *
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.utils.bezier import integer_interpolate, interpolate
|
||||
from manim.utils.color import *
|
||||
from manim.utils.config_ops import _Data, _Uniforms
|
||||
from manim.utils.images import get_full_raster_image_path
|
||||
from manim.utils.iterables import listify
|
||||
from manim.utils.space_ops import normalize_along_axis
|
||||
|
||||
|
||||
class OpenGLSurface(OpenGLMobject):
|
||||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import numpy as np
|
||||
|
||||
from ..mobject.types.opengl_surface import OpenGLSurface
|
||||
from ..mobject.types.opengl_vectorized_mobject import OpenGLVGroup, OpenGLVMobject
|
||||
from manim.mobject.opengl.opengl_surface import OpenGLSurface
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVGroup, OpenGLVMobject
|
||||
|
||||
|
||||
class OpenGLSurfaceMesh(OpenGLVGroup):
|
||||
|
|
@ -9,10 +9,10 @@ import moderngl
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from ... import config
|
||||
from ...constants import *
|
||||
from ...mobject.opengl_mobject import OpenGLMobject, OpenGLPoint
|
||||
from ...utils.bezier import (
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject, OpenGLPoint
|
||||
from manim.utils.bezier import (
|
||||
bezier,
|
||||
get_quadratic_approximation_of_cubic,
|
||||
get_smooth_cubic_bezier_handle_points,
|
||||
|
|
@ -21,10 +21,10 @@ from ...utils.bezier import (
|
|||
partial_quadratic_bezier_points,
|
||||
proportions_along_bezier_curve_for_point,
|
||||
)
|
||||
from ...utils.color import *
|
||||
from ...utils.config_ops import _Data
|
||||
from ...utils.iterables import listify, make_even, resize_with_interpolation
|
||||
from ...utils.space_ops import (
|
||||
from manim.utils.color import *
|
||||
from manim.utils.config_ops import _Data
|
||||
from manim.utils.iterables import listify, make_even, resize_with_interpolation
|
||||
from manim.utils.space_ops import (
|
||||
angle_between_vectors,
|
||||
cross2d,
|
||||
earclip_triangulation,
|
||||
|
|
@ -1534,7 +1534,6 @@ class OpenGLVMobject(OpenGLMobject):
|
|||
)
|
||||
|
||||
def get_shader_wrapper_list(self):
|
||||
from ...renderer.shader_wrapper import ShaderWrapper
|
||||
|
||||
# Build up data lists
|
||||
fill_shader_wrappers = []
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
"""Mobjects related to SVG images.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~brace
|
||||
~style_utils
|
||||
~svg_mobject
|
||||
~svg_path
|
||||
"""
|
||||
|
|
@ -9,15 +9,16 @@ from typing import Sequence
|
|||
import numpy as np
|
||||
|
||||
from manim._config import config
|
||||
from manim.mobject.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.geometry.arc import Arc
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.text.tex_mobject import MathTex, Tex
|
||||
|
||||
from ...animation.composition import AnimationGroup
|
||||
from ...animation.fading import FadeIn
|
||||
from ...animation.growing import GrowFromCenter
|
||||
from ...constants import *
|
||||
from ...mobject.geometry import Arc, Line
|
||||
from ...mobject.svg.svg_path import SVGPathMobject
|
||||
from ...mobject.svg.tex_mobject import MathTex, Tex
|
||||
from ...mobject.types.vectorized_mobject import VMobject
|
||||
from ...utils.color import BLACK
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,14 @@ from xml.dom.minidom import parse as minidom_parse
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.geometry.arc import Circle
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import Rectangle, RoundedRectangle
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
|
||||
from ... import config, logger
|
||||
from ...constants import *
|
||||
from ...mobject.geometry import Circle, Line, Rectangle, RoundedRectangle
|
||||
from ...mobject.types.vectorized_mobject import VMobject
|
||||
from ..opengl_compatibility import ConvertToOpenGL
|
||||
from .style_utils import cascade_element_style, parse_style
|
||||
from .svg_path import SVGPathMobject
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@ from math import *
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
|
||||
from ... import config
|
||||
from ...constants import *
|
||||
from ..opengl_compatibility import ConvertToOpenGL
|
||||
from ..types.vectorized_mobject import VMobject
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import annotations
|
||||
|
||||
r"""Mobjects representing tables.
|
||||
|
||||
Examples
|
||||
|
|
@ -55,6 +53,8 @@ Examples
|
|||
self.add(g1, g2)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"Table",
|
||||
"MathTable",
|
||||
|
|
@ -69,17 +69,18 @@ from typing import Callable, Iterable, Sequence
|
|||
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import Polygon
|
||||
from manim.mobject.geometry.shape_matchers import BackgroundRectangle
|
||||
from manim.mobject.text.numbers import DecimalNumber, Integer
|
||||
from manim.mobject.text.tex_mobject import MathTex
|
||||
from manim.mobject.text.text_mobject import Paragraph
|
||||
|
||||
from .. import config
|
||||
from ..animation.animation import Animation
|
||||
from ..animation.composition import AnimationGroup
|
||||
from ..animation.creation import Create, Write
|
||||
from ..animation.fading import FadeIn
|
||||
from ..constants import *
|
||||
from ..mobject.geometry import Line, Polygon
|
||||
from ..mobject.numbers import DecimalNumber, Integer
|
||||
from ..mobject.shape_matchers import BackgroundRectangle
|
||||
from ..mobject.svg.tex_mobject import MathTex
|
||||
from ..mobject.svg.text_mobject import Paragraph
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.color import BLACK, YELLOW
|
||||
|
||||
|
|
|
|||
13
manim/mobject/text/__init__.py
Normal file
13
manim/mobject/text/__init__.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"""Mobjects used to display Text using Pango or LaTeX.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~code_mobject
|
||||
~numbers
|
||||
~tex_mobject
|
||||
~text_mobject
|
||||
"""
|
||||
|
|
@ -16,12 +16,13 @@ from pygments.formatters.html import HtmlFormatter
|
|||
from pygments.lexers import get_lexer_by_name, guess_lexer_for_filename
|
||||
from pygments.styles import get_all_styles
|
||||
|
||||
from ...constants import *
|
||||
from ...mobject.geometry import Dot, RoundedRectangle
|
||||
from ...mobject.shape_matchers import SurroundingRectangle
|
||||
from ...mobject.svg.text_mobject import Paragraph
|
||||
from ...mobject.types.vectorized_mobject import VGroup
|
||||
from ...utils.color import WHITE
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.arc import Dot
|
||||
from manim.mobject.geometry.polygram import RoundedRectangle
|
||||
from manim.mobject.geometry.shape_matchers import SurroundingRectangle
|
||||
from manim.mobject.text.text_mobject import Paragraph
|
||||
from manim.mobject.types.vectorized_mobject import VGroup
|
||||
from manim.utils.color import WHITE
|
||||
|
||||
|
||||
class Code(VGroup):
|
||||
|
|
@ -8,12 +8,12 @@ from typing import Sequence
|
|||
|
||||
import numpy as np
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..mobject.svg.tex_mobject import MathTex, SingleStringMathTex
|
||||
from ..mobject.types.vectorized_mobject import VMobject
|
||||
from ..mobject.value_tracker import ValueTracker
|
||||
from .opengl_compatibility import ConvertToOpenGL
|
||||
from manim import config
|
||||
from manim.animation.updaters.value_tracker import ValueTracker
|
||||
from manim.constants import *
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.text.tex_mobject import MathTex, SingleStringMathTex
|
||||
from manim.mobject.types.vectorized_mobject import VMobject
|
||||
|
||||
string_to_mob_map = {}
|
||||
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import annotations
|
||||
|
||||
r"""Mobjects representing text rendered using LaTeX.
|
||||
|
||||
.. important::
|
||||
|
|
@ -12,6 +10,8 @@ r"""Mobjects representing text rendered using LaTeX.
|
|||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"TexSymbol",
|
||||
"SingleStringMathTex",
|
||||
|
|
@ -31,16 +31,15 @@ from typing import Dict, Iterable, Optional
|
|||
|
||||
from colour import Color
|
||||
|
||||
from manim import config, logger
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.svg.style_utils import parse_style
|
||||
from manim.mobject.svg.svg_mobject import SVGMobject
|
||||
from manim.mobject.svg.svg_path import SVGPathMobject
|
||||
from manim.mobject.types.vectorized_mobject import VectorizedPoint, VGroup, VMobject
|
||||
from manim.utils.tex import TexTemplate
|
||||
|
||||
from ... import config, logger
|
||||
from ...constants import *
|
||||
from ...mobject.geometry import Line
|
||||
from ...mobject.svg.svg_mobject import SVGMobject
|
||||
from ...mobject.svg.svg_path import SVGPathMobject
|
||||
from ...mobject.types.vectorized_mobject import VectorizedPoint, VGroup, VMobject
|
||||
from ...utils.tex_file_writing import tex_to_svg_file
|
||||
from .style_utils import parse_style
|
||||
from manim.utils.tex_file_writing import tex_to_svg_file
|
||||
|
||||
SCALE_FACTOR_PER_FONT_POINT = 1 / 960
|
||||
|
||||
|
|
@ -66,13 +66,13 @@ import numpy as np
|
|||
from colour import Color
|
||||
from manimpango import MarkupUtils, PangoUtils, TextSetting
|
||||
|
||||
from ... import config, logger
|
||||
from ...constants import *
|
||||
from ...mobject.geometry import Dot
|
||||
from ...mobject.svg.svg_mobject import SVGMobject
|
||||
from ...mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ...utils.color import Colors, color_gradient
|
||||
from ...utils.deprecation import deprecated
|
||||
from manim import config, logger
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.arc import Dot
|
||||
from manim.mobject.svg.svg_mobject import SVGMobject
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.utils.color import Colors, color_gradient
|
||||
from manim.utils.deprecation import deprecated
|
||||
|
||||
TEXT_MOB_SCALE_FACTOR = 0.05
|
||||
DEFAULT_LINE_SPACING_SCALE = 0.3
|
||||
12
manim/mobject/three_d/__init__.py
Normal file
12
manim/mobject/three_d/__init__.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"""Three-dimensional mobjects.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~polyhedra
|
||||
~three_d_utils
|
||||
~three_dimensions
|
||||
"""
|
||||
|
|
@ -6,13 +6,13 @@ from typing import TYPE_CHECKING
|
|||
|
||||
import numpy as np
|
||||
|
||||
from .geometry import Polygon
|
||||
from .graph import Graph
|
||||
from .three_dimensions import Dot3D
|
||||
from .types.vectorized_mobject import VGroup
|
||||
from manim.mobject.geometry.polygram import Polygon
|
||||
from manim.mobject.graph import Graph
|
||||
from manim.mobject.three_d.three_dimensions import Dot3D
|
||||
from manim.mobject.types.vectorized_mobject import VGroup
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .mobject import Mobject
|
||||
from manim.mobject.mobject import Mobject
|
||||
|
||||
__all__ = ["Polyhedron", "Tetrahedron", "Octahedron", "Icosahedron", "Dodecahedron"]
|
||||
|
||||
|
|
@ -16,8 +16,8 @@ __all__ = [
|
|||
|
||||
import numpy as np
|
||||
|
||||
from ..constants import ORIGIN, UP
|
||||
from ..utils.space_ops import get_unit_normal
|
||||
from manim.constants import ORIGIN, UP
|
||||
from manim.utils.space_ops import get_unit_normal
|
||||
|
||||
|
||||
def get_3d_vmob_gradient_start_and_end_points(vmob):
|
||||
|
|
@ -22,17 +22,17 @@ from typing import *
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.opengl_compatibility import ConvertToOpenGL
|
||||
|
||||
from .. import config
|
||||
from ..constants import *
|
||||
from ..mobject.geometry import Circle, Square
|
||||
from ..mobject.mobject import *
|
||||
from ..mobject.opengl_mobject import OpenGLMobject
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.color import *
|
||||
from ..utils.iterables import tuplify
|
||||
from ..utils.space_ops import normalize, perpendicular_bisector, z_to_vector
|
||||
from manim import config
|
||||
from manim.constants import *
|
||||
from manim.mobject.geometry.arc import Circle
|
||||
from manim.mobject.geometry.polygram import Square
|
||||
from manim.mobject.mobject import *
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.utils.color import *
|
||||
from manim.utils.iterables import tuplify
|
||||
from manim.utils.space_ops import normalize, perpendicular_bisector, z_to_vector
|
||||
|
||||
|
||||
class ThreeDVMobject(VMobject, metaclass=ConvertToOpenGL):
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
"""Specialized mobject base classes.
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
.. autosummary::
|
||||
:toctree: ../reference
|
||||
|
||||
~image_mobject
|
||||
~point_cloud_mobject
|
||||
~vectorized_mobject
|
||||
"""
|
||||
|
|
@ -10,12 +10,11 @@ import colour
|
|||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
from manim.constants import DEFAULT_QUALITY, QUALITIES
|
||||
from manim.mobject.geometry.shape_matchers import SurroundingRectangle
|
||||
|
||||
from ... import config
|
||||
from ...constants import *
|
||||
from ...mobject.mobject import Mobject
|
||||
from ...mobject.shape_matchers import SurroundingRectangle
|
||||
from ...utils.bezier import interpolate
|
||||
from ...utils.color import WHITE, color_to_int_rgb
|
||||
from ...utils.images import get_full_raster_image_path
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ __all__ = ["PMobject", "Mobject1D", "Mobject2D", "PGroup", "PointCloudDot", "Poi
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.opengl.opengl_point_cloud_mobject import OpenGLPMobject
|
||||
|
||||
from ...constants import *
|
||||
from ...mobject.mobject import Mobject
|
||||
from ...utils.bezier import interpolate
|
||||
|
|
@ -19,8 +22,6 @@ from ...utils.color import (
|
|||
rgba_to_color,
|
||||
)
|
||||
from ...utils.iterables import stretch_array_to_length
|
||||
from ..opengl_compatibility import ConvertToOpenGL
|
||||
from ..types.opengl_point_cloud_mobject import OpenGLPMobject
|
||||
|
||||
|
||||
class PMobject(Mobject, metaclass=ConvertToOpenGL):
|
||||
|
|
|
|||
|
|
@ -20,10 +20,15 @@ import colour
|
|||
import numpy as np
|
||||
from PIL.Image import Image
|
||||
|
||||
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from manim.mobject.three_d.three_d_utils import (
|
||||
get_3d_vmob_gradient_start_and_end_points,
|
||||
)
|
||||
|
||||
from ... import config
|
||||
from ...constants import *
|
||||
from ...mobject.mobject import Mobject
|
||||
from ...mobject.three_d_utils import get_3d_vmob_gradient_start_and_end_points
|
||||
from ...utils.bezier import (
|
||||
bezier,
|
||||
get_smooth_handle_points,
|
||||
|
|
@ -36,8 +41,6 @@ from ...utils.color import BLACK, WHITE, color_to_rgba
|
|||
from ...utils.deprecation import deprecated
|
||||
from ...utils.iterables import make_even, stretch_array_to_length, tuplify
|
||||
from ...utils.space_ops import rotate_vector, shoelace_direction
|
||||
from ..opengl_compatibility import ConvertToOpenGL
|
||||
from .opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
# TODO
|
||||
# - Change cubic curve groups to have 4 points instead of 3
|
||||
|
|
@ -2201,7 +2204,7 @@ class VDict(VMobject, metaclass=ConvertToOpenGL):
|
|||
mob = value
|
||||
if self.show_keys:
|
||||
# This import is here and not at the top to avoid circular import
|
||||
from ...mobject.svg.tex_mobject import Tex
|
||||
from manim.mobject.text.tex_mobject import Tex
|
||||
|
||||
key_text = Tex(str(key)).next_to(value, LEFT)
|
||||
mob.add(key_text)
|
||||
|
|
|
|||
|
|
@ -17,20 +17,21 @@ import numpy as np
|
|||
from colour import Color
|
||||
from PIL import Image
|
||||
|
||||
from manim.animation.updaters.update import UpdateFromAlphaFunc
|
||||
from manim.mobject.geometry.line import Vector
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
from .. import config
|
||||
from ..animation.composition import AnimationGroup, Succession
|
||||
from ..animation.creation import Create
|
||||
from ..animation.indication import ShowPassingFlash
|
||||
from ..animation.update import UpdateFromAlphaFunc
|
||||
from ..constants import OUT, RIGHT, UP
|
||||
from ..mobject.geometry import Vector
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..utils.bezier import interpolate, inverse_interpolate
|
||||
from ..utils.color import BLUE_E, GREEN, RED, YELLOW, color_to_rgb, rgb_to_color
|
||||
from ..utils.rate_functions import ease_out_sine, linear
|
||||
from ..utils.simple_functions import sigmoid
|
||||
from .types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
DEFAULT_SCALAR_FIELD_COLORS: list = [BLUE_E, GREEN, YELLOW, RED]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,13 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
from ..mobject.opengl_mobject import *
|
||||
from ..mobject.opengl_three_dimensions import *
|
||||
from ..mobject.types.opengl_surface import *
|
||||
from ..mobject.types.opengl_vectorized_mobject import *
|
||||
|
||||
from manim.mobject.opengl.dot_cloud import *
|
||||
from manim.mobject.opengl.opengl_mobject import *
|
||||
from manim.mobject.opengl.opengl_point_cloud_mobject import *
|
||||
from manim.mobject.opengl.opengl_surface import *
|
||||
from manim.mobject.opengl.opengl_three_dimensions import *
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import *
|
||||
|
||||
from ..renderer.shader import *
|
||||
from ..utils.opengl import *
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ import numpy as np
|
|||
from PIL import Image
|
||||
|
||||
from manim import config, logger
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject, OpenGLPoint
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from manim.utils.caching import handle_caching_play
|
||||
from manim.utils.color import color_to_rgba
|
||||
from manim.utils.exceptions import EndSceneEarlyException
|
||||
|
||||
from ..constants import *
|
||||
from ..mobject.opengl_mobject import OpenGLMobject, OpenGLPoint
|
||||
from ..mobject.types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from ..scene.scene_file_writer import SceneFileWriter
|
||||
from ..utils import opengl
|
||||
from ..utils.config_ops import _Data
|
||||
|
|
|
|||
|
|
@ -30,12 +30,13 @@ from tqdm import tqdm
|
|||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.observers import Observer
|
||||
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLPoint
|
||||
|
||||
from .. import config, logger
|
||||
from ..animation.animation import Animation, Wait, prepare_animation
|
||||
from ..camera.camera import Camera
|
||||
from ..constants import *
|
||||
from ..gui.gui import configure_pygui
|
||||
from ..mobject.opengl_mobject import OpenGLPoint
|
||||
from ..renderer.cairo_renderer import CairoRenderer
|
||||
from ..renderer.opengl_renderer import OpenGLRenderer
|
||||
from ..renderer.shader import Object3D
|
||||
|
|
@ -1167,7 +1168,6 @@ class Scene:
|
|||
self.interactive_mode = True
|
||||
|
||||
def ipython(shell, namespace):
|
||||
import manim
|
||||
import manim.opengl
|
||||
|
||||
def load_module_into_namespace(module, namespace):
|
||||
|
|
|
|||
|
|
@ -10,18 +10,19 @@ from typing import Iterable, Sequence
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.animation.updaters.value_tracker import ValueTracker
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.graphing.coordinate_systems import ThreeDAxes
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.three_d.three_dimensions import Sphere
|
||||
|
||||
from .. import config
|
||||
from ..animation.animation import Animation
|
||||
from ..animation.transform import Transform
|
||||
from ..camera.three_d_camera import ThreeDCamera
|
||||
from ..constants import DEGREES
|
||||
from ..mobject.coordinate_systems import ThreeDAxes
|
||||
from ..mobject.geometry import Line
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLMobject
|
||||
from ..mobject.three_dimensions import Sphere
|
||||
from ..mobject.types.vectorized_mobject import VectorizedPoint, VGroup
|
||||
from ..mobject.value_tracker import ValueTracker
|
||||
from ..renderer.opengl_renderer import OpenGLCamera
|
||||
from ..scene.scene import Scene
|
||||
from ..utils.config_ops import merge_dicts_recursively
|
||||
|
|
|
|||
|
|
@ -4,10 +4,15 @@ from __future__ import annotations
|
|||
|
||||
__all__ = ["VectorScene", "LinearTransformationScene"]
|
||||
|
||||
|
||||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.geometry.arc import Dot
|
||||
from manim.mobject.geometry.line import Arrow, Line, Vector
|
||||
from manim.mobject.geometry.polygram import Rectangle
|
||||
from manim.mobject.graphing.coordinate_systems import Axes, NumberPlane
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.text.tex_mobject import MathTex, Tex
|
||||
from manim.utils.config_ops import update_dict_recursively
|
||||
|
||||
from .. import config
|
||||
|
|
@ -17,12 +22,8 @@ from ..animation.fading import FadeOut
|
|||
from ..animation.growing import GrowArrow
|
||||
from ..animation.transform import ApplyFunction, ApplyPointwiseFunction, Transform
|
||||
from ..constants import *
|
||||
from ..mobject.coordinate_systems import Axes, NumberPlane
|
||||
from ..mobject.geometry import Arrow, Dot, Line, Rectangle, Vector
|
||||
from ..mobject.matrix import Matrix
|
||||
from ..mobject.mobject import Mobject
|
||||
from ..mobject.opengl_mobject import OpenGLMobject
|
||||
from ..mobject.svg.tex_mobject import MathTex, Tex
|
||||
from ..mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from ..scene.scene import Scene
|
||||
from ..utils.color import BLUE_D, GREEN_C, GREY, RED_C, WHITE, YELLOW
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ from __future__ import annotations
|
|||
__all__ = ["print_family", "index_labels"]
|
||||
|
||||
|
||||
from colour import Color
|
||||
|
||||
from manim.mobject.mobject import Mobject
|
||||
from manim.mobject.text.numbers import Integer
|
||||
|
||||
from ..mobject.numbers import Integer
|
||||
from ..mobject.types.vectorized_mobject import VGroup
|
||||
from .color import BLACK
|
||||
|
||||
|
|
|
|||
|
|
@ -342,8 +342,6 @@ def _delete_rendering_times(*args):
|
|||
|
||||
|
||||
def setup(app):
|
||||
import manim
|
||||
|
||||
app.add_node(skip_manim_node, html=(visit, depart))
|
||||
|
||||
setup.app = app
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||
|
||||
__all__ = ["get_full_raster_image_path", "drag_pixels", "invert_image"]
|
||||
|
||||
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import numpy as np
|
|||
import pytest
|
||||
|
||||
from manim.animation.creation import Uncreate
|
||||
from manim.mobject.geometry import Dot, Line, Square
|
||||
from manim.mobject.geometry.arc import Dot
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import Square
|
||||
from manim.mobject.mobject import override_animate
|
||||
from manim.mobject.types.vectorized_mobject import VGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.coordinate_systems import Axes
|
||||
from manim.mobject.graphing.coordinate_systems import Axes
|
||||
|
||||
|
||||
def test_axes_origin_shift(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import numpy as np
|
|||
from colour import Color
|
||||
|
||||
from manim import BLACK, BLUE, GREEN, PURE_BLUE, PURE_GREEN, PURE_RED, Scene
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
|
||||
def test_import_color(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ from manim.animation.animation import Animation, Wait
|
|||
from manim.animation.composition import AnimationGroup, Succession
|
||||
from manim.animation.fading import FadeIn, FadeOut
|
||||
from manim.constants import DOWN, UP
|
||||
from manim.mobject.geometry import Circle, Line, Square
|
||||
from manim.mobject.geometry.arc import Circle
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import Square
|
||||
|
||||
|
||||
def test_succession_timing(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
from pathlib import Path
|
||||
|
||||
from manim import BraceLabel, config
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
|
||||
|
||||
def test_opengl_mobject_copy(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import numpy as np
|
||||
|
||||
from manim import RIGHT, Circle
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
|
||||
|
||||
def test_family(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import numpy as np
|
||||
|
||||
from manim import NumberLine
|
||||
from manim.mobject.numbers import Integer
|
||||
from manim.mobject.text.numbers import Integer
|
||||
|
||||
|
||||
def test_unit_vector():
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manim.mobject.numbers import DecimalNumber
|
||||
from manim.mobject.text.numbers import DecimalNumber
|
||||
|
||||
|
||||
def test_font_size():
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import pytest
|
||||
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
|
||||
|
||||
def test_opengl_mobject_add(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import numpy as np
|
|||
import pytest
|
||||
|
||||
from manim import Circle, Line, Square, VDict, VGroup
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
|
||||
def test_opengl_vmobject_point_from_propotion(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import pytest
|
||||
|
||||
from manim import Animation, override_animation
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.utils.exceptions import MultiAnimationOverrideException
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manim import Scene, tempconfig
|
||||
from manim.mobject.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
|
||||
|
||||
def test_scene_add_remove(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
from colour import Color
|
||||
|
||||
import manim.utils.color as C
|
||||
from manim.mobject.types.opengl_vectorized_mobject import OpenGLVMobject
|
||||
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
|
||||
|
||||
|
||||
def test_stroke_props_in_ctor(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manim.mobject.svg.text_mobject import MarkupText, Text
|
||||
from manim.mobject.text.text_mobject import MarkupText, Text
|
||||
|
||||
|
||||
def test_font_size(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manim.mobject.value_tracker import ComplexValueTracker, ValueTracker
|
||||
from manim.animation.updaters.value_tracker import ComplexValueTracker, ValueTracker
|
||||
|
||||
|
||||
def test_value_tracker_set_value(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import numpy as np
|
|||
import pytest
|
||||
|
||||
from manim.animation.creation import Uncreate
|
||||
from manim.mobject.geometry import Dot, Line, Square
|
||||
from manim.mobject.geometry.arc import Dot
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import Square
|
||||
from manim.mobject.mobject import override_animate
|
||||
from manim.mobject.types.vectorized_mobject import VGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manim.mobject.coordinate_systems import Axes, ThreeDAxes
|
||||
from manim.utils.scale import LogBase
|
||||
from manim.mobject.graphing.coordinate_systems import Axes, ThreeDAxes
|
||||
from manim.mobject.graphing.scale import LogBase
|
||||
|
||||
|
||||
def test_axes_origin_shift():
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import numpy as np
|
|||
import pytest
|
||||
|
||||
from manim import Circle, Square
|
||||
from manim.mobject.boolean_ops import _BooleanOps
|
||||
from manim.mobject.geometry.boolean_ops import _BooleanOps
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ from manim.animation.composition import AnimationGroup, Succession
|
|||
from manim.animation.creation import Create, Write
|
||||
from manim.animation.fading import FadeIn, FadeOut
|
||||
from manim.constants import DOWN, UP
|
||||
from manim.mobject.geometry import Circle, Line, RegularPolygon, Square
|
||||
from manim.mobject.geometry.arc import Circle
|
||||
from manim.mobject.geometry.line import Line
|
||||
from manim.mobject.geometry.polygram import RegularPolygon, Square
|
||||
from manim.scene.scene import Scene
|
||||
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue