13
13
from manim .mobject .types .vectorized_mobject import VMobject
14
14
15
15
if TYPE_CHECKING :
16
- from manim .typing import Point2D_Array , Point3D_Array
16
+ from typing import Any
17
+
18
+ from manim .typing import InternalPoint3D_Array , Point2D_Array
17
19
18
20
from ...constants import RendererType
19
21
@@ -30,7 +32,7 @@ def _convert_2d_to_3d_array(
30
32
self ,
31
33
points : Point2D_Array ,
32
34
z_dim : float = 0.0 ,
33
- ) -> Point3D_Array :
35
+ ) -> InternalPoint3D_Array :
34
36
"""Converts an iterable with coordinates in 2D to 3D by adding
35
37
:attr:`z_dim` as the Z coordinate.
36
38
@@ -51,13 +53,14 @@ def _convert_2d_to_3d_array(
51
53
>>> a = _BooleanOps()
52
54
>>> p = [(1, 2), (3, 4)]
53
55
>>> a._convert_2d_to_3d_array(p)
54
- [array([1., 2., 0.]), array([3., 4., 0.])]
56
+ array([[1., 2., 0.],
57
+ [3., 4., 0.]])
55
58
"""
56
- points = list (points )
57
- for i , point in enumerate (points ):
59
+ list_of_points = list (points )
60
+ for i , point in enumerate (list_of_points ):
58
61
if len (point ) == 2 :
59
- points [i ] = np .array (list (point ) + [z_dim ])
60
- return points
62
+ list_of_points [i ] = np .array (list (point ) + [z_dim ])
63
+ return np . asarray ( list_of_points )
61
64
62
65
def _convert_vmobject_to_skia_path (self , vmobject : VMobject ) -> SkiaPath :
63
66
"""Converts a :class:`~.VMobject` to SkiaPath. This method only works for
@@ -95,7 +98,7 @@ def _convert_vmobject_to_skia_path(self, vmobject: VMobject) -> SkiaPath:
95
98
if vmobject .consider_points_equals (subpath [0 ], subpath [- 1 ]):
96
99
path .close ()
97
100
elif config .renderer == RendererType .CAIRO :
98
- subpaths = vmobject .gen_subpaths_from_points_2d (points )
101
+ subpaths = vmobject .gen_subpaths_from_points_2d (points ) # type: ignore[assignment]
99
102
for subpath in subpaths :
100
103
quads = vmobject .gen_cubic_bezier_tuples_from_points (subpath )
101
104
start = subpath [0 ]
@@ -177,7 +180,7 @@ def construct(self):
177
180
178
181
"""
179
182
180
- def __init__ (self , * vmobjects : VMobject , ** kwargs ) -> None :
183
+ def __init__ (self , * vmobjects : VMobject , ** kwargs : Any ) -> None :
181
184
if len (vmobjects ) < 2 :
182
185
raise ValueError ("At least 2 mobjects needed for Union." )
183
186
super ().__init__ (** kwargs )
@@ -216,7 +219,7 @@ def construct(self):
216
219
217
220
"""
218
221
219
- def __init__ (self , subject : VMobject , clip : VMobject , ** kwargs ) -> None :
222
+ def __init__ (self , subject : VMobject , clip : VMobject , ** kwargs : Any ) -> None :
220
223
super ().__init__ (** kwargs )
221
224
outpen = SkiaPath ()
222
225
difference (
@@ -258,7 +261,7 @@ def construct(self):
258
261
259
262
"""
260
263
261
- def __init__ (self , * vmobjects : VMobject , ** kwargs ) -> None :
264
+ def __init__ (self , * vmobjects : VMobject , ** kwargs : Any ) -> None :
262
265
if len (vmobjects ) < 2 :
263
266
raise ValueError ("At least 2 mobjects needed for Intersection." )
264
267
@@ -311,7 +314,7 @@ def construct(self):
311
314
312
315
"""
313
316
314
- def __init__ (self , subject : VMobject , clip : VMobject , ** kwargs ) -> None :
317
+ def __init__ (self , subject : VMobject , clip : VMobject , ** kwargs : Any ) -> None :
315
318
super ().__init__ (** kwargs )
316
319
outpen = SkiaPath ()
317
320
xor (
0 commit comments