38
38
proportions_along_bezier_curve_for_point ,
39
39
)
40
40
from manim .utils .color import BLACK , WHITE , ManimColor , ParsableManimColor
41
+ from manim .utils .decorators import internal
41
42
from manim .utils .iterables import (
42
43
make_even ,
43
44
resize_array ,
@@ -191,6 +192,7 @@ def get_mobject_type_class() -> type[VMobject]:
191
192
return VMobject
192
193
193
194
# Colors
195
+ @internal
194
196
def init_colors (self , propagate_colors : bool = True ) -> Self :
195
197
self .set_fill (
196
198
color = self .fill_color ,
@@ -221,6 +223,7 @@ def init_colors(self, propagate_colors: bool = True) -> Self:
221
223
222
224
return self
223
225
226
+ @internal
224
227
def generate_rgbas_array (
225
228
self , color : ManimColor | list [ManimColor ], opacity : float | Iterable [float ]
226
229
) -> RGBA_Array_Float :
@@ -249,6 +252,7 @@ def generate_rgbas_array(
249
252
rgbas = np .append (rgbas , light_rgbas , axis = 0 )
250
253
return rgbas
251
254
255
+ @internal
252
256
def update_rgbas_array (
253
257
self ,
254
258
array_name : str ,
@@ -708,6 +712,7 @@ def set_shade_in_3d(
708
712
submob .z_index_group = self
709
713
return self
710
714
715
+ @internal
711
716
def set_points (self , points : Point3D_Array ) -> Self :
712
717
self .points : Point3D_Array = np .array (points )
713
718
return self
@@ -795,6 +800,7 @@ def append_points(self, new_points: Point3D_Array) -> Self:
795
800
self .points = points
796
801
return self
797
802
803
+ @internal
798
804
def start_new_path (self , point : Point3D ) -> Self :
799
805
"""Append a ``point`` to the :attr:`VMobject.points`, which will be the
800
806
beginning of a new Bézier curve in the path given by the points. If
@@ -825,6 +831,7 @@ def start_new_path(self, point: Point3D) -> Self:
825
831
self .append_points ([point ])
826
832
return self
827
833
834
+ @internal
828
835
def add_cubic_bezier_curve (
829
836
self ,
830
837
anchor1 : CubicBezierPoints ,
@@ -836,9 +843,11 @@ def add_cubic_bezier_curve(
836
843
self .append_points ([anchor1 , handle1 , handle2 , anchor2 ])
837
844
838
845
# what type is curves?
846
+ @internal
839
847
def add_cubic_bezier_curves (self , curves ) -> None :
840
848
self .append_points (curves .flatten ())
841
849
850
+ @internal
842
851
def add_cubic_bezier_curve_to (
843
852
self ,
844
853
handle1 : CubicBezierPoints ,
@@ -871,6 +880,7 @@ def add_cubic_bezier_curve_to(
871
880
self .append_points ([self .get_last_point ()] + new_points )
872
881
return self
873
882
883
+ @internal
874
884
def add_quadratic_bezier_curve_to (
875
885
self ,
876
886
handle : QuadraticBezierPoints ,
@@ -1114,11 +1124,13 @@ def make_smooth(self) -> Self:
1114
1124
def make_jagged (self ) -> Self :
1115
1125
return self .change_anchor_mode ("jagged" )
1116
1126
1127
+ @internal
1117
1128
def add_subpath (self , points : Point3D_Array ) -> Self :
1118
1129
assert len (points ) % 4 == 0
1119
1130
self .append_points (points )
1120
1131
return self
1121
1132
1133
+ @internal
1122
1134
def append_vectorized_mobject (self , vectorized_mobject : VMobject ) -> None :
1123
1135
if self .has_new_path_started ():
1124
1136
# Remove last point, which is starting
@@ -1146,6 +1158,7 @@ def rotate(
1146
1158
super ().rotate (angle , axis , about_point , ** kwargs )
1147
1159
return self
1148
1160
1161
+ @internal
1149
1162
def scale_handle_to_anchor_distances (self , factor : float ) -> Self :
1150
1163
"""If the distance between a given handle point H and its associated
1151
1164
anchor point A is d, then it changes H to be a distances factor*d
@@ -1177,10 +1190,11 @@ def scale_handle_to_anchor_distances(self, factor: float) -> Self:
1177
1190
submob .set_anchors_and_handles (a1 , new_h1 , new_h2 , a2 )
1178
1191
return self
1179
1192
1180
- #
1193
+ @ internal
1181
1194
def consider_points_equals (self , p0 : Point3D , p1 : Point3D ) -> bool :
1182
1195
return np .allclose (p0 , p1 , atol = self .tolerance_for_point_equality )
1183
1196
1197
+ @internal
1184
1198
def consider_points_equals_2d (self , p0 : Point2D , p1 : Point2D ) -> bool :
1185
1199
"""Determine if two points are close enough to be considered equal.
1186
1200
@@ -1207,11 +1221,13 @@ def consider_points_equals_2d(self, p0: Point2D, p1: Point2D) -> bool:
1207
1221
return True
1208
1222
1209
1223
# Information about line
1224
+ @internal
1210
1225
def get_cubic_bezier_tuples_from_points (
1211
1226
self , points : Point3D_Array
1212
1227
) -> npt .NDArray [Point3D_Array ]:
1213
1228
return np .array (self .gen_cubic_bezier_tuples_from_points (points ))
1214
1229
1230
+ @internal
1215
1231
def gen_cubic_bezier_tuples_from_points (
1216
1232
self , points : Point3D_Array
1217
1233
) -> tuple [Point3D_Array ]:
@@ -1238,6 +1254,7 @@ def gen_cubic_bezier_tuples_from_points(
1238
1254
# Basically take every nppcc element.
1239
1255
return tuple (points [i : i + nppcc ] for i in range (0 , len (points ), nppcc ))
1240
1256
1257
+ @internal
1241
1258
def get_cubic_bezier_tuples (self ) -> npt .NDArray [Point3D_Array ]:
1242
1259
return self .get_cubic_bezier_tuples_from_points (self .points )
1243
1260
@@ -1275,6 +1292,7 @@ def _gen_subpaths_from_points(
1275
1292
if (i2 - i1 ) >= nppcc
1276
1293
)
1277
1294
1295
+ @internal
1278
1296
def get_subpaths_from_points (self , points : Point3D_Array ) -> list [Point3D_Array ]:
1279
1297
return list (
1280
1298
self ._gen_subpaths_from_points (
@@ -1283,6 +1301,7 @@ def get_subpaths_from_points(self, points: Point3D_Array) -> list[Point3D_Array]
1283
1301
),
1284
1302
)
1285
1303
1304
+ @internal
1286
1305
def gen_subpaths_from_points_2d (
1287
1306
self , points : Point3D_Array
1288
1307
) -> Generator [Point3D_Array ]:
@@ -1291,6 +1310,7 @@ def gen_subpaths_from_points_2d(
1291
1310
lambda n : not self .consider_points_equals_2d (points [n - 1 ], points [n ]),
1292
1311
)
1293
1312
1313
+ @internal
1294
1314
def get_subpaths (self ) -> list [Point3D_Array ]:
1295
1315
"""Returns subpaths formed by the curves of the VMobject.
1296
1316
@@ -1303,6 +1323,7 @@ def get_subpaths(self) -> list[Point3D_Array]:
1303
1323
"""
1304
1324
return self .get_subpaths_from_points (self .points )
1305
1325
1326
+ @internal
1306
1327
def get_nth_curve_points (self , n : int ) -> Point3D_Array :
1307
1328
"""Returns the points defining the nth curve of the vmobject.
1308
1329
@@ -1320,6 +1341,7 @@ def get_nth_curve_points(self, n: int) -> Point3D_Array:
1320
1341
nppcc = self .n_points_per_cubic_curve
1321
1342
return self .points [nppcc * n : nppcc * (n + 1 )]
1322
1343
1344
+ @internal
1323
1345
def get_nth_curve_function (self , n : int ) -> Callable [[float ], Point3D ]:
1324
1346
"""Returns the expression of the nth curve.
1325
1347
@@ -1335,6 +1357,7 @@ def get_nth_curve_function(self, n: int) -> Callable[[float], Point3D]:
1335
1357
"""
1336
1358
return bezier (self .get_nth_curve_points (n ))
1337
1359
1360
+ @internal
1338
1361
def get_nth_curve_length_pieces (
1339
1362
self ,
1340
1363
n : int ,
@@ -1363,6 +1386,7 @@ def get_nth_curve_length_pieces(
1363
1386
1364
1387
return norms
1365
1388
1389
+ @internal
1366
1390
def get_nth_curve_length (
1367
1391
self ,
1368
1392
n : int ,
@@ -1387,6 +1411,7 @@ def get_nth_curve_length(
1387
1411
1388
1412
return length
1389
1413
1414
+ @internal
1390
1415
def get_nth_curve_function_with_length (
1391
1416
self ,
1392
1417
n : int ,
@@ -1426,6 +1451,7 @@ def get_num_curves(self) -> int:
1426
1451
nppcc = self .n_points_per_cubic_curve
1427
1452
return len (self .points ) // nppcc
1428
1453
1454
+ @internal
1429
1455
def get_curve_functions (
1430
1456
self ,
1431
1457
) -> Generator [Callable [[float ], Point3D ]]:
@@ -1442,6 +1468,7 @@ def get_curve_functions(
1442
1468
for n in range (num_curves ):
1443
1469
yield self .get_nth_curve_function (n )
1444
1470
1471
+ @internal
1445
1472
def get_curve_functions_with_lengths (
1446
1473
self , ** kwargs
1447
1474
) -> Generator [tuple [Callable [[float ], Point3D ], float ]]:
@@ -1582,6 +1609,7 @@ def proportion_from_point(
1582
1609
1583
1610
return alpha
1584
1611
1612
+ @internal
1585
1613
def get_anchors_and_handles (self ) -> list [Point3D_Array ]:
1586
1614
"""Returns anchors1, handles1, handles2, anchors2,
1587
1615
where (anchors1[i], handles1[i], handles2[i], anchors2[i])
@@ -1596,6 +1624,7 @@ def get_anchors_and_handles(self) -> list[Point3D_Array]:
1596
1624
nppcc = self .n_points_per_cubic_curve
1597
1625
return [self .points [i ::nppcc ] for i in range (nppcc )]
1598
1626
1627
+ @internal
1599
1628
def get_start_anchors (self ) -> Point3D_Array :
1600
1629
"""Returns the start anchors of the bezier curves.
1601
1630
@@ -1606,6 +1635,7 @@ def get_start_anchors(self) -> Point3D_Array:
1606
1635
"""
1607
1636
return self .points [:: self .n_points_per_cubic_curve ]
1608
1637
1638
+ @internal
1609
1639
def get_end_anchors (self ) -> Point3D_Array :
1610
1640
"""Return the end anchors of the bezier curves.
1611
1641
@@ -1617,6 +1647,7 @@ def get_end_anchors(self) -> Point3D_Array:
1617
1647
nppcc = self .n_points_per_cubic_curve
1618
1648
return self .points [nppcc - 1 :: nppcc ]
1619
1649
1650
+ @internal
1620
1651
def get_anchors (self ) -> Point3D_Array :
1621
1652
"""Returns the anchors of the curves forming the VMobject.
1622
1653
@@ -1731,6 +1762,7 @@ def get_nth_subpath(path_list, n):
1731
1762
vmobject .set_points (new_path2 )
1732
1763
return self
1733
1764
1765
+ @internal
1734
1766
def insert_n_curves (self , n : int ) -> Self :
1735
1767
"""Inserts n curves to the bezier curves of the vmobject.
1736
1768
@@ -1755,6 +1787,7 @@ def insert_n_curves(self, n: int) -> Self:
1755
1787
self .append_points ([new_path_point ])
1756
1788
return self
1757
1789
1790
+ @internal
1758
1791
def insert_n_curves_to_point_list (
1759
1792
self , n : int , points : Point3D_Array
1760
1793
) -> npt .NDArray [BezierPoints ]:
@@ -1782,6 +1815,7 @@ def insert_n_curves_to_point_list(
1782
1815
new_points = new_bezier_tuples .reshape (- 1 , 3 )
1783
1816
return new_points
1784
1817
1818
+ @internal
1785
1819
def align_rgbas (self , vmobject : VMobject ) -> Self :
1786
1820
attrs = ["fill_rgbas" , "stroke_rgbas" , "background_stroke_rgbas" ]
1787
1821
for attr in attrs :
@@ -1802,6 +1836,7 @@ def get_point_mobject(self, center: Point3D | None = None) -> VectorizedPoint:
1802
1836
point .match_style (self )
1803
1837
return point
1804
1838
1839
+ @internal
1805
1840
def interpolate_color (
1806
1841
self , mobject1 : VMobject , mobject2 : VMobject , alpha : float
1807
1842
) -> None :
@@ -1826,6 +1861,7 @@ def interpolate_color(
1826
1861
val = val .copy ()
1827
1862
setattr (self , attr , val )
1828
1863
1864
+ @internal
1829
1865
def pointwise_become_partial (
1830
1866
self ,
1831
1867
vmobject : VMobject ,
@@ -1888,6 +1924,7 @@ def pointwise_become_partial(
1888
1924
)
1889
1925
return self
1890
1926
1927
+ @internal
1891
1928
def get_subcurve (self , a : float , b : float ) -> Self :
1892
1929
"""Returns the subcurve of the VMobject between the interval [a, b].
1893
1930
The curve is a VMobject itself.
0 commit comments