manim 0.18.0.post0__py3-none-any.whl → 0.19.0__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.

Files changed (146) hide show
  1. manim/__init__.py +3 -6
  2. manim/__main__.py +61 -20
  3. manim/_config/__init__.py +6 -3
  4. manim/_config/cli_colors.py +16 -8
  5. manim/_config/default.cfg +1 -3
  6. manim/_config/logger_utils.py +14 -8
  7. manim/_config/utils.py +651 -472
  8. manim/animation/animation.py +152 -5
  9. manim/animation/composition.py +80 -39
  10. manim/animation/creation.py +196 -14
  11. manim/animation/fading.py +5 -9
  12. manim/animation/indication.py +103 -47
  13. manim/animation/movement.py +22 -5
  14. manim/animation/rotation.py +3 -2
  15. manim/animation/specialized.py +4 -6
  16. manim/animation/speedmodifier.py +10 -5
  17. manim/animation/transform.py +4 -5
  18. manim/animation/transform_matching_parts.py +1 -1
  19. manim/animation/updaters/mobject_update_utils.py +17 -14
  20. manim/camera/camera.py +15 -6
  21. manim/cli/__init__.py +17 -0
  22. manim/cli/cfg/group.py +70 -44
  23. manim/cli/checkhealth/checks.py +93 -75
  24. manim/cli/checkhealth/commands.py +14 -5
  25. manim/cli/default_group.py +157 -25
  26. manim/cli/init/commands.py +32 -24
  27. manim/cli/plugins/commands.py +16 -3
  28. manim/cli/render/commands.py +72 -60
  29. manim/cli/render/ease_of_access_options.py +4 -3
  30. manim/cli/render/global_options.py +51 -15
  31. manim/cli/render/output_options.py +6 -5
  32. manim/cli/render/render_options.py +97 -32
  33. manim/constants.py +65 -19
  34. manim/gui/gui.py +2 -0
  35. manim/mobject/frame.py +0 -1
  36. manim/mobject/geometry/arc.py +112 -78
  37. manim/mobject/geometry/boolean_ops.py +32 -25
  38. manim/mobject/geometry/labeled.py +300 -77
  39. manim/mobject/geometry/line.py +132 -64
  40. manim/mobject/geometry/polygram.py +126 -30
  41. manim/mobject/geometry/shape_matchers.py +35 -15
  42. manim/mobject/geometry/tips.py +38 -29
  43. manim/mobject/graph.py +414 -133
  44. manim/mobject/graphing/coordinate_systems.py +126 -64
  45. manim/mobject/graphing/functions.py +25 -15
  46. manim/mobject/graphing/number_line.py +24 -10
  47. manim/mobject/graphing/probability.py +2 -10
  48. manim/mobject/graphing/scale.py +6 -5
  49. manim/mobject/matrix.py +17 -19
  50. manim/mobject/mobject.py +314 -165
  51. manim/mobject/opengl/opengl_compatibility.py +2 -0
  52. manim/mobject/opengl/opengl_geometry.py +30 -9
  53. manim/mobject/opengl/opengl_image_mobject.py +2 -0
  54. manim/mobject/opengl/opengl_mobject.py +509 -343
  55. manim/mobject/opengl/opengl_point_cloud_mobject.py +5 -7
  56. manim/mobject/opengl/opengl_surface.py +3 -2
  57. manim/mobject/opengl/opengl_three_dimensions.py +2 -0
  58. manim/mobject/opengl/opengl_vectorized_mobject.py +46 -79
  59. manim/mobject/svg/brace.py +63 -13
  60. manim/mobject/svg/svg_mobject.py +4 -3
  61. manim/mobject/table.py +11 -13
  62. manim/mobject/text/code_mobject.py +186 -548
  63. manim/mobject/text/numbers.py +9 -7
  64. manim/mobject/text/tex_mobject.py +23 -14
  65. manim/mobject/text/text_mobject.py +70 -24
  66. manim/mobject/three_d/polyhedra.py +98 -1
  67. manim/mobject/three_d/three_d_utils.py +4 -4
  68. manim/mobject/three_d/three_dimensions.py +62 -34
  69. manim/mobject/types/image_mobject.py +42 -24
  70. manim/mobject/types/point_cloud_mobject.py +105 -67
  71. manim/mobject/types/vectorized_mobject.py +496 -228
  72. manim/mobject/value_tracker.py +5 -4
  73. manim/mobject/vector_field.py +5 -5
  74. manim/opengl/__init__.py +3 -3
  75. manim/plugins/__init__.py +14 -1
  76. manim/plugins/plugins_flags.py +14 -8
  77. manim/renderer/cairo_renderer.py +20 -10
  78. manim/renderer/opengl_renderer.py +21 -23
  79. manim/renderer/opengl_renderer_window.py +2 -0
  80. manim/renderer/shader.py +2 -3
  81. manim/renderer/shader_wrapper.py +5 -2
  82. manim/renderer/vectorized_mobject_rendering.py +5 -0
  83. manim/scene/moving_camera_scene.py +23 -0
  84. manim/scene/scene.py +90 -43
  85. manim/scene/scene_file_writer.py +316 -165
  86. manim/scene/section.py +17 -15
  87. manim/scene/three_d_scene.py +13 -21
  88. manim/scene/vector_space_scene.py +22 -9
  89. manim/typing.py +830 -70
  90. manim/utils/bezier.py +1667 -399
  91. manim/utils/caching.py +13 -5
  92. manim/utils/color/AS2700.py +2 -0
  93. manim/utils/color/BS381.py +3 -0
  94. manim/utils/color/DVIPSNAMES.py +96 -0
  95. manim/utils/color/SVGNAMES.py +179 -0
  96. manim/utils/color/X11.py +3 -0
  97. manim/utils/color/XKCD.py +3 -0
  98. manim/utils/color/__init__.py +8 -5
  99. manim/utils/color/core.py +844 -309
  100. manim/utils/color/manim_colors.py +7 -9
  101. manim/utils/commands.py +48 -20
  102. manim/utils/config_ops.py +18 -13
  103. manim/utils/debug.py +8 -7
  104. manim/utils/deprecation.py +90 -40
  105. manim/utils/docbuild/__init__.py +17 -0
  106. manim/utils/docbuild/autoaliasattr_directive.py +234 -0
  107. manim/utils/docbuild/autocolor_directive.py +21 -17
  108. manim/utils/docbuild/manim_directive.py +50 -35
  109. manim/utils/docbuild/module_parsing.py +245 -0
  110. manim/utils/exceptions.py +6 -0
  111. manim/utils/family.py +5 -3
  112. manim/utils/family_ops.py +17 -4
  113. manim/utils/file_ops.py +26 -16
  114. manim/utils/hashing.py +9 -7
  115. manim/utils/images.py +10 -4
  116. manim/utils/ipython_magic.py +14 -8
  117. manim/utils/iterables.py +161 -119
  118. manim/utils/module_ops.py +57 -19
  119. manim/utils/opengl.py +83 -24
  120. manim/utils/parameter_parsing.py +32 -0
  121. manim/utils/paths.py +21 -23
  122. manim/utils/polylabel.py +168 -0
  123. manim/utils/qhull.py +218 -0
  124. manim/utils/rate_functions.py +74 -39
  125. manim/utils/simple_functions.py +24 -15
  126. manim/utils/sounds.py +7 -1
  127. manim/utils/space_ops.py +125 -69
  128. manim/utils/testing/__init__.py +17 -0
  129. manim/utils/testing/_frames_testers.py +13 -8
  130. manim/utils/testing/_show_diff.py +5 -3
  131. manim/utils/testing/_test_class_makers.py +33 -18
  132. manim/utils/testing/frames_comparison.py +27 -19
  133. manim/utils/tex.py +127 -197
  134. manim/utils/tex_file_writing.py +47 -45
  135. manim/utils/tex_templates.py +2 -1
  136. manim/utils/unit.py +6 -5
  137. {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/LICENSE.community +1 -1
  138. {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/METADATA +40 -39
  139. manim-0.19.0.dist-info/RECORD +221 -0
  140. {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/WHEEL +1 -1
  141. manim/cli/new/__init__.py +0 -0
  142. manim/cli/new/group.py +0 -189
  143. manim/plugins/import_plugins.py +0 -43
  144. manim-0.18.0.post0.dist-info/RECORD +0 -217
  145. {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/LICENSE +0 -0
  146. {manim-0.18.0.post0.dist-info → manim-0.19.0.dist-info}/entry_points.txt +0 -0
manim/typing.py CHANGED
@@ -1,133 +1,893 @@
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
 
23
+ from collections.abc import Sequence
3
24
  from os import PathLike
4
- from typing import Callable, Tuple, Union
25
+ from typing import Callable, Union
5
26
 
6
27
  import numpy as np
7
28
  import numpy.typing as npt
8
29
  from typing_extensions import TypeAlias
9
30
 
10
- # Color Types
31
+ __all__ = [
32
+ "ManimFloat",
33
+ "ManimInt",
34
+ "ManimColorDType",
35
+ "RGB_Array_Float",
36
+ "RGB_Tuple_Float",
37
+ "RGB_Array_Int",
38
+ "RGB_Tuple_Int",
39
+ "RGBA_Array_Float",
40
+ "RGBA_Tuple_Float",
41
+ "RGBA_Array_Int",
42
+ "RGBA_Tuple_Int",
43
+ "HSV_Array_Float",
44
+ "HSV_Tuple_Float",
45
+ "HSL_Array_Float",
46
+ "HSL_Tuple_Float",
47
+ "HSVA_Array_Float",
48
+ "HSVA_Tuple_Float",
49
+ "ManimColorInternal",
50
+ "PointDType",
51
+ "Point2D",
52
+ "Point2DLike",
53
+ "Point2D_Array",
54
+ "Point2DLike_Array",
55
+ "Point3D",
56
+ "Point3DLike",
57
+ "Point3D_Array",
58
+ "Point3DLike_Array",
59
+ "PointND",
60
+ "PointNDLike",
61
+ "PointND_Array",
62
+ "PointNDLike_Array",
63
+ "Vector2D",
64
+ "Vector2D_Array",
65
+ "Vector3D",
66
+ "Vector3D_Array",
67
+ "VectorND",
68
+ "VectorND_Array",
69
+ "RowVector",
70
+ "ColVector",
71
+ "MatrixMN",
72
+ "Zeros",
73
+ "QuadraticBezierPoints",
74
+ "QuadraticBezierPointsLike",
75
+ "QuadraticBezierPoints_Array",
76
+ "QuadraticBezierPointsLike_Array",
77
+ "QuadraticBezierPath",
78
+ "QuadraticBezierPathLike",
79
+ "QuadraticSpline",
80
+ "QuadraticSplineLike",
81
+ "CubicBezierPoints",
82
+ "CubicBezierPointsLike",
83
+ "CubicBezierPoints_Array",
84
+ "CubicBezierPointsLike_Array",
85
+ "CubicBezierPath",
86
+ "CubicBezierPathLike",
87
+ "CubicSpline",
88
+ "CubicSplineLike",
89
+ "BezierPoints",
90
+ "BezierPointsLike",
91
+ "BezierPoints_Array",
92
+ "BezierPointsLike_Array",
93
+ "BezierPath",
94
+ "BezierPathLike",
95
+ "Spline",
96
+ "SplineLike",
97
+ "FlatBezierPoints",
98
+ "FunctionOverride",
99
+ "PathFuncType",
100
+ "MappingFunction",
101
+ "MultiMappingFunction",
102
+ "PixelArray",
103
+ "GrayscalePixelArray",
104
+ "RGBPixelArray",
105
+ "RGBAPixelArray",
106
+ "StrPath",
107
+ "StrOrBytesPath",
108
+ ]
109
+
110
+
111
+ """
112
+ [CATEGORY]
113
+ Primitive data types
114
+ """
11
115
 
12
116
  ManimFloat: TypeAlias = np.float64
117
+ """A double-precision floating-point value (64 bits, or 8 bytes),
118
+ according to the IEEE 754 standard.
119
+ """
120
+
13
121
  ManimInt: TypeAlias = np.int64
122
+ r"""A long integer (64 bits, or 8 bytes).
123
+
124
+ It can take values between :math:`-2^{63}` and :math:`+2^{63} - 1`,
125
+ which expressed in base 10 is a range between around
126
+ :math:`-9.223 \cdot 10^{18}` and :math:`+9.223 \cdot 10^{18}`.
127
+ """
128
+
129
+
130
+ """
131
+ [CATEGORY]
132
+ Color types
133
+ """
134
+
14
135
  ManimColorDType: TypeAlias = ManimFloat
136
+ """Data type used in :class:`~.ManimColorInternal`: a
137
+ double-precision float between 0 and 1.
138
+ """
139
+
140
+ RGB_Array_Float: TypeAlias = npt.NDArray[ManimColorDType]
141
+ """``shape: (3,)``
142
+
143
+ A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
144
+ color in RGB format.
145
+
146
+ Its components describe, in order, the intensity of Red, Green, and
147
+ Blue in the represented color.
148
+ """
149
+
150
+ RGB_Tuple_Float: TypeAlias = tuple[float, float, float]
151
+ """``shape: (3,)``
15
152
 
16
- RGB_Array_Float: TypeAlias = npt.NDArray[ManimFloat]
17
- RGB_Tuple_Float: TypeAlias = Tuple[float, float, float]
153
+ A tuple of 3 floats between 0 and 1, representing a color in RGB
154
+ format.
155
+
156
+ Its components describe, in order, the intensity of Red, Green, and
157
+ Blue in the represented color.
158
+ """
18
159
 
19
160
  RGB_Array_Int: TypeAlias = npt.NDArray[ManimInt]
20
- RGB_Tuple_Int: TypeAlias = Tuple[int, int, int]
161
+ """``shape: (3,)``
162
+
163
+ A :class:`numpy.ndarray` of 3 integers between 0 and 255,
164
+ representing a color in RGB format.
165
+
166
+ Its components describe, in order, the intensity of Red, Green, and
167
+ Blue in the represented color.
168
+ """
169
+
170
+ RGB_Tuple_Int: TypeAlias = tuple[int, int, int]
171
+ """``shape: (3,)``
172
+
173
+ A tuple of 3 integers between 0 and 255, representing a color in RGB
174
+ format.
175
+
176
+ Its components describe, in order, the intensity of Red, Green, and
177
+ Blue in the represented color.
178
+ """
21
179
 
22
- RGBA_Array_Float: TypeAlias = npt.NDArray[ManimFloat]
23
- RGBA_Tuple_Float: TypeAlias = Tuple[float, float, float, float]
180
+ RGBA_Array_Float: TypeAlias = npt.NDArray[ManimColorDType]
181
+ """``shape: (4,)``
182
+
183
+ A :class:`numpy.ndarray` of 4 floats between 0 and 1, representing a
184
+ color in RGBA format.
185
+
186
+ Its components describe, in order, the intensity of Red, Green, Blue
187
+ and Alpha (opacity) in the represented color.
188
+ """
189
+
190
+ RGBA_Tuple_Float: TypeAlias = tuple[float, float, float, float]
191
+ """``shape: (4,)``
192
+
193
+ A tuple of 4 floats between 0 and 1, representing a color in RGBA
194
+ format.
195
+
196
+ Its components describe, in order, the intensity of Red, Green, Blue
197
+ and Alpha (opacity) in the represented color.
198
+ """
24
199
 
25
200
  RGBA_Array_Int: TypeAlias = npt.NDArray[ManimInt]
26
- RGBA_Tuple_Int: TypeAlias = Tuple[int, int, int, int]
201
+ """``shape: (4,)``
202
+
203
+ A :class:`numpy.ndarray` of 4 integers between 0 and 255,
204
+ representing a color in RGBA format.
205
+
206
+ Its components describe, in order, the intensity of Red, Green, Blue
207
+ and Alpha (opacity) in the represented color.
208
+ """
209
+
210
+ RGBA_Tuple_Int: TypeAlias = tuple[int, int, int, int]
211
+ """``shape: (4,)``
212
+
213
+ A tuple of 4 integers between 0 and 255, representing a color in RGBA
214
+ format.
215
+
216
+ Its components describe, in order, the intensity of Red, Green, Blue
217
+ and Alpha (opacity) in the represented color.
218
+ """
27
219
 
28
220
  HSV_Array_Float: TypeAlias = RGB_Array_Float
221
+ """``shape: (3,)``
222
+
223
+ A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
224
+ color in HSV (or HSB) format.
225
+
226
+ Its components describe, in order, the Hue, Saturation and Value (or
227
+ Brightness) in the represented color.
228
+ """
229
+
29
230
  HSV_Tuple_Float: TypeAlias = RGB_Tuple_Float
231
+ """``shape: (3,)``
30
232
 
31
- ManimColorInternal: TypeAlias = npt.NDArray[ManimColorDType]
233
+ A tuple of 3 floats between 0 and 1, representing a color in HSV (or
234
+ HSB) format.
32
235
 
33
- # Point Types
236
+ Its components describe, in order, the Hue, Saturation and Value (or
237
+ Brightness) in the represented color.
238
+ """
34
239
 
35
- PointDType: TypeAlias = ManimFloat
36
- """ DType for all points. """
240
+ HSVA_Array_Float: TypeAlias = RGBA_Array_Float
241
+ """``shape: (4,)``
242
+
243
+ A :class:`numpy.ndarray` of 4 floats between 0 and 1, representing a
244
+ color in HSVA (or HSBA) format.
37
245
 
38
- InternalPoint2D: TypeAlias = npt.NDArray[PointDType]
39
- """ `shape: (2,)` A 2D point. `[float, float]`.
40
- This type alias is mostly made available for internal use and only includes the numpy type.
246
+ Its components describe, in order, the Hue, Saturation and Value (or
247
+ Brightness) in the represented color.
41
248
  """
42
249
 
43
- Point2D: TypeAlias = Union[InternalPoint2D, Tuple[float, float]]
44
- """ `shape: (2,)` A 2D point. `[float, float]`. """
250
+ HSVA_Tuple_Float: TypeAlias = RGBA_Tuple_Float
251
+ """``shape: (4,)``
45
252
 
46
- InternalPoint3D: TypeAlias = npt.NDArray[PointDType]
47
- """ `shape: (3,)` A 3D point. `[float, float, float]`.
48
- This type alias is mostly made available for internal use and only includes the numpy type.
253
+ A tuple of 4 floats between 0 and 1, representing a color in HSVA (or
254
+ HSBA) format.
255
+
256
+ Its components describe, in order, the Hue, Saturation and Value (or
257
+ Brightness) in the represented color.
49
258
  """
50
259
 
51
- Point3D: TypeAlias = Union[InternalPoint3D, Tuple[float, float, float]]
52
- """ `shape: (3,)` A 3D point. `[float, float, float]` """
260
+ HSL_Array_Float: TypeAlias = RGB_Array_Float
261
+ """``shape: (3,)``
53
262
 
54
- # Bezier Types
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]]`. """
263
+ A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
264
+ color in HSL format.
57
265
 
58
- QuadraticBezierPoints_Array: TypeAlias = npt.NDArray[PointDType]
59
- """ `shape: (N,3,3)` An Array of Quadratic Bezier Handles `[[[float, float, float], [float, float, float], [float, float, float]], ...]`. """
266
+ Its components describe, in order, the Hue, Saturation and Lightness
267
+ in the represented color.
268
+ """
269
+
270
+ HSL_Tuple_Float: TypeAlias = RGB_Tuple_Float
271
+ """``shape: (3,)``
272
+
273
+ A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
274
+ color in HSL format.
275
+
276
+ Its components describe, in order, the Hue, Saturation and Lightness
277
+ in the represented color.
278
+ """
279
+
280
+ ManimColorInternal: TypeAlias = RGBA_Array_Float
281
+ """``shape: (4,)``
282
+
283
+ Internal color representation used by :class:`~.ManimColor`,
284
+ following the RGBA format.
285
+
286
+ It is a :class:`numpy.ndarray` consisting of 4 floats between 0 and
287
+ 1, describing respectively the intensities of Red, Green, Blue and
288
+ Alpha (opacity) in the represented color.
289
+ """
290
+
291
+
292
+ """
293
+ [CATEGORY]
294
+ Point types
295
+ """
60
296
 
61
- CubicBezierPoints: TypeAlias = npt.NDArray[PointDType]
62
- """ `shape: (4,3)` An Array of Cubic Bezier Handles `[[float, float, float], [float, float, float], [float, float, float], [float, float, float]]`. """
297
+ PointDType: TypeAlias = ManimFloat
298
+ """Default type for arrays representing points: a double-precision
299
+ floating point value.
300
+ """
301
+
302
+ Point2D: TypeAlias = npt.NDArray[PointDType]
303
+ """``shape: (2,)``
63
304
 
64
- BezierPoints: TypeAlias = npt.NDArray[PointDType]
65
- """ `shape: (N,3)` An Array of Cubic Bezier Handles `[[float, float, float], ...]`.
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)
305
+ A NumPy array representing a 2-dimensional point: ``[float, float]``.
68
306
  """
69
307
 
70
- FlatBezierPoints: TypeAlias = npt.NDArray[PointDType]
71
- """ `shape: (N)` An Array of Bezier Handles but flattened `[float, ...]`."""
308
+ Point2DLike: TypeAlias = Union[Point2D, tuple[float, float]]
309
+ """``shape: (2,)``
310
+
311
+ A 2-dimensional point: ``[float, float]``.
312
+
313
+ This represents anything which can be converted to a :class:`Point2D` NumPy
314
+ array.
315
+
316
+ Normally, a function or method which expects a `Point2D` as a
317
+ parameter can handle being passed a `Point3D` instead.
318
+ """
72
319
 
73
320
  Point2D_Array: TypeAlias = npt.NDArray[PointDType]
74
- """ `shape: (N,2)` An Array of Points in 2D Space `[[float, float], ...]`.
321
+ """``shape: (M, 2)``
75
322
 
76
- (Please refer to the documentation of the function you are using for further type Information)
323
+ A NumPy array representing a sequence of `Point2D` objects:
324
+ ``[[float, float], ...]``.
77
325
  """
78
326
 
79
- InternalPoint3D_Array: TypeAlias = npt.NDArray[PointDType]
80
- """ `shape: (N,3)` An Array of Points in 3D Space `[[float, float, float], ...]`.
81
- This type alias is mostly made available for internal use and only includes the numpy type.
327
+ Point2DLike_Array: TypeAlias = Union[Point2D_Array, Sequence[Point2DLike]]
328
+ """``shape: (M, 2)``
329
+
330
+ An array of `Point2DLike` objects: ``[[float, float], ...]``.
331
+
332
+ This represents anything which can be converted to a :class:`Point2D_Array`
333
+ NumPy array.
334
+
335
+ Normally, a function or method which expects a `Point2D_Array` as a
336
+ parameter can handle being passed a `Point3D_Array` instead.
337
+
338
+ Please refer to the documentation of the function you are using for
339
+ further type information.
82
340
  """
83
341
 
84
- Point3D_Array: TypeAlias = Union[
85
- InternalPoint3D_Array, Tuple[Tuple[float, float, float], ...]
86
- ]
87
- """ `shape: (N,3)` An Array of Points in 3D Space `[[float, float, float], ...]`.
342
+ Point3D: TypeAlias = npt.NDArray[PointDType]
343
+ """``shape: (3,)``
88
344
 
89
- (Please refer to the documentation of the function you are using for further type Information)
345
+ A NumPy array representing a 3-dimensional point: ``[float, float, float]``.
90
346
  """
91
347
 
92
- BezierPoints_Array: TypeAlias = npt.NDArray[PointDType]
93
- """ `shape: (N,PPC,3)` An Array of Bezier Handles `[[[float, float, float], ...], ...]`.
94
- `PPC` Is the number of points per bezier curve. `N` Is the number of bezier curves.
95
- (Please refer to the documentation of the function you are using for further type Information)
348
+ Point3DLike: TypeAlias = Union[Point3D, tuple[float, float, float]]
349
+ """``shape: (3,)``
350
+
351
+ A 3-dimensional point: ``[float, float, float]``.
352
+
353
+ This represents anything which can be converted to a :class:`Point3D` NumPy
354
+ array.
96
355
  """
97
356
 
98
- # Vector Types
99
- Vector3: TypeAlias = npt.NDArray[PointDType]
100
- """ `shape: (3,)` A Vector `[float, float, float]`. """
357
+ Point3D_Array: TypeAlias = npt.NDArray[PointDType]
358
+ """``shape: (M, 3)``
359
+
360
+ A NumPy array representing a sequence of `Point3D` objects:
361
+ ``[[float, float, float], ...]``.
362
+ """
363
+
364
+ Point3DLike_Array: TypeAlias = Union[Point3D_Array, Sequence[Point3DLike]]
365
+ """``shape: (M, 3)``
366
+
367
+ An array of `Point3D` objects: ``[[float, float, float], ...]``.
368
+
369
+ This represents anything which can be converted to a :class:`Point3D_Array`
370
+ NumPy array.
371
+
372
+ Please refer to the documentation of the function you are using for
373
+ further type information.
374
+ """
375
+
376
+ PointND: TypeAlias = npt.NDArray[PointDType]
377
+ """``shape: (N,)``
378
+
379
+ A NumPy array representing an N-dimensional point: ``[float, ...]``.
380
+ """
381
+
382
+ PointNDLike: TypeAlias = Union[PointND, Sequence[float]]
383
+ """``shape: (N,)``
384
+
385
+ An N-dimensional point: ``[float, ...]``.
386
+
387
+ This represents anything which can be converted to a :class:`PointND` NumPy
388
+ array.
389
+ """
390
+
391
+ PointND_Array: TypeAlias = npt.NDArray[PointDType]
392
+ """``shape: (M, N)``
393
+
394
+ A NumPy array representing a sequence of `PointND` objects:
395
+ ``[[float, ...], ...]``.
396
+ """
397
+
398
+ PointNDLike_Array: TypeAlias = Union[PointND_Array, Sequence[PointNDLike]]
399
+ """``shape: (M, N)``
400
+
401
+ An array of `PointND` objects: ``[[float, ...], ...]``.
402
+
403
+ This represents anything which can be converted to a :class:`PointND_Array`
404
+ NumPy array.
405
+
406
+ Please refer to the documentation of the function you are using for
407
+ further type information.
408
+ """
101
409
 
102
- Vector: TypeAlias = npt.NDArray[PointDType]
103
- """ `shape: (N,)` A Vector `[float, ...]`. """
410
+
411
+ """
412
+ [CATEGORY]
413
+ Vector types
414
+ """
415
+
416
+ Vector2D: TypeAlias = npt.NDArray[PointDType]
417
+ """``shape: (2,)``
418
+
419
+ A 2-dimensional vector: ``[float, float]``.
420
+
421
+ Normally, a function or method which expects a `Vector2D` as a
422
+ parameter can handle being passed a `Vector3D` instead.
423
+
424
+ .. caution::
425
+ Do not confuse with the :class:`~.Vector` or :class:`~.Arrow`
426
+ VMobjects!
427
+ """
428
+
429
+ Vector2D_Array: TypeAlias = npt.NDArray[PointDType]
430
+ """``shape: (M, 2)``
431
+
432
+ An array of `Vector2D` objects: ``[[float, float], ...]``.
433
+
434
+ Normally, a function or method which expects a `Vector2D_Array` as a
435
+ parameter can handle being passed a `Vector3D_Array` instead.
436
+ """
437
+
438
+ Vector3D: TypeAlias = npt.NDArray[PointDType]
439
+ """``shape: (3,)``
440
+
441
+ A 3-dimensional vector: ``[float, float, float]``.
442
+
443
+ .. caution::
444
+ Do not confuse with the :class:`~.Vector` or :class:`~.Arrow3D`
445
+ VMobjects!
446
+ """
447
+
448
+ Vector3D_Array: TypeAlias = npt.NDArray[PointDType]
449
+ """``shape: (M, 3)``
450
+
451
+ An array of `Vector3D` objects: ``[[float, float, float], ...]``.
452
+ """
453
+
454
+ VectorND: TypeAlias = npt.NDArray[PointDType]
455
+ """``shape (N,)``
456
+
457
+ An :math:`N`-dimensional vector: ``[float, ...]``.
458
+
459
+ .. caution::
460
+ Do not confuse with the :class:`~.Vector` VMobject! This type alias
461
+ is named "VectorND" instead of "Vector" to avoid potential name
462
+ collisions.
463
+ """
464
+
465
+ VectorND_Array: TypeAlias = npt.NDArray[PointDType]
466
+ """``shape (M, N)``
467
+
468
+ An array of `VectorND` objects: ``[[float, ...], ...]``.
469
+ """
104
470
 
105
471
  RowVector: TypeAlias = npt.NDArray[PointDType]
106
- """ `shape: (1,N)` A Row Vector `[[float, ...]]`. """
472
+ """``shape: (1, N)``
473
+
474
+ A row vector: ``[[float, ...]]``.
475
+ """
107
476
 
108
477
  ColVector: TypeAlias = npt.NDArray[PointDType]
109
- """ `shape: (N,1)` A Column Vector `[[float], [float], ...]`. """
478
+ """``shape: (N, 1)``
479
+
480
+ A column vector: ``[[float], [float], ...]``.
481
+ """
482
+
483
+
484
+ """
485
+ [CATEGORY]
486
+ Matrix types
487
+ """
110
488
 
111
489
  MatrixMN: TypeAlias = npt.NDArray[PointDType]
112
- """ `shape: (M,N)` A Matrix `[[float, ...], [float, ...], ...]`. """
490
+ """``shape: (M, N)``
491
+
492
+ A matrix: ``[[float, ...], [float, ...], ...]``.
493
+ """
113
494
 
114
- Zeros: TypeAlias = npt.NDArray[ManimFloat]
115
- """A Matrix of Zeros. Typically created with `numpy.zeros((M,N))`"""
495
+ Zeros: TypeAlias = MatrixMN
496
+ """``shape: (M, N)``
116
497
 
117
- # Due to current limitations (see https://github.com/python/mypy/issues/14656 / 8263), we don't specify the first argument type (Mobject).
118
- FunctionOverride: TypeAlias = Callable[..., None]
119
- """Function type returning an animation for the specified Mobject."""
498
+ A `MatrixMN` filled with zeros, typically created with
499
+ ``numpy.zeros((M, N))``.
500
+ """
501
+
502
+
503
+ """
504
+ [CATEGORY]
505
+ Bézier types
506
+ """
507
+
508
+ QuadraticBezierPoints: TypeAlias = Point3D_Array
509
+ """``shape: (3, 3)``
510
+
511
+ A `Point3D_Array` of three 3D control points for a single quadratic Bézier
512
+ curve:
513
+ ``[[float, float, float], [float, float, float], [float, float, float]]``.
514
+ """
515
+
516
+ QuadraticBezierPointsLike: TypeAlias = Union[
517
+ QuadraticBezierPoints, tuple[Point3DLike, Point3DLike, Point3DLike]
518
+ ]
519
+ """``shape: (3, 3)``
520
+
521
+ A `Point3DLike_Array` of three 3D control points for a single quadratic Bézier
522
+ curve:
523
+ ``[[float, float, float], [float, float, float], [float, float, float]]``.
524
+
525
+ This represents anything which can be converted to a
526
+ :class:`QuadraticBezierPoints` NumPy array.
527
+ """
528
+
529
+ QuadraticBezierPoints_Array: TypeAlias = npt.NDArray[PointDType]
530
+ """``shape: (N, 3, 3)``
531
+
532
+ A NumPy array containing :math:`N` `QuadraticBezierPoints` objects:
533
+ ``[[[float, float, float], [float, float, float], [float, float, float]], ...]``.
534
+ """
535
+
536
+ QuadraticBezierPointsLike_Array: TypeAlias = Union[
537
+ QuadraticBezierPoints_Array, Sequence[QuadraticBezierPointsLike]
538
+ ]
539
+ """``shape: (N, 3, 3)``
540
+
541
+ A sequence of :math:`N` `QuadraticBezierPointsLike` objects:
542
+ ``[[[float, float, float], [float, float, float], [float, float, float]], ...]``.
543
+
544
+ This represents anything which can be converted to a
545
+ :class:`QuadraticBezierPoints_Array` NumPy array.
546
+ """
547
+
548
+ QuadraticBezierPath: TypeAlias = Point3D_Array
549
+ """``shape: (3*N, 3)``
550
+
551
+ A `Point3D_Array` of :math:`3N` points, where each one of the
552
+ :math:`N` consecutive blocks of 3 points represents a quadratic
553
+ Bézier curve:
554
+ ``[[float, float, float], ...], ...]``.
555
+
556
+ Please refer to the documentation of the function you are using for
557
+ further type information.
558
+ """
559
+
560
+ QuadraticBezierPathLike: TypeAlias = Point3DLike_Array
561
+ """``shape: (3*N, 3)``
562
+
563
+ A `Point3DLike_Array` of :math:`3N` points, where each one of the
564
+ :math:`N` consecutive blocks of 3 points represents a quadratic
565
+ Bézier curve:
566
+ ``[[float, float, float], ...], ...]``.
567
+
568
+ This represents anything which can be converted to a
569
+ :class:`QuadraticBezierPath` NumPy array.
570
+
571
+ Please refer to the documentation of the function you are using for
572
+ further type information.
573
+ """
574
+
575
+ QuadraticSpline: TypeAlias = QuadraticBezierPath
576
+ """``shape: (3*N, 3)``
577
+
578
+ A special case of `QuadraticBezierPath` where all the :math:`N`
579
+ quadratic Bézier curves are connected, forming a quadratic spline:
580
+ ``[[float, float, float], ...], ...]``.
581
+
582
+ Please refer to the documentation of the function you are using for
583
+ further type information.
584
+ """
585
+
586
+ QuadraticSplineLike: TypeAlias = QuadraticBezierPathLike
587
+ """``shape: (3*N, 3)``
588
+
589
+ A special case of `QuadraticBezierPathLike` where all the :math:`N`
590
+ quadratic Bézier curves are connected, forming a quadratic spline:
591
+ ``[[float, float, float], ...], ...]``.
592
+
593
+ This represents anything which can be converted to a :class:`QuadraticSpline`
594
+ NumPy array.
595
+
596
+ Please refer to the documentation of the function you are using for
597
+ further type information.
598
+ """
599
+
600
+ CubicBezierPoints: TypeAlias = Point3D_Array
601
+ """``shape: (4, 3)``
602
+
603
+ A `Point3D_Array` of four 3D control points for a single cubic Bézier curve:
604
+ ``[[float, float, float], [float, float, float], [float, float, float], [float, float, float]]``.
605
+ """
606
+
607
+ CubicBezierPointsLike: TypeAlias = Union[
608
+ CubicBezierPoints, tuple[Point3DLike, Point3DLike, Point3DLike, Point3DLike]
609
+ ]
610
+ """``shape: (4, 3)``
611
+
612
+ A `Point3DLike_Array` of 4 control points for a single cubic Bézier curve:
613
+ ``[[float, float, float], [float, float, float], [float, float, float], [float, float, float]]``.
614
+
615
+ This represents anything which can be converted to a :class:`CubicBezierPoints`
616
+ NumPy array.
617
+ """
618
+
619
+ CubicBezierPoints_Array: TypeAlias = npt.NDArray[PointDType]
620
+ """``shape: (N, 4, 3)``
621
+
622
+ A NumPy array containing :math:`N` `CubicBezierPoints` objects:
623
+ ``[[[float, float, float], [float, float, float], [float, float, float], [float, float, float]], ...]``.
624
+ """
625
+
626
+ CubicBezierPointsLike_Array: TypeAlias = Union[
627
+ CubicBezierPoints_Array, Sequence[CubicBezierPointsLike]
628
+ ]
629
+ """``shape: (N, 4, 3)``
630
+
631
+ A sequence of :math:`N` `CubicBezierPointsLike` objects:
632
+ ``[[[float, float, float], [float, float, float], [float, float, float], [float, float, float]], ...]``.
633
+
634
+ This represents anything which can be converted to a
635
+ :class:`CubicBezierPoints_Array` NumPy array.
636
+ """
637
+
638
+ CubicBezierPath: TypeAlias = Point3D_Array
639
+ """``shape: (4*N, 3)``
640
+
641
+ A `Point3D_Array` of :math:`4N` points, where each one of the
642
+ :math:`N` consecutive blocks of 4 points represents a cubic Bézier
643
+ curve:
644
+ ``[[float, float, float], ...], ...]``.
645
+
646
+ Please refer to the documentation of the function you are using for
647
+ further type information.
648
+ """
649
+
650
+ CubicBezierPathLike: TypeAlias = Point3DLike_Array
651
+ """``shape: (4*N, 3)``
652
+
653
+ A `Point3DLike_Array` of :math:`4N` points, where each one of the
654
+ :math:`N` consecutive blocks of 4 points represents a cubic Bézier
655
+ curve:
656
+ ``[[float, float, float], ...], ...]``.
657
+
658
+ This represents anything which can be converted to a
659
+ :class:`CubicBezierPath` NumPy array.
660
+
661
+ Please refer to the documentation of the function you are using for
662
+ further type information.
663
+ """
664
+
665
+ CubicSpline: TypeAlias = CubicBezierPath
666
+ """``shape: (4*N, 3)``
667
+
668
+ A special case of `CubicBezierPath` where all the :math:`N` cubic
669
+ Bézier curves are connected, forming a quadratic spline:
670
+ ``[[float, float, float], ...], ...]``.
671
+
672
+ Please refer to the documentation of the function you are using for
673
+ further type information.
674
+ """
675
+
676
+ CubicSplineLike: TypeAlias = CubicBezierPathLike
677
+ """``shape: (4*N, 3)``
678
+
679
+ A special case of `CubicBezierPath` where all the :math:`N` cubic
680
+ Bézier curves are connected, forming a quadratic spline:
681
+ ``[[float, float, float], ...], ...]``.
682
+
683
+ This represents anything which can be converted to a
684
+ :class:`CubicSpline` NumPy array.
685
+
686
+ Please refer to the documentation of the function you are using for
687
+ further type information.
688
+ """
689
+
690
+ BezierPoints: TypeAlias = Point3D_Array
691
+ r"""``shape: (PPC, 3)``
692
+
693
+ A `Point3D_Array` of :math:`\text{PPC}` control points
694
+ (:math:`\text{PPC: Points Per Curve} = n + 1`) for a single
695
+ :math:`n`-th degree Bézier curve:
696
+ ``[[float, float, float], ...]``.
697
+
698
+ Please refer to the documentation of the function you are using for
699
+ further type information.
700
+ """
120
701
 
702
+ BezierPointsLike: TypeAlias = Point3DLike_Array
703
+ r"""``shape: (PPC, 3)``
121
704
 
122
- # Misc
123
- PathFuncType: TypeAlias = Callable[[Point3D, Point3D, float], Point3D]
124
- """Function mapping two points and an alpha value to a new point"""
705
+ A `Point3DLike_Array` of :math:`\text{PPC}` control points
706
+ (:math:`\text{PPC: Points Per Curve} = n + 1`) for a single
707
+ :math:`n`-th degree Bézier curve:
708
+ ``[[float, float, float], ...]``.
709
+
710
+ This represents anything which can be converted to a
711
+ :class:`BezierPoints` NumPy array.
712
+
713
+ Please refer to the documentation of the function you are using for
714
+ further type information.
715
+ """
716
+
717
+ BezierPoints_Array: TypeAlias = npt.NDArray[PointDType]
718
+ r"""``shape: (N, PPC, 3)``
719
+
720
+ A NumPy array of :math:`N` `BezierPoints` objects containing
721
+ :math:`\text{PPC}` `Point3D` objects each
722
+ (:math:`\text{PPC: Points Per Curve} = n + 1`):
723
+ ``[[[float, float, float], ...], ...]``.
724
+
725
+ Please refer to the documentation of the function you are using for
726
+ further type information.
727
+ """
728
+
729
+ BezierPointsLike_Array: TypeAlias = Union[
730
+ BezierPoints_Array, Sequence[BezierPointsLike]
731
+ ]
732
+ r"""``shape: (N, PPC, 3)``
733
+
734
+ A sequence of :math:`N` `BezierPointsLike` objects containing
735
+ :math:`\text{PPC}` `Point3DLike` objects each
736
+ (:math:`\text{PPC: Points Per Curve} = n + 1`):
737
+ ``[[[float, float, float], ...], ...]``.
738
+
739
+ This represents anything which can be converted to a
740
+ :class:`BezierPoints_Array` NumPy array.
741
+
742
+ Please refer to the documentation of the function you are using for
743
+ further type information.
744
+ """
745
+
746
+ BezierPath: TypeAlias = Point3D_Array
747
+ r"""``shape: (PPC*N, 3)``
748
+
749
+ A `Point3D_Array` of :math:`\text{PPC} \cdot N` points, where each
750
+ one of the :math:`N` consecutive blocks of :math:`\text{PPC}` control
751
+ points (:math:`\text{PPC: Points Per Curve} = n + 1`) represents a
752
+ Bézier curve of :math:`n`-th degree:
753
+ ``[[float, float, float], ...], ...]``.
754
+
755
+ Please refer to the documentation of the function you are using for
756
+ further type information.
757
+ """
758
+
759
+ BezierPathLike: TypeAlias = Point3DLike_Array
760
+ r"""``shape: (PPC*N, 3)``
761
+
762
+ A `Point3DLike_Array` of :math:`\text{PPC} \cdot N` points, where each
763
+ one of the :math:`N` consecutive blocks of :math:`\text{PPC}` control
764
+ points (:math:`\text{PPC: Points Per Curve} = n + 1`) represents a
765
+ Bézier curve of :math:`n`-th degree:
766
+ ``[[float, float, float], ...], ...]``.
767
+
768
+ This represents anything which can be converted to a
769
+ :class:`BezierPath` NumPy array.
770
+
771
+ Please refer to the documentation of the function you are using for
772
+ further type information.
773
+ """
774
+
775
+ Spline: TypeAlias = BezierPath
776
+ r"""``shape: (PPC*N, 3)``
777
+
778
+ A special case of `BezierPath` where all the :math:`N` Bézier curves
779
+ consisting of :math:`\text{PPC}` `Point3D` objects
780
+ (:math:`\text{PPC: Points Per Curve} = n + 1`) are connected, forming
781
+ an :math:`n`-th degree spline:
782
+ ``[[float, float, float], ...], ...]``.
783
+
784
+ Please refer to the documentation of the function you are using for
785
+ further type information.
786
+ """
787
+
788
+ SplineLike: TypeAlias = BezierPathLike
789
+ r"""``shape: (PPC*N, 3)``
790
+
791
+ A special case of `BezierPathLike` where all the :math:`N` Bézier curves
792
+ consisting of :math:`\text{PPC}` `Point3D` objects
793
+ (:math:`\text{PPC: Points Per Curve} = n + 1`) are connected, forming
794
+ an :math:`n`-th degree spline:
795
+ ``[[float, float, float], ...], ...]``.
796
+
797
+ This represents anything which can be converted to a
798
+ :class:`Spline` NumPy array.
799
+
800
+ Please refer to the documentation of the function you are using for
801
+ further type information.
802
+ """
803
+
804
+ FlatBezierPoints: TypeAlias = Union[npt.NDArray[PointDType], tuple[float, ...]]
805
+ """``shape: (3*PPC*N,)``
806
+
807
+ A flattened array of Bézier control points:
808
+ ``[float, ...]``.
809
+ """
810
+
811
+
812
+ """
813
+ [CATEGORY]
814
+ Function types
815
+ """
816
+
817
+ # Due to current limitations
818
+ # (see https://github.com/python/mypy/issues/14656 / 8263),
819
+ # we don't specify the first argument type (Mobject).
820
+ # Nor are we able to specify the return type (Animation) since we cannot import
821
+ # that here.
822
+ FunctionOverride: TypeAlias = Callable
823
+ """Function type returning an :class:`~.Animation` for the specified
824
+ :class:`~.Mobject`.
825
+ """
826
+
827
+ PathFuncType: TypeAlias = Callable[[Point3DLike, Point3DLike, float], Point3DLike]
828
+ """Function mapping two :class:`Point3D` objects and an alpha value to a new
829
+ :class:`Point3D`.
830
+ """
125
831
 
126
832
  MappingFunction: TypeAlias = Callable[[Point3D], Point3D]
127
- """A function mapping a Point3D to another Point3D"""
833
+ """A function mapping a :class:`Point3D` to another :class:`Point3D`."""
834
+
835
+ MultiMappingFunction: TypeAlias = Callable[[Point3D_Array], Point3D_Array]
836
+ """A function mapping a :class:`Point3D_Array` to another
837
+ :class:`Point3D_Array`.
838
+ """
839
+
840
+ """
841
+ [CATEGORY]
842
+ Image types
843
+ """
844
+
845
+ PixelArray: TypeAlias = npt.NDArray[ManimInt]
846
+ """``shape: (height, width) | (height, width, 3) | (height, width, 4)``
847
+
848
+ A rasterized image with a height of ``height`` pixels and a width of
849
+ ``width`` pixels.
128
850
 
129
- Image: TypeAlias = np.ndarray
130
- """An Image"""
851
+ Every value in the array is an integer from 0 to 255.
131
852
 
132
- StrPath: TypeAlias = "str | PathLike[str]"
133
- StrOrBytesPath: TypeAlias = "str | bytes | PathLike[str] | PathLike[bytes]"
853
+ Every pixel is represented either by a single integer indicating its
854
+ lightness (for greyscale images), an `RGB_Array_Int` or an
855
+ `RGBA_Array_Int`.
856
+ """
857
+
858
+ GrayscalePixelArray: TypeAlias = PixelArray
859
+ """``shape: (height, width)``
860
+
861
+ A 100% opaque grayscale `PixelArray`, where every pixel value is a
862
+ `ManimInt` indicating its lightness (black -> gray -> white).
863
+ """
864
+
865
+ RGBPixelArray: TypeAlias = PixelArray
866
+ """``shape: (height, width, 3)``
867
+
868
+ A 100% opaque `PixelArray` in color, where every pixel value is an
869
+ `RGB_Array_Int` object.
870
+ """
871
+
872
+ RGBAPixelArray: TypeAlias = PixelArray
873
+ """``shape: (height, width, 4)``
874
+
875
+ A `PixelArray` in color where pixels can be transparent. Every pixel
876
+ value is an `RGBA_Array_Int` object.
877
+ """
878
+
879
+
880
+ """
881
+ [CATEGORY]
882
+ Path types
883
+ """
884
+
885
+ StrPath: TypeAlias = Union[str, PathLike[str]]
886
+ """A string or :class:`os.PathLike` representing a path to a
887
+ directory or file.
888
+ """
889
+
890
+ StrOrBytesPath: TypeAlias = Union[str, bytes, PathLike[str], PathLike[bytes]]
891
+ """A string, bytes or :class:`os.PathLike` object representing a path
892
+ to a directory or file.
893
+ """