5454 Point3D ,
5555 Point3DLike ,
5656 Point3DLike_Array ,
57- Vector3D ,
57+ Vector3DLike ,
5858 )
5959
6060 from ..animation .animation import Animation
@@ -1204,7 +1204,7 @@ def apply_to_family(self, func: Callable[[Mobject], None]) -> None:
12041204 for mob in self .family_members_with_points ():
12051205 func (mob )
12061206
1207- def shift (self , * vectors : Vector3D ) -> Self :
1207+ def shift (self , * vectors : Vector3DLike ) -> Self :
12081208 """Shift by the given vectors.
12091209
12101210 Parameters
@@ -1275,14 +1275,14 @@ def construct(self):
12751275 )
12761276 return self
12771277
1278- def rotate_about_origin (self , angle : float , axis : Vector3D = OUT , axes = [] ) -> Self :
1278+ def rotate_about_origin (self , angle : float , axis : Vector3DLike = OUT ) -> Self :
12791279 """Rotates the :class:`~.Mobject` about the ORIGIN, which is at [0,0,0]."""
12801280 return self .rotate (angle , axis , about_point = ORIGIN )
12811281
12821282 def rotate (
12831283 self ,
12841284 angle : float ,
1285- axis : Vector3D = OUT ,
1285+ axis : Vector3DLike = OUT ,
12861286 about_point : Point3DLike | None = None ,
12871287 ** kwargs ,
12881288 ) -> Self :
@@ -1350,7 +1350,7 @@ def construct(self):
13501350 )
13511351 return self
13521352
1353- def flip (self , axis : Vector3D = UP , ** kwargs ) -> Self :
1353+ def flip (self , axis : Vector3DLike = UP , ** kwargs ) -> Self :
13541354 """Flips/Mirrors an mobject about its center.
13551355
13561356 Examples
@@ -1470,7 +1470,7 @@ def apply_points_function_about_point(
14701470 self ,
14711471 func : MultiMappingFunction ,
14721472 about_point : Point3DLike | None = None ,
1473- about_edge : Vector3D | None = None ,
1473+ about_edge : Vector3DLike | None = None ,
14741474 ) -> Self :
14751475 if about_point is None :
14761476 if about_edge is None :
@@ -1500,7 +1500,7 @@ def center(self) -> Self:
15001500 return self
15011501
15021502 def align_on_border (
1503- self , direction : Vector3D , buff : float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
1503+ self , direction : Vector3DLike , buff : float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
15041504 ) -> Self :
15051505 """Direction just needs to be a vector pointing towards side or
15061506 corner in the 2d plane.
@@ -1517,7 +1517,7 @@ def align_on_border(
15171517 return self
15181518
15191519 def to_corner (
1520- self , corner : Vector3D = DL , buff : float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
1520+ self , corner : Vector3DLike = DL , buff : float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
15211521 ) -> Self :
15221522 """Moves this :class:`~.Mobject` to the given corner of the screen.
15231523
@@ -1545,7 +1545,7 @@ def construct(self):
15451545 return self .align_on_border (corner , buff )
15461546
15471547 def to_edge (
1548- self , edge : Vector3D = LEFT , buff : float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
1548+ self , edge : Vector3DLike = LEFT , buff : float = DEFAULT_MOBJECT_TO_EDGE_BUFFER
15491549 ) -> Self :
15501550 """Moves this :class:`~.Mobject` to the given edge of the screen,
15511551 without affecting its position in the other dimension.
@@ -1577,12 +1577,12 @@ def construct(self):
15771577 def next_to (
15781578 self ,
15791579 mobject_or_point : Mobject | Point3DLike ,
1580- direction : Vector3D = RIGHT ,
1580+ direction : Vector3DLike = RIGHT ,
15811581 buff : float = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER ,
1582- aligned_edge : Vector3D = ORIGIN ,
1582+ aligned_edge : Vector3DLike = ORIGIN ,
15831583 submobject_to_align : Mobject | None = None ,
15841584 index_of_submobject_to_align : int | None = None ,
1585- coor_mask : Vector3D = np .array ([1 , 1 , 1 ]),
1585+ coor_mask : Vector3DLike = np .array ([1 , 1 , 1 ]),
15861586 ) -> Self :
15871587 """Move this :class:`~.Mobject` next to another's :class:`~.Mobject` or Point3D.
15881588
@@ -1604,13 +1604,18 @@ def construct(self):
16041604 self.add(d, c, s, t)
16051605
16061606 """
1607+ np_direction = np .asarray (direction )
1608+ np_aligned_edge = np .asarray (aligned_edge )
1609+
16071610 if isinstance (mobject_or_point , Mobject ):
16081611 mob = mobject_or_point
16091612 if index_of_submobject_to_align is not None :
16101613 target_aligner = mob [index_of_submobject_to_align ]
16111614 else :
16121615 target_aligner = mob
1613- target_point = target_aligner .get_critical_point (aligned_edge + direction )
1616+ target_point = target_aligner .get_critical_point (
1617+ np_aligned_edge + np_direction
1618+ )
16141619 else :
16151620 target_point = mobject_or_point
16161621 if submobject_to_align is not None :
@@ -1619,8 +1624,8 @@ def construct(self):
16191624 aligner = self [index_of_submobject_to_align ]
16201625 else :
16211626 aligner = self
1622- point_to_align = aligner .get_critical_point (aligned_edge - direction )
1623- self .shift ((target_point - point_to_align + buff * direction ) * coor_mask )
1627+ point_to_align = aligner .get_critical_point (np_aligned_edge - np_direction )
1628+ self .shift ((target_point - point_to_align + buff * np_direction ) * coor_mask )
16241629 return self
16251630
16261631 def shift_onto_screen (self , ** kwargs ) -> Self :
@@ -1766,22 +1771,22 @@ def stretch_to_fit_depth(self, depth: float, **kwargs) -> Self:
17661771 """Stretches the :class:`~.Mobject` to fit a depth, not keeping width/height proportional."""
17671772 return self .rescale_to_fit (depth , 2 , stretch = True , ** kwargs )
17681773
1769- def set_coord (self , value , dim : int , direction : Vector3D = ORIGIN ) -> Self :
1774+ def set_coord (self , value , dim : int , direction : Vector3DLike = ORIGIN ) -> Self :
17701775 curr = self .get_coord (dim , direction )
17711776 shift_vect = np .zeros (self .dim )
17721777 shift_vect [dim ] = value - curr
17731778 self .shift (shift_vect )
17741779 return self
17751780
1776- def set_x (self , x : float , direction : Vector3D = ORIGIN ) -> Self :
1781+ def set_x (self , x : float , direction : Vector3DLike = ORIGIN ) -> Self :
17771782 """Set x value of the center of the :class:`~.Mobject` (``int`` or ``float``)"""
17781783 return self .set_coord (x , 0 , direction )
17791784
1780- def set_y (self , y : float , direction : Vector3D = ORIGIN ) -> Self :
1785+ def set_y (self , y : float , direction : Vector3DLike = ORIGIN ) -> Self :
17811786 """Set y value of the center of the :class:`~.Mobject` (``int`` or ``float``)"""
17821787 return self .set_coord (y , 1 , direction )
17831788
1784- def set_z (self , z : float , direction : Vector3D = ORIGIN ) -> Self :
1789+ def set_z (self , z : float , direction : Vector3DLike = ORIGIN ) -> Self :
17851790 """Set z value of the center of the :class:`~.Mobject` (``int`` or ``float``)"""
17861791 return self .set_coord (z , 2 , direction )
17871792
@@ -1794,8 +1799,8 @@ def space_out_submobjects(self, factor: float = 1.5, **kwargs) -> Self:
17941799 def move_to (
17951800 self ,
17961801 point_or_mobject : Point3DLike | Mobject ,
1797- aligned_edge : Vector3D = ORIGIN ,
1798- coor_mask : Vector3D = np .array ([1 , 1 , 1 ]),
1802+ aligned_edge : Vector3DLike = ORIGIN ,
1803+ coor_mask : Vector3DLike = np .array ([1 , 1 , 1 ]),
17991804 ) -> Self :
18001805 """Move center of the :class:`~.Mobject` to certain Point3D."""
18011806 if isinstance (point_or_mobject , Mobject ):
@@ -2114,7 +2119,7 @@ def get_extremum_along_dim(
21142119 else :
21152120 return np .max (values )
21162121
2117- def get_critical_point (self , direction : Vector3D ) -> Point3D :
2122+ def get_critical_point (self , direction : Vector3DLike ) -> Point3D :
21182123 """Picture a box bounding the :class:`~.Mobject`. Such a box has
21192124 9 'critical points': 4 corners, 4 edge center, the
21202125 center. This returns one of them, along the given direction.
@@ -2143,11 +2148,11 @@ def get_critical_point(self, direction: Vector3D) -> Point3D:
21432148
21442149 # Pseudonyms for more general get_critical_point method
21452150
2146- def get_edge_center (self , direction : Vector3D ) -> Point3D :
2151+ def get_edge_center (self , direction : Vector3DLike ) -> Point3D :
21472152 """Get edge Point3Ds for certain direction."""
21482153 return self .get_critical_point (direction )
21492154
2150- def get_corner (self , direction : Vector3D ) -> Point3D :
2155+ def get_corner (self , direction : Vector3DLike ) -> Point3D :
21512156 """Get corner Point3Ds for certain direction."""
21522157 return self .get_critical_point (direction )
21532158
@@ -2158,9 +2163,9 @@ def get_center(self) -> Point3D:
21582163 def get_center_of_mass (self ) -> Point3D :
21592164 return np .apply_along_axis (np .mean , 0 , self .get_all_points ())
21602165
2161- def get_boundary_point (self , direction : Vector3D ) -> Point3D :
2166+ def get_boundary_point (self , direction : Vector3DLike ) -> Point3D :
21622167 all_points = self .get_points_defining_boundary ()
2163- index = np .argmax (np .dot (all_points , np . array ( direction ). T ))
2168+ index = np .argmax (np .dot (all_points , direction ))
21642169 return all_points [index ]
21652170
21662171 def get_midpoint (self ) -> Point3D :
@@ -2217,19 +2222,19 @@ def length_over_dim(self, dim: int) -> float:
22172222 dim ,
22182223 ) - self .reduce_across_dimension (min , dim )
22192224
2220- def get_coord (self , dim : int , direction : Vector3D = ORIGIN ):
2225+ def get_coord (self , dim : int , direction : Vector3DLike = ORIGIN ) -> float :
22212226 """Meant to generalize ``get_x``, ``get_y`` and ``get_z``"""
22222227 return self .get_extremum_along_dim (dim = dim , key = direction [dim ])
22232228
2224- def get_x (self , direction : Vector3D = ORIGIN ) -> float :
2229+ def get_x (self , direction : Vector3DLike = ORIGIN ) -> float :
22252230 """Returns x Point3D of the center of the :class:`~.Mobject` as ``float``"""
22262231 return self .get_coord (0 , direction )
22272232
2228- def get_y (self , direction : Vector3D = ORIGIN ) -> float :
2233+ def get_y (self , direction : Vector3DLike = ORIGIN ) -> float :
22292234 """Returns y Point3D of the center of the :class:`~.Mobject` as ``float``"""
22302235 return self .get_coord (1 , direction )
22312236
2232- def get_z (self , direction : Vector3D = ORIGIN ) -> float :
2237+ def get_z (self , direction : Vector3DLike = ORIGIN ) -> float :
22332238 """Returns z Point3D of the center of the :class:`~.Mobject` as ``float``"""
22342239 return self .get_coord (2 , direction )
22352240
@@ -2300,7 +2305,7 @@ def match_depth(self, mobject: Mobject, **kwargs) -> Self:
23002305 return self .match_dim_size (mobject , 2 , ** kwargs )
23012306
23022307 def match_coord (
2303- self , mobject : Mobject , dim : int , direction : Vector3D = ORIGIN
2308+ self , mobject : Mobject , dim : int , direction : Vector3DLike = ORIGIN
23042309 ) -> Self :
23052310 """Match the Point3Ds with the Point3Ds of another :class:`~.Mobject`."""
23062311 return self .set_coord (
@@ -2324,7 +2329,7 @@ def match_z(self, mobject: Mobject, direction=ORIGIN) -> Self:
23242329 def align_to (
23252330 self ,
23262331 mobject_or_point : Mobject | Point3DLike ,
2327- direction : Vector3D = ORIGIN ,
2332+ direction : Vector3DLike = ORIGIN ,
23282333 ) -> Self :
23292334 """Aligns mobject to another :class:`~.Mobject` in a certain direction.
23302335
@@ -2431,7 +2436,7 @@ def family_members_with_points(self) -> list[Self]:
24312436
24322437 def arrange (
24332438 self ,
2434- direction : Vector3D = RIGHT ,
2439+ direction : Vector3DLike = RIGHT ,
24352440 buff : float = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER ,
24362441 center : bool = True ,
24372442 ** kwargs ,
@@ -2464,7 +2469,7 @@ def arrange_in_grid(
24642469 rows : int | None = None ,
24652470 cols : int | None = None ,
24662471 buff : float | tuple [float , float ] = MED_SMALL_BUFF ,
2467- cell_alignment : Vector3D = ORIGIN ,
2472+ cell_alignment : Vector3DLike = ORIGIN ,
24682473 row_alignments : str | None = None , # "ucd"
24692474 col_alignments : str | None = None , # "lcr"
24702475 row_heights : Iterable [float | None ] | None = None ,
0 commit comments