manim 0.18.0.post0__py3-none-any.whl → 0.18.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.
Potentially problematic release.
This version of manim might be problematic. Click here for more details.
- manim/__init__.py +3 -6
- manim/__main__.py +18 -10
- manim/_config/__init__.py +5 -2
- manim/_config/cli_colors.py +12 -8
- manim/_config/default.cfg +1 -1
- manim/_config/logger_utils.py +9 -8
- manim/_config/utils.py +637 -449
- manim/animation/animation.py +9 -2
- manim/animation/composition.py +78 -40
- manim/animation/creation.py +12 -6
- manim/animation/fading.py +0 -1
- manim/animation/indication.py +10 -21
- manim/animation/movement.py +1 -2
- manim/animation/rotation.py +1 -1
- manim/animation/specialized.py +1 -1
- manim/animation/speedmodifier.py +7 -2
- manim/animation/transform_matching_parts.py +1 -1
- manim/camera/camera.py +13 -4
- manim/cli/cfg/group.py +18 -8
- manim/cli/checkhealth/checks.py +2 -0
- manim/cli/checkhealth/commands.py +2 -0
- manim/cli/default_group.py +13 -5
- manim/cli/init/commands.py +4 -1
- manim/cli/plugins/commands.py +3 -0
- manim/cli/render/commands.py +27 -20
- manim/cli/render/ease_of_access_options.py +4 -3
- manim/cli/render/global_options.py +9 -7
- manim/cli/render/output_options.py +6 -5
- manim/cli/render/render_options.py +13 -13
- manim/constants.py +54 -15
- manim/gui/gui.py +2 -0
- manim/mobject/geometry/arc.py +4 -4
- manim/mobject/geometry/boolean_ops.py +13 -9
- manim/mobject/geometry/line.py +16 -8
- manim/mobject/geometry/polygram.py +17 -5
- manim/mobject/geometry/tips.py +2 -2
- manim/mobject/graph.py +379 -106
- manim/mobject/graphing/coordinate_systems.py +17 -20
- manim/mobject/graphing/functions.py +14 -10
- manim/mobject/graphing/number_line.py +1 -1
- manim/mobject/mobject.py +175 -72
- manim/mobject/opengl/opengl_compatibility.py +2 -0
- manim/mobject/opengl/opengl_geometry.py +26 -1
- manim/mobject/opengl/opengl_image_mobject.py +2 -0
- manim/mobject/opengl/opengl_mobject.py +3 -0
- manim/mobject/opengl/opengl_point_cloud_mobject.py +2 -0
- manim/mobject/opengl/opengl_surface.py +2 -0
- manim/mobject/opengl/opengl_three_dimensions.py +2 -0
- manim/mobject/opengl/opengl_vectorized_mobject.py +19 -14
- manim/mobject/svg/brace.py +2 -0
- manim/mobject/svg/svg_mobject.py +2 -2
- manim/mobject/table.py +0 -1
- manim/mobject/text/code_mobject.py +2 -0
- manim/mobject/text/numbers.py +2 -0
- manim/mobject/text/tex_mobject.py +1 -1
- manim/mobject/text/text_mobject.py +43 -6
- manim/mobject/three_d/three_d_utils.py +4 -4
- manim/mobject/three_d/three_dimensions.py +4 -4
- manim/mobject/types/image_mobject.py +5 -1
- manim/mobject/types/point_cloud_mobject.py +2 -0
- manim/mobject/types/vectorized_mobject.py +124 -29
- manim/mobject/value_tracker.py +3 -3
- manim/mobject/vector_field.py +3 -1
- manim/plugins/__init__.py +15 -1
- manim/plugins/plugins_flags.py +11 -5
- manim/renderer/cairo_renderer.py +12 -2
- manim/renderer/opengl_renderer.py +2 -3
- manim/renderer/opengl_renderer_window.py +2 -0
- manim/renderer/shader_wrapper.py +2 -0
- manim/renderer/vectorized_mobject_rendering.py +5 -0
- manim/scene/scene.py +22 -6
- manim/scene/scene_file_writer.py +3 -1
- manim/scene/section.py +2 -0
- manim/scene/three_d_scene.py +5 -6
- manim/scene/vector_space_scene.py +21 -5
- manim/typing.py +567 -67
- manim/utils/bezier.py +9 -18
- manim/utils/caching.py +2 -0
- manim/utils/color/BS381.py +1 -0
- manim/utils/color/XKCD.py +1 -0
- manim/utils/color/core.py +31 -13
- manim/utils/commands.py +8 -1
- manim/utils/debug.py +0 -1
- manim/utils/deprecation.py +3 -2
- manim/utils/docbuild/__init__.py +17 -0
- manim/utils/docbuild/autoaliasattr_directive.py +197 -0
- manim/utils/docbuild/autocolor_directive.py +9 -4
- manim/utils/docbuild/manim_directive.py +18 -9
- manim/utils/docbuild/module_parsing.py +198 -0
- manim/utils/exceptions.py +6 -0
- manim/utils/family.py +2 -0
- manim/utils/family_ops.py +5 -0
- manim/utils/file_ops.py +6 -2
- manim/utils/hashing.py +2 -0
- manim/utils/ipython_magic.py +2 -0
- manim/utils/module_ops.py +2 -0
- manim/utils/opengl.py +14 -0
- manim/utils/parameter_parsing.py +31 -0
- manim/utils/paths.py +12 -20
- manim/utils/rate_functions.py +6 -8
- manim/utils/space_ops.py +81 -36
- manim/utils/testing/__init__.py +17 -0
- manim/utils/testing/frames_comparison.py +7 -5
- manim/utils/tex.py +124 -196
- manim/utils/tex_file_writing.py +2 -0
- manim/utils/tex_templates.py +1 -0
- {manim-0.18.0.post0.dist-info → manim-0.18.1.dist-info}/LICENSE.community +1 -1
- {manim-0.18.0.post0.dist-info → manim-0.18.1.dist-info}/METADATA +29 -35
- manim-0.18.1.dist-info/RECORD +217 -0
- manim/cli/new/__init__.py +0 -0
- manim/cli/new/group.py +0 -189
- manim/plugins/import_plugins.py +0 -43
- manim-0.18.0.post0.dist-info/RECORD +0 -217
- {manim-0.18.0.post0.dist-info → manim-0.18.1.dist-info}/LICENSE +0 -0
- {manim-0.18.0.post0.dist-info → manim-0.18.1.dist-info}/WHEEL +0 -0
- {manim-0.18.0.post0.dist-info → manim-0.18.1.dist-info}/entry_points.txt +0 -0
manim/typing.py
CHANGED
|
@@ -1,133 +1,633 @@
|
|
|
1
|
+
"""Custom type definitions used in Manim.
|
|
2
|
+
|
|
3
|
+
.. admonition:: Note for developers
|
|
4
|
+
:class: important
|
|
5
|
+
|
|
6
|
+
Around the source code there are multiple strings which look like this:
|
|
7
|
+
|
|
8
|
+
.. code-block::
|
|
9
|
+
|
|
10
|
+
'''
|
|
11
|
+
[CATEGORY]
|
|
12
|
+
<category_name>
|
|
13
|
+
'''
|
|
14
|
+
|
|
15
|
+
All type aliases defined under those strings will be automatically
|
|
16
|
+
classified under that category.
|
|
17
|
+
|
|
18
|
+
If you need to define a new category, respect the format described above.
|
|
19
|
+
"""
|
|
20
|
+
|
|
1
21
|
from __future__ import annotations
|
|
2
22
|
|
|
3
23
|
from os import PathLike
|
|
4
|
-
from typing import Callable,
|
|
24
|
+
from typing import Callable, Union
|
|
5
25
|
|
|
6
26
|
import numpy as np
|
|
7
27
|
import numpy.typing as npt
|
|
8
28
|
from typing_extensions import TypeAlias
|
|
9
29
|
|
|
10
|
-
|
|
30
|
+
__all__ = [
|
|
31
|
+
"ManimFloat",
|
|
32
|
+
"ManimInt",
|
|
33
|
+
"ManimColorDType",
|
|
34
|
+
"RGB_Array_Float",
|
|
35
|
+
"RGB_Tuple_Float",
|
|
36
|
+
"RGB_Array_Int",
|
|
37
|
+
"RGB_Tuple_Int",
|
|
38
|
+
"RGBA_Array_Float",
|
|
39
|
+
"RGBA_Tuple_Float",
|
|
40
|
+
"RGBA_Array_Int",
|
|
41
|
+
"RGBA_Tuple_Int",
|
|
42
|
+
"HSV_Array_Float",
|
|
43
|
+
"HSV_Tuple_Float",
|
|
44
|
+
"ManimColorInternal",
|
|
45
|
+
"PointDType",
|
|
46
|
+
"InternalPoint2D",
|
|
47
|
+
"Point2D",
|
|
48
|
+
"InternalPoint2D_Array",
|
|
49
|
+
"Point2D_Array",
|
|
50
|
+
"InternalPoint3D",
|
|
51
|
+
"Point3D",
|
|
52
|
+
"InternalPoint3D_Array",
|
|
53
|
+
"Point3D_Array",
|
|
54
|
+
"Vector2D",
|
|
55
|
+
"Vector2D_Array",
|
|
56
|
+
"Vector3D",
|
|
57
|
+
"Vector3D_Array",
|
|
58
|
+
"VectorND",
|
|
59
|
+
"VectorND_Array",
|
|
60
|
+
"RowVector",
|
|
61
|
+
"ColVector",
|
|
62
|
+
"MatrixMN",
|
|
63
|
+
"Zeros",
|
|
64
|
+
"QuadraticBezierPoints",
|
|
65
|
+
"QuadraticBezierPoints_Array",
|
|
66
|
+
"QuadraticBezierPath",
|
|
67
|
+
"QuadraticSpline",
|
|
68
|
+
"CubicBezierPoints",
|
|
69
|
+
"CubicBezierPoints_Array",
|
|
70
|
+
"CubicBezierPath",
|
|
71
|
+
"CubicSpline",
|
|
72
|
+
"BezierPoints",
|
|
73
|
+
"BezierPoints_Array",
|
|
74
|
+
"BezierPath",
|
|
75
|
+
"Spline",
|
|
76
|
+
"FlatBezierPoints",
|
|
77
|
+
"FunctionOverride",
|
|
78
|
+
"PathFuncType",
|
|
79
|
+
"MappingFunction",
|
|
80
|
+
"Image",
|
|
81
|
+
"GrayscaleImage",
|
|
82
|
+
"RGBImage",
|
|
83
|
+
"RGBAImage",
|
|
84
|
+
"StrPath",
|
|
85
|
+
"StrOrBytesPath",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
"""
|
|
90
|
+
[CATEGORY]
|
|
91
|
+
Primitive data types
|
|
92
|
+
"""
|
|
11
93
|
|
|
12
94
|
ManimFloat: TypeAlias = np.float64
|
|
95
|
+
"""A double-precision floating-point value (64 bits, or 8 bytes),
|
|
96
|
+
according to the IEEE 754 standard.
|
|
97
|
+
"""
|
|
98
|
+
|
|
13
99
|
ManimInt: TypeAlias = np.int64
|
|
100
|
+
r"""A long integer (64 bits, or 8 bytes).
|
|
101
|
+
|
|
102
|
+
It can take values between :math:`-2^{63}` and :math:`+2^{63} - 1`,
|
|
103
|
+
which expressed in base 10 is a range between around
|
|
104
|
+
:math:`-9.223 \cdot 10^{18}` and :math:`+9.223 \cdot 10^{18}`.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
"""
|
|
109
|
+
[CATEGORY]
|
|
110
|
+
Color types
|
|
111
|
+
"""
|
|
112
|
+
|
|
14
113
|
ManimColorDType: TypeAlias = ManimFloat
|
|
114
|
+
"""Data type used in :class:`~.ManimColorInternal`: a
|
|
115
|
+
double-precision float between 0 and 1.
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
RGB_Array_Float: TypeAlias = npt.NDArray[ManimColorDType]
|
|
119
|
+
"""``shape: (3,)``
|
|
120
|
+
|
|
121
|
+
A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
|
|
122
|
+
color in RGB format.
|
|
15
123
|
|
|
16
|
-
|
|
17
|
-
|
|
124
|
+
Its components describe, in order, the intensity of Red, Green, and
|
|
125
|
+
Blue in the represented color.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
RGB_Tuple_Float: TypeAlias = tuple[float, float, float]
|
|
129
|
+
"""``shape: (3,)``
|
|
130
|
+
|
|
131
|
+
A tuple of 3 floats between 0 and 1, representing a color in RGB
|
|
132
|
+
format.
|
|
133
|
+
|
|
134
|
+
Its components describe, in order, the intensity of Red, Green, and
|
|
135
|
+
Blue in the represented color.
|
|
136
|
+
"""
|
|
18
137
|
|
|
19
138
|
RGB_Array_Int: TypeAlias = npt.NDArray[ManimInt]
|
|
20
|
-
|
|
139
|
+
"""``shape: (3,)``
|
|
140
|
+
|
|
141
|
+
A :class:`numpy.ndarray` of 3 integers between 0 and 255,
|
|
142
|
+
representing a color in RGB format.
|
|
143
|
+
|
|
144
|
+
Its components describe, in order, the intensity of Red, Green, and
|
|
145
|
+
Blue in the represented color.
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
RGB_Tuple_Int: TypeAlias = tuple[int, int, int]
|
|
149
|
+
"""``shape: (3,)``
|
|
150
|
+
|
|
151
|
+
A tuple of 3 integers between 0 and 255, representing a color in RGB
|
|
152
|
+
format.
|
|
153
|
+
|
|
154
|
+
Its components describe, in order, the intensity of Red, Green, and
|
|
155
|
+
Blue in the represented color.
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
RGBA_Array_Float: TypeAlias = npt.NDArray[ManimColorDType]
|
|
159
|
+
"""``shape: (4,)``
|
|
21
160
|
|
|
22
|
-
|
|
23
|
-
|
|
161
|
+
A :class:`numpy.ndarray` of 4 floats between 0 and 1, representing a
|
|
162
|
+
color in RGBA format.
|
|
163
|
+
|
|
164
|
+
Its components describe, in order, the intensity of Red, Green, Blue
|
|
165
|
+
and Alpha (opacity) in the represented color.
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
RGBA_Tuple_Float: TypeAlias = tuple[float, float, float, float]
|
|
169
|
+
"""``shape: (4,)``
|
|
170
|
+
|
|
171
|
+
A tuple of 4 floats between 0 and 1, representing a color in RGBA
|
|
172
|
+
format.
|
|
173
|
+
|
|
174
|
+
Its components describe, in order, the intensity of Red, Green, Blue
|
|
175
|
+
and Alpha (opacity) in the represented color.
|
|
176
|
+
"""
|
|
24
177
|
|
|
25
178
|
RGBA_Array_Int: TypeAlias = npt.NDArray[ManimInt]
|
|
26
|
-
|
|
179
|
+
"""``shape: (4,)``
|
|
180
|
+
|
|
181
|
+
A :class:`numpy.ndarray` of 4 integers between 0 and 255,
|
|
182
|
+
representing a color in RGBA format.
|
|
183
|
+
|
|
184
|
+
Its components describe, in order, the intensity of Red, Green, Blue
|
|
185
|
+
and Alpha (opacity) in the represented color.
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
RGBA_Tuple_Int: TypeAlias = tuple[int, int, int, int]
|
|
189
|
+
"""``shape: (4,)``
|
|
190
|
+
|
|
191
|
+
A tuple of 4 integers between 0 and 255, representing a color in RGBA
|
|
192
|
+
format.
|
|
193
|
+
|
|
194
|
+
Its components describe, in order, the intensity of Red, Green, Blue
|
|
195
|
+
and Alpha (opacity) in the represented color.
|
|
196
|
+
"""
|
|
27
197
|
|
|
28
198
|
HSV_Array_Float: TypeAlias = RGB_Array_Float
|
|
199
|
+
"""``shape: (3,)``
|
|
200
|
+
|
|
201
|
+
A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
|
|
202
|
+
color in HSV (or HSB) format.
|
|
203
|
+
|
|
204
|
+
Its components describe, in order, the Hue, Saturation and Value (or
|
|
205
|
+
Brightness) in the represented color.
|
|
206
|
+
"""
|
|
207
|
+
|
|
29
208
|
HSV_Tuple_Float: TypeAlias = RGB_Tuple_Float
|
|
209
|
+
"""``shape: (3,)``
|
|
210
|
+
|
|
211
|
+
A tuple of 3 floats between 0 and 1, representing a color in HSV (or
|
|
212
|
+
HSB) format.
|
|
30
213
|
|
|
31
|
-
|
|
214
|
+
Its components describe, in order, the Hue, Saturation and Value (or
|
|
215
|
+
Brightness) in the represented color.
|
|
216
|
+
"""
|
|
32
217
|
|
|
33
|
-
|
|
218
|
+
ManimColorInternal: TypeAlias = RGBA_Array_Float
|
|
219
|
+
"""``shape: (4,)``
|
|
220
|
+
|
|
221
|
+
Internal color representation used by :class:`~.ManimColor`,
|
|
222
|
+
following the RGBA format.
|
|
223
|
+
|
|
224
|
+
It is a :class:`numpy.ndarray` consisting of 4 floats between 0 and
|
|
225
|
+
1, describing respectively the intensities of Red, Green, Blue and
|
|
226
|
+
Alpha (opacity) in the represented color.
|
|
227
|
+
"""
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
"""
|
|
231
|
+
[CATEGORY]
|
|
232
|
+
Point types
|
|
233
|
+
"""
|
|
34
234
|
|
|
35
235
|
PointDType: TypeAlias = ManimFloat
|
|
36
|
-
"""
|
|
236
|
+
"""Default type for arrays representing points: a double-precision
|
|
237
|
+
floating point value.
|
|
238
|
+
"""
|
|
37
239
|
|
|
38
240
|
InternalPoint2D: TypeAlias = npt.NDArray[PointDType]
|
|
39
|
-
"""
|
|
40
|
-
|
|
241
|
+
"""``shape: (2,)``
|
|
242
|
+
|
|
243
|
+
A 2-dimensional point: ``[float, float]``.
|
|
244
|
+
|
|
245
|
+
.. note::
|
|
246
|
+
This type alias is mostly made available for internal use, and
|
|
247
|
+
only includes the NumPy type.
|
|
41
248
|
"""
|
|
42
249
|
|
|
43
|
-
Point2D: TypeAlias = Union[InternalPoint2D,
|
|
44
|
-
"""
|
|
250
|
+
Point2D: TypeAlias = Union[InternalPoint2D, tuple[float, float]]
|
|
251
|
+
"""``shape: (2,)``
|
|
45
252
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
253
|
+
A 2-dimensional point: ``[float, float]``.
|
|
254
|
+
|
|
255
|
+
Normally, a function or method which expects a `Point2D` as a
|
|
256
|
+
parameter can handle being passed a `Point3D` instead.
|
|
49
257
|
"""
|
|
50
258
|
|
|
51
|
-
|
|
52
|
-
"""
|
|
259
|
+
InternalPoint2D_Array: TypeAlias = npt.NDArray[PointDType]
|
|
260
|
+
"""``shape: (N, 2)``
|
|
53
261
|
|
|
54
|
-
|
|
55
|
-
QuadraticBezierPoints: TypeAlias = npt.NDArray[PointDType]
|
|
56
|
-
""" `shape: (3,3)` An Array of Quadratic Bezier Handles `[[float, float, float], [float, float, float], [float, float, float]]`. """
|
|
262
|
+
An array of `InternalPoint2D` objects: ``[[float, float], ...]``.
|
|
57
263
|
|
|
58
|
-
|
|
59
|
-
|
|
264
|
+
.. note::
|
|
265
|
+
This type alias is mostly made available for internal use, and
|
|
266
|
+
only includes the NumPy type.
|
|
267
|
+
"""
|
|
268
|
+
|
|
269
|
+
Point2D_Array: TypeAlias = Union[InternalPoint2D_Array, tuple[Point2D, ...]]
|
|
270
|
+
"""``shape: (N, 2)``
|
|
271
|
+
|
|
272
|
+
An array of `Point2D` objects: ``[[float, float], ...]``.
|
|
60
273
|
|
|
61
|
-
|
|
62
|
-
|
|
274
|
+
Normally, a function or method which expects a `Point2D_Array` as a
|
|
275
|
+
parameter can handle being passed a `Point3D_Array` instead.
|
|
63
276
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
`N` Is always multiples of the degree of the Bezier curve.
|
|
67
|
-
(Please refer to the documentation of the function you are using for further type Information)
|
|
277
|
+
Please refer to the documentation of the function you are using for
|
|
278
|
+
further type information.
|
|
68
279
|
"""
|
|
69
280
|
|
|
70
|
-
|
|
71
|
-
"""
|
|
281
|
+
InternalPoint3D: TypeAlias = npt.NDArray[PointDType]
|
|
282
|
+
"""``shape: (3,)``
|
|
283
|
+
|
|
284
|
+
A 3-dimensional point: ``[float, float, float]``.
|
|
285
|
+
|
|
286
|
+
.. note::
|
|
287
|
+
This type alias is mostly made available for internal use, and
|
|
288
|
+
only includes the NumPy type.
|
|
289
|
+
"""
|
|
72
290
|
|
|
73
|
-
|
|
74
|
-
"""
|
|
291
|
+
Point3D: TypeAlias = Union[InternalPoint3D, tuple[float, float, float]]
|
|
292
|
+
"""``shape: (3,)``
|
|
75
293
|
|
|
76
|
-
|
|
294
|
+
A 3-dimensional point: ``[float, float, float]``.
|
|
77
295
|
"""
|
|
78
296
|
|
|
79
297
|
InternalPoint3D_Array: TypeAlias = npt.NDArray[PointDType]
|
|
80
|
-
"""
|
|
81
|
-
|
|
298
|
+
"""``shape: (N, 3)``
|
|
299
|
+
|
|
300
|
+
An array of `Point3D` objects: ``[[float, float, float], ...]``.
|
|
301
|
+
|
|
302
|
+
.. note::
|
|
303
|
+
This type alias is mostly made available for internal use, and
|
|
304
|
+
only includes the NumPy type.
|
|
82
305
|
"""
|
|
83
306
|
|
|
84
|
-
Point3D_Array: TypeAlias = Union[
|
|
85
|
-
|
|
86
|
-
]
|
|
87
|
-
""" `shape: (N,3)` An Array of Points in 3D Space `[[float, float, float], ...]`.
|
|
307
|
+
Point3D_Array: TypeAlias = Union[InternalPoint3D_Array, tuple[Point3D, ...]]
|
|
308
|
+
"""``shape: (N, 3)``
|
|
88
309
|
|
|
89
|
-
|
|
310
|
+
An array of `Point3D` objects: ``[[float, float, float], ...]``.
|
|
311
|
+
|
|
312
|
+
Please refer to the documentation of the function you are using for
|
|
313
|
+
further type information.
|
|
90
314
|
"""
|
|
91
315
|
|
|
92
|
-
|
|
93
|
-
"""
|
|
94
|
-
|
|
95
|
-
|
|
316
|
+
|
|
317
|
+
"""
|
|
318
|
+
[CATEGORY]
|
|
319
|
+
Vector types
|
|
96
320
|
"""
|
|
97
321
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
322
|
+
Vector2D: TypeAlias = npt.NDArray[PointDType]
|
|
323
|
+
"""``shape: (2,)``
|
|
324
|
+
|
|
325
|
+
A 2-dimensional vector: ``[float, float]``.
|
|
326
|
+
|
|
327
|
+
Normally, a function or method which expects a `Vector2D` as a
|
|
328
|
+
parameter can handle being passed a `Vector3D` instead.
|
|
329
|
+
|
|
330
|
+
.. caution::
|
|
331
|
+
Do not confuse with the :class:`~.Vector` or :class:`~.Arrow`
|
|
332
|
+
VMobjects!
|
|
333
|
+
"""
|
|
334
|
+
|
|
335
|
+
Vector2D_Array: TypeAlias = npt.NDArray[PointDType]
|
|
336
|
+
"""``shape: (M, 2)``
|
|
337
|
+
|
|
338
|
+
An array of `Vector2D` objects: ``[[float, float], ...]``.
|
|
101
339
|
|
|
102
|
-
|
|
103
|
-
|
|
340
|
+
Normally, a function or method which expects a `Vector2D_Array` as a
|
|
341
|
+
parameter can handle being passed a `Vector3D_Array` instead.
|
|
342
|
+
"""
|
|
343
|
+
|
|
344
|
+
Vector3D: TypeAlias = npt.NDArray[PointDType]
|
|
345
|
+
"""``shape: (3,)``
|
|
346
|
+
|
|
347
|
+
A 3-dimensional vector: ``[float, float, float]``.
|
|
348
|
+
|
|
349
|
+
.. caution::
|
|
350
|
+
Do not confuse with the :class:`~.Vector` or :class:`~.Arrow3D`
|
|
351
|
+
VMobjects!
|
|
352
|
+
"""
|
|
353
|
+
|
|
354
|
+
Vector3D_Array: TypeAlias = npt.NDArray[PointDType]
|
|
355
|
+
"""``shape: (M, 3)``
|
|
356
|
+
|
|
357
|
+
An array of `Vector3D` objects: ``[[float, float, float], ...]``.
|
|
358
|
+
"""
|
|
359
|
+
|
|
360
|
+
VectorND: TypeAlias = npt.NDArray[PointDType]
|
|
361
|
+
"""``shape (N,)``
|
|
362
|
+
|
|
363
|
+
An :math:`N`-dimensional vector: ``[float, ...]``.
|
|
364
|
+
|
|
365
|
+
.. caution::
|
|
366
|
+
Do not confuse with the :class:`~.Vector` VMobject! This type alias
|
|
367
|
+
is named "VectorND" instead of "Vector" to avoid potential name
|
|
368
|
+
collisions.
|
|
369
|
+
"""
|
|
370
|
+
|
|
371
|
+
VectorND_Array: TypeAlias = npt.NDArray[PointDType]
|
|
372
|
+
"""``shape (M, N)``
|
|
373
|
+
|
|
374
|
+
An array of `VectorND` objects: ``[[float, ...], ...]``.
|
|
375
|
+
"""
|
|
104
376
|
|
|
105
377
|
RowVector: TypeAlias = npt.NDArray[PointDType]
|
|
106
|
-
"""
|
|
378
|
+
"""``shape: (1, N)``
|
|
379
|
+
|
|
380
|
+
A row vector: ``[[float, ...]]``.
|
|
381
|
+
"""
|
|
107
382
|
|
|
108
383
|
ColVector: TypeAlias = npt.NDArray[PointDType]
|
|
109
|
-
"""
|
|
384
|
+
"""``shape: (N, 1)``
|
|
385
|
+
|
|
386
|
+
A column vector: ``[[float], [float], ...]``.
|
|
387
|
+
"""
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
"""
|
|
391
|
+
[CATEGORY]
|
|
392
|
+
Matrix types
|
|
393
|
+
"""
|
|
110
394
|
|
|
111
395
|
MatrixMN: TypeAlias = npt.NDArray[PointDType]
|
|
112
|
-
"""
|
|
396
|
+
"""``shape: (M, N)``
|
|
397
|
+
|
|
398
|
+
A matrix: ``[[float, ...], [float, ...], ...]``.
|
|
399
|
+
"""
|
|
400
|
+
|
|
401
|
+
Zeros: TypeAlias = MatrixMN
|
|
402
|
+
"""``shape: (M, N)``
|
|
403
|
+
|
|
404
|
+
A `MatrixMN` filled with zeros, typically created with
|
|
405
|
+
``numpy.zeros((M, N))``.
|
|
406
|
+
"""
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
"""
|
|
410
|
+
[CATEGORY]
|
|
411
|
+
Bézier types
|
|
412
|
+
"""
|
|
413
|
+
|
|
414
|
+
QuadraticBezierPoints: TypeAlias = Union[
|
|
415
|
+
npt.NDArray[PointDType], tuple[Point3D, Point3D, Point3D]
|
|
416
|
+
]
|
|
417
|
+
"""``shape: (3, 3)``
|
|
418
|
+
|
|
419
|
+
A `Point3D_Array` of 3 control points for a single quadratic Bézier
|
|
420
|
+
curve:
|
|
421
|
+
``[[float, float, float], [float, float, float], [float, float, float]]``.
|
|
422
|
+
"""
|
|
423
|
+
|
|
424
|
+
QuadraticBezierPoints_Array: TypeAlias = Union[
|
|
425
|
+
npt.NDArray[PointDType], tuple[QuadraticBezierPoints, ...]
|
|
426
|
+
]
|
|
427
|
+
"""``shape: (N, 3, 3)``
|
|
428
|
+
|
|
429
|
+
An array of :math:`N` `QuadraticBezierPoints` objects:
|
|
430
|
+
``[[[float, float, float], [float, float, float], [float, float, float]], ...]``.
|
|
431
|
+
"""
|
|
432
|
+
|
|
433
|
+
QuadraticBezierPath: TypeAlias = Point3D_Array
|
|
434
|
+
"""``shape: (3*N, 3)``
|
|
435
|
+
|
|
436
|
+
A `Point3D_Array` of :math:`3N` points, where each one of the
|
|
437
|
+
:math:`N` consecutive blocks of 3 points represents a quadratic
|
|
438
|
+
Bézier curve:
|
|
439
|
+
``[[float, float, float], ...], ...]``.
|
|
440
|
+
|
|
441
|
+
Please refer to the documentation of the function you are using for
|
|
442
|
+
further type information.
|
|
443
|
+
"""
|
|
113
444
|
|
|
114
|
-
|
|
115
|
-
"""
|
|
445
|
+
QuadraticSpline: TypeAlias = QuadraticBezierPath
|
|
446
|
+
"""``shape: (3*N, 3)``
|
|
116
447
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
448
|
+
A special case of `QuadraticBezierPath` where all the :math:`N`
|
|
449
|
+
quadratic Bézier curves are connected, forming a quadratic spline:
|
|
450
|
+
``[[float, float, float], ...], ...]``.
|
|
451
|
+
|
|
452
|
+
Please refer to the documentation of the function you are using for
|
|
453
|
+
further type information.
|
|
454
|
+
"""
|
|
455
|
+
|
|
456
|
+
CubicBezierPoints: TypeAlias = Union[
|
|
457
|
+
npt.NDArray[PointDType], tuple[Point3D, Point3D, Point3D, Point3D]
|
|
458
|
+
]
|
|
459
|
+
"""``shape: (4, 3)``
|
|
460
|
+
|
|
461
|
+
A `Point3D_Array` of 4 control points for a single cubic Bézier
|
|
462
|
+
curve:
|
|
463
|
+
``[[float, float, float], [float, float, float], [float, float, float], [float, float, float]]``.
|
|
464
|
+
"""
|
|
465
|
+
|
|
466
|
+
CubicBezierPoints_Array: TypeAlias = Union[
|
|
467
|
+
npt.NDArray[PointDType], tuple[CubicBezierPoints, ...]
|
|
468
|
+
]
|
|
469
|
+
"""``shape: (N, 4, 3)``
|
|
470
|
+
|
|
471
|
+
An array of :math:`N` `CubicBezierPoints` objects:
|
|
472
|
+
``[[[float, float, float], [float, float, float], [float, float, float], [float, float, float]], ...]``.
|
|
473
|
+
"""
|
|
474
|
+
|
|
475
|
+
CubicBezierPath: TypeAlias = Point3D_Array
|
|
476
|
+
"""``shape: (4*N, 3)``
|
|
477
|
+
|
|
478
|
+
A `Point3D_Array` of :math:`4N` points, where each one of the
|
|
479
|
+
:math:`N` consecutive blocks of 4 points represents a cubic Bézier
|
|
480
|
+
curve:
|
|
481
|
+
``[[float, float, float], ...], ...]``.
|
|
482
|
+
|
|
483
|
+
Please refer to the documentation of the function you are using for
|
|
484
|
+
further type information.
|
|
485
|
+
"""
|
|
486
|
+
|
|
487
|
+
CubicSpline: TypeAlias = CubicBezierPath
|
|
488
|
+
"""``shape: (4*N, 3)``
|
|
489
|
+
|
|
490
|
+
A special case of `CubicBezierPath` where all the :math:`N` cubic
|
|
491
|
+
Bézier curves are connected, forming a quadratic spline:
|
|
492
|
+
``[[float, float, float], ...], ...]``.
|
|
493
|
+
|
|
494
|
+
Please refer to the documentation of the function you are using for
|
|
495
|
+
further type information.
|
|
496
|
+
"""
|
|
120
497
|
|
|
498
|
+
BezierPoints: TypeAlias = Point3D_Array
|
|
499
|
+
r"""``shape: (PPC, 3)``
|
|
500
|
+
|
|
501
|
+
A `Point3D_Array` of :math:`\text{PPC}` control points
|
|
502
|
+
(:math:`\text{PPC: Points Per Curve} = n + 1`) for a single
|
|
503
|
+
:math:`n`-th degree Bézier curve:
|
|
504
|
+
``[[float, float, float], ...]``.
|
|
505
|
+
|
|
506
|
+
Please refer to the documentation of the function you are using for
|
|
507
|
+
further type information.
|
|
508
|
+
"""
|
|
509
|
+
|
|
510
|
+
BezierPoints_Array: TypeAlias = Union[npt.NDArray[PointDType], tuple[BezierPoints, ...]]
|
|
511
|
+
r"""``shape: (N, PPC, 3)``
|
|
512
|
+
|
|
513
|
+
An array of :math:`N` `BezierPoints` objects containing
|
|
514
|
+
:math:`\text{PPC}` `Point3D` objects each
|
|
515
|
+
(:math:`\text{PPC: Points Per Curve} = n + 1`):
|
|
516
|
+
``[[[float, float, float], ...], ...]``.
|
|
517
|
+
|
|
518
|
+
Please refer to the documentation of the function you are using for
|
|
519
|
+
further type information.
|
|
520
|
+
"""
|
|
521
|
+
|
|
522
|
+
BezierPath: TypeAlias = Point3D_Array
|
|
523
|
+
r"""``shape: (PPC*N, 3)``
|
|
524
|
+
|
|
525
|
+
A `Point3D_Array` of :math:`\text{PPC} \cdot N` points, where each
|
|
526
|
+
one of the :math:`N` consecutive blocks of :math:`\text{PPC}` control
|
|
527
|
+
points (:math:`\text{PPC: Points Per Curve} = n + 1`) represents a
|
|
528
|
+
Bézier curve of :math:`n`-th degree:
|
|
529
|
+
``[[float, float, float], ...], ...]``.
|
|
530
|
+
|
|
531
|
+
Please refer to the documentation of the function you are using for
|
|
532
|
+
further type information.
|
|
533
|
+
"""
|
|
534
|
+
|
|
535
|
+
Spline: TypeAlias = BezierPath
|
|
536
|
+
r"""``shape: (PPC*N, 3)``
|
|
537
|
+
|
|
538
|
+
A special case of `BezierPath` where all the :math:`N` Bézier curves
|
|
539
|
+
consisting of :math:`\text{PPC}` `Point3D` objects
|
|
540
|
+
(:math:`\text{PPC: Points Per Curve} = n + 1`) are connected, forming
|
|
541
|
+
an :math:`n`-th degree spline:
|
|
542
|
+
``[[float, float, float], ...], ...]``.
|
|
543
|
+
|
|
544
|
+
Please refer to the documentation of the function you are using for
|
|
545
|
+
further type information.
|
|
546
|
+
"""
|
|
547
|
+
|
|
548
|
+
FlatBezierPoints: TypeAlias = Union[npt.NDArray[PointDType], tuple[float, ...]]
|
|
549
|
+
"""``shape: (3*PPC*N,)``
|
|
550
|
+
|
|
551
|
+
A flattened array of Bézier control points:
|
|
552
|
+
``[float, ...]``.
|
|
553
|
+
"""
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
"""
|
|
557
|
+
[CATEGORY]
|
|
558
|
+
Function types
|
|
559
|
+
"""
|
|
560
|
+
|
|
561
|
+
# Due to current limitations
|
|
562
|
+
# (see https://github.com/python/mypy/issues/14656 / 8263),
|
|
563
|
+
# we don't specify the first argument type (Mobject).
|
|
564
|
+
# Nor are we able to specify the return type (Animation) since we cannot import
|
|
565
|
+
# that here.
|
|
566
|
+
FunctionOverride: TypeAlias = Callable
|
|
567
|
+
"""Function type returning an :class:`~.Animation` for the specified
|
|
568
|
+
:class:`~.Mobject`.
|
|
569
|
+
"""
|
|
121
570
|
|
|
122
|
-
# Misc
|
|
123
571
|
PathFuncType: TypeAlias = Callable[[Point3D, Point3D, float], Point3D]
|
|
124
|
-
"""Function mapping two
|
|
572
|
+
"""Function mapping two `Point3D` objects and an alpha value to a new
|
|
573
|
+
`Point3D`.
|
|
574
|
+
"""
|
|
125
575
|
|
|
126
576
|
MappingFunction: TypeAlias = Callable[[Point3D], Point3D]
|
|
127
|
-
"""A function mapping a Point3D to another Point3D"""
|
|
577
|
+
"""A function mapping a `Point3D` to another `Point3D`."""
|
|
128
578
|
|
|
129
|
-
Image: TypeAlias = np.ndarray
|
|
130
|
-
"""An Image"""
|
|
131
579
|
|
|
132
|
-
|
|
133
|
-
|
|
580
|
+
"""
|
|
581
|
+
[CATEGORY]
|
|
582
|
+
Image types
|
|
583
|
+
"""
|
|
584
|
+
|
|
585
|
+
Image: TypeAlias = npt.NDArray[ManimInt]
|
|
586
|
+
"""``shape: (height, width) | (height, width, 3) | (height, width, 4)``
|
|
587
|
+
|
|
588
|
+
A rasterized image with a height of ``height`` pixels and a width of
|
|
589
|
+
``width`` pixels.
|
|
590
|
+
|
|
591
|
+
Every value in the array is an integer from 0 to 255.
|
|
592
|
+
|
|
593
|
+
Every pixel is represented either by a single integer indicating its
|
|
594
|
+
lightness (for greyscale images), an `RGB_Array_Int` or an
|
|
595
|
+
`RGBA_Array_Int`.
|
|
596
|
+
"""
|
|
597
|
+
|
|
598
|
+
GrayscaleImage: TypeAlias = Image
|
|
599
|
+
"""``shape: (height, width)``
|
|
600
|
+
|
|
601
|
+
A 100% opaque grayscale `Image`, where every pixel value is a
|
|
602
|
+
`ManimInt` indicating its lightness (black -> gray -> white).
|
|
603
|
+
"""
|
|
604
|
+
|
|
605
|
+
RGBImage: TypeAlias = Image
|
|
606
|
+
"""``shape: (height, width, 3)``
|
|
607
|
+
|
|
608
|
+
A 100% opaque `Image` in color, where every pixel value is an
|
|
609
|
+
`RGB_Array_Int` object.
|
|
610
|
+
"""
|
|
611
|
+
|
|
612
|
+
RGBAImage: TypeAlias = Image
|
|
613
|
+
"""``shape: (height, width, 4)``
|
|
614
|
+
|
|
615
|
+
An `Image` in color where pixels can be transparent. Every pixel
|
|
616
|
+
value is an `RGBA_Array_Int` object.
|
|
617
|
+
"""
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
"""
|
|
621
|
+
[CATEGORY]
|
|
622
|
+
Path types
|
|
623
|
+
"""
|
|
624
|
+
|
|
625
|
+
StrPath: TypeAlias = Union[str, PathLike[str]]
|
|
626
|
+
"""A string or :class:`os.PathLike` representing a path to a
|
|
627
|
+
directory or file.
|
|
628
|
+
"""
|
|
629
|
+
|
|
630
|
+
StrOrBytesPath: TypeAlias = Union[str, bytes, PathLike[str], PathLike[bytes]]
|
|
631
|
+
"""A string, bytes or :class:`os.PathLike` object representing a path
|
|
632
|
+
to a directory or file.
|
|
633
|
+
"""
|