Skip to content

Commit

Permalink
Added PointND and PointND_Array typing aliases (#3980)
Browse files Browse the repository at this point in the history
Co-authored-by: Aarush Deshpande <[email protected]>
  • Loading branch information
chopan050 and JasonGrace2282 authored Oct 28, 2024
1 parent 8773252 commit 20f44b4
Showing 1 changed file with 43 additions and 4 deletions.
47 changes: 43 additions & 4 deletions manim/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"Point3D",
"InternalPoint3D_Array",
"Point3D_Array",
"InternalPointND",
"PointND",
"InternalPointND_Array",
"PointND_Array",
"Vector2D",
"Vector2D_Array",
"Vector3D",
Expand Down Expand Up @@ -301,7 +305,7 @@
"""

InternalPoint2D_Array: TypeAlias = npt.NDArray[PointDType]
"""``shape: (N, 2)``
"""``shape: (M, 2)``
An array of `InternalPoint2D` objects: ``[[float, float], ...]``.
Expand All @@ -311,7 +315,7 @@
"""

Point2D_Array: TypeAlias = Union[InternalPoint2D_Array, tuple[Point2D, ...]]
"""``shape: (N, 2)``
"""``shape: (M, 2)``
An array of `Point2D` objects: ``[[float, float], ...]``.
Expand Down Expand Up @@ -339,7 +343,7 @@
"""

InternalPoint3D_Array: TypeAlias = npt.NDArray[PointDType]
"""``shape: (N, 3)``
"""``shape: (M, 3)``
An array of `Point3D` objects: ``[[float, float, float], ...]``.
Expand All @@ -349,14 +353,49 @@
"""

Point3D_Array: TypeAlias = Union[InternalPoint3D_Array, tuple[Point3D, ...]]
"""``shape: (N, 3)``
"""``shape: (M, 3)``
An array of `Point3D` objects: ``[[float, float, float], ...]``.
Please refer to the documentation of the function you are using for
further type information.
"""

InternalPointND: TypeAlias = npt.NDArray[PointDType]
"""``shape: (N,)``
An N-dimensional point: ``[float, ...]``.
.. note::
This type alias is mostly made available for internal use, and
only includes the NumPy type.
"""

PointND: TypeAlias = Union[InternalPointND, tuple[float, ...]]
"""``shape: (N,)``
An N-dimensional point: ``[float, ...]``.
"""

InternalPointND_Array: TypeAlias = npt.NDArray[PointDType]
"""``shape: (M, N)``
An array of `PointND` objects: ``[[float, ...], ...]``.
.. note::
This type alias is mostly made available for internal use, and
only includes the NumPy type.
"""

PointND_Array: TypeAlias = Union[InternalPointND_Array, tuple[PointND, ...]]
"""``shape: (M, N)``
An array of `PointND` objects: ``[[float, ...], ...]``.
Please refer to the documentation of the function you are using for
further type information.
"""


"""
[CATEGORY]
Expand Down

0 comments on commit 20f44b4

Please sign in to comment.