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