manim 0.17.0__py3-none-any.whl → 0.19.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- manim/__init__.py +11 -6
- manim/__main__.py +62 -19
- manim/_config/__init__.py +10 -9
- manim/_config/cli_colors.py +26 -9
- manim/_config/default.cfg +1 -3
- manim/_config/logger_utils.py +23 -13
- manim/_config/utils.py +662 -468
- manim/animation/animation.py +164 -18
- manim/animation/changing.py +34 -23
- manim/animation/composition.py +265 -67
- manim/animation/creation.py +208 -26
- manim/animation/fading.py +16 -18
- manim/animation/growing.py +35 -15
- manim/animation/indication.py +150 -76
- manim/animation/movement.py +56 -22
- manim/animation/numbers.py +64 -6
- manim/animation/rotation.py +78 -7
- manim/animation/specialized.py +6 -7
- manim/animation/speedmodifier.py +13 -10
- manim/animation/transform.py +14 -11
- manim/animation/transform_matching_parts.py +3 -4
- manim/animation/updaters/mobject_update_utils.py +152 -30
- manim/animation/updaters/update.py +10 -7
- manim/camera/camera.py +182 -118
- manim/camera/mapping_camera.py +34 -3
- manim/camera/moving_camera.py +95 -74
- manim/camera/multi_camera.py +23 -15
- manim/camera/three_d_camera.py +70 -52
- manim/cli/__init__.py +17 -0
- manim/cli/cfg/group.py +76 -44
- manim/cli/checkhealth/checks.py +192 -0
- manim/cli/checkhealth/commands.py +90 -0
- manim/cli/default_group.py +158 -25
- manim/cli/init/commands.py +33 -25
- manim/cli/plugins/commands.py +16 -3
- manim/cli/render/commands.py +72 -60
- manim/cli/render/ease_of_access_options.py +4 -3
- manim/cli/render/global_options.py +59 -17
- manim/cli/render/output_options.py +6 -5
- manim/cli/render/render_options.py +98 -33
- manim/constants.py +109 -59
- manim/data_structures.py +31 -0
- manim/mobject/frame.py +8 -5
- manim/mobject/geometry/__init__.py +1 -0
- manim/mobject/geometry/arc.py +277 -135
- manim/mobject/geometry/boolean_ops.py +32 -31
- manim/mobject/geometry/labeled.py +376 -0
- manim/mobject/geometry/line.py +192 -87
- manim/mobject/geometry/polygram.py +224 -58
- manim/mobject/geometry/shape_matchers.py +61 -25
- manim/mobject/geometry/tips.py +122 -48
- manim/mobject/graph.py +1027 -419
- manim/mobject/graphing/coordinate_systems.py +533 -278
- manim/mobject/graphing/functions.py +53 -32
- manim/mobject/graphing/number_line.py +123 -65
- manim/mobject/graphing/probability.py +88 -62
- manim/mobject/graphing/scale.py +33 -19
- manim/mobject/logo.py +118 -28
- manim/mobject/matrix.py +87 -83
- manim/mobject/mobject.py +912 -442
- manim/mobject/opengl/dot_cloud.py +16 -5
- manim/mobject/opengl/opengl_compatibility.py +4 -2
- manim/mobject/opengl/opengl_geometry.py +254 -153
- manim/mobject/opengl/opengl_image_mobject.py +3 -1
- manim/mobject/opengl/opengl_mobject.py +779 -482
- manim/mobject/opengl/opengl_point_cloud_mobject.py +41 -14
- manim/mobject/opengl/opengl_surface.py +14 -92
- manim/mobject/opengl/opengl_three_dimensions.py +12 -8
- manim/mobject/opengl/opengl_vectorized_mobject.py +98 -100
- manim/mobject/svg/brace.py +173 -41
- manim/mobject/svg/svg_mobject.py +139 -53
- manim/mobject/table.py +61 -68
- manim/mobject/text/code_mobject.py +193 -539
- manim/mobject/text/numbers.py +81 -34
- manim/mobject/text/tex_mobject.py +130 -78
- manim/mobject/text/text_mobject.py +288 -164
- manim/mobject/three_d/polyhedra.py +111 -13
- manim/mobject/three_d/three_d_utils.py +17 -8
- manim/mobject/three_d/three_dimensions.py +239 -106
- manim/mobject/types/image_mobject.py +50 -30
- manim/mobject/types/point_cloud_mobject.py +120 -75
- manim/mobject/types/vectorized_mobject.py +841 -408
- manim/mobject/value_tracker.py +105 -38
- manim/mobject/vector_field.py +50 -31
- manim/opengl/__init__.py +3 -3
- manim/plugins/__init__.py +14 -1
- manim/plugins/plugins_flags.py +10 -14
- manim/renderer/cairo_renderer.py +65 -50
- manim/renderer/opengl_renderer.py +89 -69
- manim/renderer/opengl_renderer_window.py +39 -18
- manim/renderer/shader.py +123 -87
- manim/renderer/shader_wrapper.py +44 -28
- manim/renderer/vectorized_mobject_rendering.py +38 -10
- manim/scene/moving_camera_scene.py +32 -3
- manim/scene/scene.py +507 -242
- manim/scene/scene_file_writer.py +371 -220
- manim/scene/section.py +20 -16
- manim/scene/three_d_scene.py +14 -22
- manim/scene/vector_space_scene.py +223 -129
- manim/scene/zoomed_scene.py +46 -41
- manim/typing.py +990 -0
- manim/utils/bezier.py +1823 -371
- manim/utils/caching.py +12 -5
- manim/utils/color/AS2700.py +236 -0
- manim/utils/color/BS381.py +318 -0
- manim/utils/color/DVIPSNAMES.py +96 -0
- manim/utils/color/SVGNAMES.py +179 -0
- manim/utils/color/X11.py +533 -0
- manim/utils/color/XKCD.py +952 -0
- manim/utils/color/__init__.py +61 -0
- manim/utils/color/core.py +1667 -0
- manim/utils/color/manim_colors.py +218 -0
- manim/utils/commands.py +48 -20
- manim/utils/config_ops.py +39 -19
- manim/utils/debug.py +8 -7
- manim/utils/deprecation.py +86 -39
- manim/utils/docbuild/__init__.py +17 -0
- manim/utils/docbuild/autoaliasattr_directive.py +236 -0
- manim/utils/docbuild/autocolor_directive.py +99 -0
- manim/utils/docbuild/manim_directive.py +94 -41
- manim/utils/docbuild/module_parsing.py +245 -0
- manim/utils/exceptions.py +6 -0
- manim/utils/family.py +5 -3
- manim/utils/family_ops.py +17 -4
- manim/utils/file_ops.py +27 -17
- manim/utils/hashing.py +55 -45
- manim/utils/images.py +13 -7
- manim/utils/ipython_magic.py +13 -7
- manim/utils/iterables.py +163 -120
- manim/utils/module_ops.py +66 -24
- manim/utils/opengl.py +77 -24
- manim/utils/parameter_parsing.py +32 -0
- manim/utils/paths.py +30 -33
- manim/utils/polylabel.py +235 -0
- manim/utils/qhull.py +218 -0
- manim/utils/rate_functions.py +98 -32
- manim/utils/simple_functions.py +25 -33
- manim/utils/sounds.py +7 -1
- manim/utils/space_ops.py +188 -115
- manim/utils/testing/__init__.py +17 -0
- manim/utils/testing/_frames_testers.py +13 -8
- manim/utils/testing/_show_diff.py +5 -3
- manim/utils/testing/_test_class_makers.py +34 -18
- manim/utils/testing/frames_comparison.py +37 -19
- manim/utils/tex.py +130 -198
- manim/utils/tex_file_writing.py +77 -47
- manim/utils/tex_templates.py +2 -1
- manim/utils/unit.py +6 -5
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/METADATA +64 -65
- manim-0.19.1.dist-info/RECORD +220 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/WHEEL +1 -1
- manim-0.19.1.dist-info/entry_points.txt +3 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE.community +1 -1
- manim/cli/new/group.py +0 -189
- manim/communitycolors.py +0 -9
- manim/gui/__init__.py +0 -0
- manim/gui/gui.py +0 -82
- manim/plugins/import_plugins.py +0 -43
- manim/utils/color.py +0 -552
- manim-0.17.0.dist-info/RECORD +0 -206
- manim-0.17.0.dist-info/entry_points.txt +0 -4
- /manim/cli/{new → checkhealth}/__init__.py +0 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE +0 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from collections.abc import Hashable
|
|
6
|
+
from typing import TYPE_CHECKING, Any
|
|
6
7
|
|
|
7
8
|
import numpy as np
|
|
8
9
|
|
|
@@ -10,11 +11,20 @@ from manim.mobject.geometry.polygram import Polygon
|
|
|
10
11
|
from manim.mobject.graph import Graph
|
|
11
12
|
from manim.mobject.three_d.three_dimensions import Dot3D
|
|
12
13
|
from manim.mobject.types.vectorized_mobject import VGroup
|
|
14
|
+
from manim.utils.qhull import QuickHull
|
|
13
15
|
|
|
14
16
|
if TYPE_CHECKING:
|
|
15
17
|
from manim.mobject.mobject import Mobject
|
|
18
|
+
from manim.typing import Point3D, Point3DLike_Array
|
|
16
19
|
|
|
17
|
-
__all__ = [
|
|
20
|
+
__all__ = [
|
|
21
|
+
"Polyhedron",
|
|
22
|
+
"Tetrahedron",
|
|
23
|
+
"Octahedron",
|
|
24
|
+
"Icosahedron",
|
|
25
|
+
"Dodecahedron",
|
|
26
|
+
"ConvexHull3D",
|
|
27
|
+
]
|
|
18
28
|
|
|
19
29
|
|
|
20
30
|
class Polyhedron(VGroup):
|
|
@@ -87,10 +97,10 @@ class Polyhedron(VGroup):
|
|
|
87
97
|
|
|
88
98
|
def __init__(
|
|
89
99
|
self,
|
|
90
|
-
vertex_coords:
|
|
100
|
+
vertex_coords: Point3DLike_Array,
|
|
91
101
|
faces_list: list[list[int]],
|
|
92
102
|
faces_config: dict[str, str | int | float | bool] = {},
|
|
93
|
-
graph_config: dict[str,
|
|
103
|
+
graph_config: dict[str, Any] = {},
|
|
94
104
|
):
|
|
95
105
|
super().__init__()
|
|
96
106
|
self.faces_config = dict(
|
|
@@ -107,7 +117,7 @@ class Polyhedron(VGroup):
|
|
|
107
117
|
)
|
|
108
118
|
self.vertex_coords = vertex_coords
|
|
109
119
|
self.vertex_indices = list(range(len(self.vertex_coords)))
|
|
110
|
-
self.layout = dict(enumerate(self.vertex_coords))
|
|
120
|
+
self.layout: dict[Hashable, Any] = dict(enumerate(self.vertex_coords))
|
|
111
121
|
self.faces_list = faces_list
|
|
112
122
|
self.face_coords = [[self.layout[j] for j in i] for i in faces_list]
|
|
113
123
|
self.edges = self.get_edges(self.faces_list)
|
|
@@ -120,14 +130,14 @@ class Polyhedron(VGroup):
|
|
|
120
130
|
|
|
121
131
|
def get_edges(self, faces_list: list[list[int]]) -> list[tuple[int, int]]:
|
|
122
132
|
"""Creates list of cyclic pairwise tuples."""
|
|
123
|
-
edges = []
|
|
133
|
+
edges: list[tuple[int, int]] = []
|
|
124
134
|
for face in faces_list:
|
|
125
135
|
edges += zip(face, face[1:] + face[:1])
|
|
126
136
|
return edges
|
|
127
137
|
|
|
128
138
|
def create_faces(
|
|
129
139
|
self,
|
|
130
|
-
face_coords:
|
|
140
|
+
face_coords: Point3DLike_Array,
|
|
131
141
|
) -> VGroup:
|
|
132
142
|
"""Creates VGroup of faces from a list of face coordinates."""
|
|
133
143
|
face_group = VGroup()
|
|
@@ -135,12 +145,12 @@ class Polyhedron(VGroup):
|
|
|
135
145
|
face_group.add(Polygon(*face, **self.faces_config))
|
|
136
146
|
return face_group
|
|
137
147
|
|
|
138
|
-
def update_faces(self, m: Mobject):
|
|
148
|
+
def update_faces(self, m: Mobject) -> None:
|
|
139
149
|
face_coords = self.extract_face_coords()
|
|
140
150
|
new_faces = self.create_faces(face_coords)
|
|
141
151
|
self.faces.match_points(new_faces)
|
|
142
152
|
|
|
143
|
-
def extract_face_coords(self) ->
|
|
153
|
+
def extract_face_coords(self) -> Point3DLike_Array:
|
|
144
154
|
"""Extracts the coordinates of the vertices in the graph.
|
|
145
155
|
Used for updating faces.
|
|
146
156
|
"""
|
|
@@ -172,7 +182,7 @@ class Tetrahedron(Polyhedron):
|
|
|
172
182
|
self.add(obj)
|
|
173
183
|
"""
|
|
174
184
|
|
|
175
|
-
def __init__(self, edge_length: float = 1, **kwargs):
|
|
185
|
+
def __init__(self, edge_length: float = 1, **kwargs: Any):
|
|
176
186
|
unit = edge_length * np.sqrt(2) / 4
|
|
177
187
|
super().__init__(
|
|
178
188
|
vertex_coords=[
|
|
@@ -207,7 +217,7 @@ class Octahedron(Polyhedron):
|
|
|
207
217
|
self.add(obj)
|
|
208
218
|
"""
|
|
209
219
|
|
|
210
|
-
def __init__(self, edge_length: float = 1, **kwargs):
|
|
220
|
+
def __init__(self, edge_length: float = 1, **kwargs: Any):
|
|
211
221
|
unit = edge_length * np.sqrt(2) / 2
|
|
212
222
|
super().__init__(
|
|
213
223
|
vertex_coords=[
|
|
@@ -253,7 +263,7 @@ class Icosahedron(Polyhedron):
|
|
|
253
263
|
self.add(obj)
|
|
254
264
|
"""
|
|
255
265
|
|
|
256
|
-
def __init__(self, edge_length: float = 1, **kwargs):
|
|
266
|
+
def __init__(self, edge_length: float = 1, **kwargs: Any):
|
|
257
267
|
unit_a = edge_length * ((1 + np.sqrt(5)) / 4)
|
|
258
268
|
unit_b = edge_length * (1 / 2)
|
|
259
269
|
super().__init__(
|
|
@@ -318,7 +328,7 @@ class Dodecahedron(Polyhedron):
|
|
|
318
328
|
self.add(obj)
|
|
319
329
|
"""
|
|
320
330
|
|
|
321
|
-
def __init__(self, edge_length: float = 1, **kwargs):
|
|
331
|
+
def __init__(self, edge_length: float = 1, **kwargs: Any):
|
|
322
332
|
unit_a = edge_length * ((1 + np.sqrt(5)) / 4)
|
|
323
333
|
unit_b = edge_length * ((3 + np.sqrt(5)) / 4)
|
|
324
334
|
unit_c = edge_length * (1 / 2)
|
|
@@ -361,3 +371,91 @@ class Dodecahedron(Polyhedron):
|
|
|
361
371
|
],
|
|
362
372
|
**kwargs,
|
|
363
373
|
)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class ConvexHull3D(Polyhedron):
|
|
377
|
+
"""A convex hull for a set of points
|
|
378
|
+
|
|
379
|
+
Parameters
|
|
380
|
+
----------
|
|
381
|
+
points
|
|
382
|
+
The points to consider.
|
|
383
|
+
tolerance
|
|
384
|
+
The tolerance used for quickhull.
|
|
385
|
+
kwargs
|
|
386
|
+
Forwarded to the parent constructor.
|
|
387
|
+
|
|
388
|
+
Examples
|
|
389
|
+
--------
|
|
390
|
+
.. manim:: ConvexHull3DExample
|
|
391
|
+
:save_last_frame:
|
|
392
|
+
:quality: high
|
|
393
|
+
|
|
394
|
+
class ConvexHull3DExample(ThreeDScene):
|
|
395
|
+
def construct(self):
|
|
396
|
+
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
|
|
397
|
+
points = [
|
|
398
|
+
[ 1.93192757, 0.44134585, -1.52407061],
|
|
399
|
+
[-0.93302521, 1.23206983, 0.64117067],
|
|
400
|
+
[-0.44350918, -0.61043677, 0.21723705],
|
|
401
|
+
[-0.42640268, -1.05260843, 1.61266094],
|
|
402
|
+
[-1.84449637, 0.91238739, -1.85172623],
|
|
403
|
+
[ 1.72068132, -0.11880457, 0.51881751],
|
|
404
|
+
[ 0.41904805, 0.44938012, -1.86440686],
|
|
405
|
+
[ 0.83864666, 1.66653337, 1.88960123],
|
|
406
|
+
[ 0.22240514, -0.80986286, 1.34249326],
|
|
407
|
+
[-1.29585759, 1.01516189, 0.46187522],
|
|
408
|
+
[ 1.7776499, -1.59550796, -1.70240747],
|
|
409
|
+
[ 0.80065226, -0.12530398, 1.70063977],
|
|
410
|
+
[ 1.28960948, -1.44158255, 1.39938582],
|
|
411
|
+
[-0.93538943, 1.33617705, -0.24852643],
|
|
412
|
+
[-1.54868271, 1.7444399, -0.46170734]
|
|
413
|
+
]
|
|
414
|
+
hull = ConvexHull3D(
|
|
415
|
+
*points,
|
|
416
|
+
faces_config = {"stroke_opacity": 0},
|
|
417
|
+
graph_config = {
|
|
418
|
+
"vertex_type": Dot3D,
|
|
419
|
+
"edge_config": {
|
|
420
|
+
"stroke_color": BLUE,
|
|
421
|
+
"stroke_width": 2,
|
|
422
|
+
"stroke_opacity": 0.05,
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
dots = VGroup(*[Dot3D(point) for point in points])
|
|
427
|
+
self.add(hull)
|
|
428
|
+
self.add(dots)
|
|
429
|
+
"""
|
|
430
|
+
|
|
431
|
+
def __init__(self, *points: Point3D, tolerance: float = 1e-5, **kwargs: Any):
|
|
432
|
+
# Build Convex Hull
|
|
433
|
+
array = np.array(points)
|
|
434
|
+
hull = QuickHull(tolerance)
|
|
435
|
+
hull.build(array)
|
|
436
|
+
|
|
437
|
+
# Setup Lists
|
|
438
|
+
vertices = []
|
|
439
|
+
faces = []
|
|
440
|
+
|
|
441
|
+
# Extract Faces
|
|
442
|
+
c = 0
|
|
443
|
+
d = {}
|
|
444
|
+
facets = set(hull.facets) - hull.removed
|
|
445
|
+
for facet in facets:
|
|
446
|
+
tmp = set()
|
|
447
|
+
for subfacet in facet.subfacets:
|
|
448
|
+
for point in subfacet.points:
|
|
449
|
+
if point not in d:
|
|
450
|
+
vertices.append(point.coordinates)
|
|
451
|
+
d[point] = c
|
|
452
|
+
c += 1
|
|
453
|
+
tmp.add(point)
|
|
454
|
+
faces.append([d[point] for point in tmp])
|
|
455
|
+
|
|
456
|
+
# Call Polyhedron
|
|
457
|
+
super().__init__(
|
|
458
|
+
vertex_coords=vertices,
|
|
459
|
+
faces_list=faces,
|
|
460
|
+
**kwargs,
|
|
461
|
+
)
|
|
@@ -14,40 +14,49 @@ __all__ = [
|
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
from typing import TYPE_CHECKING, Literal
|
|
18
|
+
|
|
17
19
|
import numpy as np
|
|
18
20
|
|
|
19
21
|
from manim.constants import ORIGIN, UP
|
|
20
22
|
from manim.utils.space_ops import get_unit_normal
|
|
21
23
|
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from manim.typing import Point3D, Vector3D
|
|
26
|
+
|
|
27
|
+
from ..types.vectorized_mobject import VMobject
|
|
28
|
+
|
|
22
29
|
|
|
23
|
-
def get_3d_vmob_gradient_start_and_end_points(
|
|
30
|
+
def get_3d_vmob_gradient_start_and_end_points(
|
|
31
|
+
vmob: VMobject,
|
|
32
|
+
) -> tuple[Point3D, Point3D]:
|
|
24
33
|
return (
|
|
25
34
|
get_3d_vmob_start_corner(vmob),
|
|
26
35
|
get_3d_vmob_end_corner(vmob),
|
|
27
36
|
)
|
|
28
37
|
|
|
29
38
|
|
|
30
|
-
def get_3d_vmob_start_corner_index(vmob):
|
|
39
|
+
def get_3d_vmob_start_corner_index(vmob: VMobject) -> Literal[0]:
|
|
31
40
|
return 0
|
|
32
41
|
|
|
33
42
|
|
|
34
|
-
def get_3d_vmob_end_corner_index(vmob):
|
|
43
|
+
def get_3d_vmob_end_corner_index(vmob: VMobject) -> int:
|
|
35
44
|
return ((len(vmob.points) - 1) // 6) * 3
|
|
36
45
|
|
|
37
46
|
|
|
38
|
-
def get_3d_vmob_start_corner(vmob):
|
|
47
|
+
def get_3d_vmob_start_corner(vmob: VMobject) -> Point3D:
|
|
39
48
|
if vmob.get_num_points() == 0:
|
|
40
49
|
return np.array(ORIGIN)
|
|
41
50
|
return vmob.points[get_3d_vmob_start_corner_index(vmob)]
|
|
42
51
|
|
|
43
52
|
|
|
44
|
-
def get_3d_vmob_end_corner(vmob):
|
|
53
|
+
def get_3d_vmob_end_corner(vmob: VMobject) -> Point3D:
|
|
45
54
|
if vmob.get_num_points() == 0:
|
|
46
55
|
return np.array(ORIGIN)
|
|
47
56
|
return vmob.points[get_3d_vmob_end_corner_index(vmob)]
|
|
48
57
|
|
|
49
58
|
|
|
50
|
-
def get_3d_vmob_unit_normal(vmob, point_index):
|
|
59
|
+
def get_3d_vmob_unit_normal(vmob: VMobject, point_index: int) -> Vector3D:
|
|
51
60
|
n_points = vmob.get_num_points()
|
|
52
61
|
if len(vmob.get_anchors()) <= 2:
|
|
53
62
|
return np.array(UP)
|
|
@@ -63,9 +72,9 @@ def get_3d_vmob_unit_normal(vmob, point_index):
|
|
|
63
72
|
return unit_normal
|
|
64
73
|
|
|
65
74
|
|
|
66
|
-
def get_3d_vmob_start_corner_unit_normal(vmob):
|
|
75
|
+
def get_3d_vmob_start_corner_unit_normal(vmob: VMobject) -> Vector3D:
|
|
67
76
|
return get_3d_vmob_unit_normal(vmob, get_3d_vmob_start_corner_index(vmob))
|
|
68
77
|
|
|
69
78
|
|
|
70
|
-
def get_3d_vmob_end_corner_unit_normal(vmob):
|
|
79
|
+
def get_3d_vmob_end_corner_unit_normal(vmob: VMobject) -> Vector3D:
|
|
71
80
|
return get_3d_vmob_unit_normal(vmob, get_3d_vmob_end_corner_index(vmob))
|