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.
- manim/__init__.py +11 -6
- manim/__main__.py +62 -19
- manim/_config/__init__.py +10 -9
- manim/_config/cli_colors.py +26 -9
- manim/_config/default.cfg +1 -3
- manim/_config/logger_utils.py +23 -13
- manim/_config/utils.py +662 -468
- manim/animation/animation.py +164 -18
- manim/animation/changing.py +34 -23
- manim/animation/composition.py +265 -67
- manim/animation/creation.py +208 -26
- manim/animation/fading.py +16 -18
- manim/animation/growing.py +35 -15
- manim/animation/indication.py +150 -76
- manim/animation/movement.py +56 -22
- manim/animation/numbers.py +64 -6
- manim/animation/rotation.py +78 -7
- manim/animation/specialized.py +6 -7
- manim/animation/speedmodifier.py +13 -10
- manim/animation/transform.py +14 -11
- manim/animation/transform_matching_parts.py +3 -4
- manim/animation/updaters/mobject_update_utils.py +152 -30
- manim/animation/updaters/update.py +10 -7
- manim/camera/camera.py +182 -118
- manim/camera/mapping_camera.py +34 -3
- manim/camera/moving_camera.py +95 -74
- manim/camera/multi_camera.py +23 -15
- manim/camera/three_d_camera.py +70 -52
- manim/cli/__init__.py +17 -0
- manim/cli/cfg/group.py +76 -44
- manim/cli/checkhealth/checks.py +192 -0
- manim/cli/checkhealth/commands.py +90 -0
- manim/cli/default_group.py +158 -25
- manim/cli/init/commands.py +33 -25
- manim/cli/plugins/commands.py +16 -3
- manim/cli/render/commands.py +72 -60
- manim/cli/render/ease_of_access_options.py +4 -3
- manim/cli/render/global_options.py +59 -17
- manim/cli/render/output_options.py +6 -5
- manim/cli/render/render_options.py +98 -33
- manim/constants.py +109 -59
- manim/data_structures.py +31 -0
- manim/mobject/frame.py +8 -5
- manim/mobject/geometry/__init__.py +1 -0
- manim/mobject/geometry/arc.py +277 -135
- manim/mobject/geometry/boolean_ops.py +32 -31
- manim/mobject/geometry/labeled.py +376 -0
- manim/mobject/geometry/line.py +192 -87
- manim/mobject/geometry/polygram.py +224 -58
- manim/mobject/geometry/shape_matchers.py +61 -25
- manim/mobject/geometry/tips.py +122 -48
- manim/mobject/graph.py +1027 -419
- manim/mobject/graphing/coordinate_systems.py +533 -278
- manim/mobject/graphing/functions.py +53 -32
- manim/mobject/graphing/number_line.py +123 -65
- manim/mobject/graphing/probability.py +88 -62
- manim/mobject/graphing/scale.py +33 -19
- manim/mobject/logo.py +118 -28
- manim/mobject/matrix.py +87 -83
- manim/mobject/mobject.py +912 -442
- manim/mobject/opengl/dot_cloud.py +16 -5
- manim/mobject/opengl/opengl_compatibility.py +4 -2
- manim/mobject/opengl/opengl_geometry.py +254 -153
- manim/mobject/opengl/opengl_image_mobject.py +3 -1
- manim/mobject/opengl/opengl_mobject.py +779 -482
- manim/mobject/opengl/opengl_point_cloud_mobject.py +41 -14
- manim/mobject/opengl/opengl_surface.py +14 -92
- manim/mobject/opengl/opengl_three_dimensions.py +12 -8
- manim/mobject/opengl/opengl_vectorized_mobject.py +98 -100
- manim/mobject/svg/brace.py +173 -41
- manim/mobject/svg/svg_mobject.py +139 -53
- manim/mobject/table.py +61 -68
- manim/mobject/text/code_mobject.py +193 -539
- manim/mobject/text/numbers.py +81 -34
- manim/mobject/text/tex_mobject.py +130 -78
- manim/mobject/text/text_mobject.py +288 -164
- manim/mobject/three_d/polyhedra.py +111 -13
- manim/mobject/three_d/three_d_utils.py +17 -8
- manim/mobject/three_d/three_dimensions.py +239 -106
- manim/mobject/types/image_mobject.py +50 -30
- manim/mobject/types/point_cloud_mobject.py +120 -75
- manim/mobject/types/vectorized_mobject.py +841 -408
- manim/mobject/value_tracker.py +105 -38
- manim/mobject/vector_field.py +50 -31
- manim/opengl/__init__.py +3 -3
- manim/plugins/__init__.py +14 -1
- manim/plugins/plugins_flags.py +10 -14
- manim/renderer/cairo_renderer.py +65 -50
- manim/renderer/opengl_renderer.py +89 -69
- manim/renderer/opengl_renderer_window.py +39 -18
- manim/renderer/shader.py +123 -87
- manim/renderer/shader_wrapper.py +44 -28
- manim/renderer/vectorized_mobject_rendering.py +38 -10
- manim/scene/moving_camera_scene.py +32 -3
- manim/scene/scene.py +507 -242
- manim/scene/scene_file_writer.py +371 -220
- manim/scene/section.py +20 -16
- manim/scene/three_d_scene.py +14 -22
- manim/scene/vector_space_scene.py +223 -129
- manim/scene/zoomed_scene.py +46 -41
- manim/typing.py +990 -0
- manim/utils/bezier.py +1823 -371
- manim/utils/caching.py +12 -5
- manim/utils/color/AS2700.py +236 -0
- manim/utils/color/BS381.py +318 -0
- manim/utils/color/DVIPSNAMES.py +96 -0
- manim/utils/color/SVGNAMES.py +179 -0
- manim/utils/color/X11.py +533 -0
- manim/utils/color/XKCD.py +952 -0
- manim/utils/color/__init__.py +61 -0
- manim/utils/color/core.py +1667 -0
- manim/utils/color/manim_colors.py +218 -0
- manim/utils/commands.py +48 -20
- manim/utils/config_ops.py +39 -19
- manim/utils/debug.py +8 -7
- manim/utils/deprecation.py +86 -39
- manim/utils/docbuild/__init__.py +17 -0
- manim/utils/docbuild/autoaliasattr_directive.py +236 -0
- manim/utils/docbuild/autocolor_directive.py +99 -0
- manim/utils/docbuild/manim_directive.py +94 -41
- manim/utils/docbuild/module_parsing.py +245 -0
- manim/utils/exceptions.py +6 -0
- manim/utils/family.py +5 -3
- manim/utils/family_ops.py +17 -4
- manim/utils/file_ops.py +27 -17
- manim/utils/hashing.py +55 -45
- manim/utils/images.py +13 -7
- manim/utils/ipython_magic.py +13 -7
- manim/utils/iterables.py +163 -120
- manim/utils/module_ops.py +66 -24
- manim/utils/opengl.py +77 -24
- manim/utils/parameter_parsing.py +32 -0
- manim/utils/paths.py +30 -33
- manim/utils/polylabel.py +235 -0
- manim/utils/qhull.py +218 -0
- manim/utils/rate_functions.py +98 -32
- manim/utils/simple_functions.py +25 -33
- manim/utils/sounds.py +7 -1
- manim/utils/space_ops.py +188 -115
- manim/utils/testing/__init__.py +17 -0
- manim/utils/testing/_frames_testers.py +13 -8
- manim/utils/testing/_show_diff.py +5 -3
- manim/utils/testing/_test_class_makers.py +34 -18
- manim/utils/testing/frames_comparison.py +37 -19
- manim/utils/tex.py +130 -198
- manim/utils/tex_file_writing.py +77 -47
- manim/utils/tex_templates.py +2 -1
- manim/utils/unit.py +6 -5
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/METADATA +64 -65
- manim-0.19.1.dist-info/RECORD +220 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info}/WHEEL +1 -1
- manim-0.19.1.dist-info/entry_points.txt +3 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE.community +1 -1
- manim/cli/new/group.py +0 -189
- manim/communitycolors.py +0 -9
- manim/gui/__init__.py +0 -0
- manim/gui/gui.py +0 -82
- manim/plugins/import_plugins.py +0 -43
- manim/utils/color.py +0 -552
- manim-0.17.0.dist-info/RECORD +0 -206
- manim-0.17.0.dist-info/entry_points.txt +0 -4
- /manim/cli/{new → checkhealth}/__init__.py +0 -0
- {manim-0.17.0.dist-info → manim-0.19.1.dist-info/licenses}/LICENSE +0 -0
|
@@ -2,16 +2,37 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
__all__ = ["OpenGLPMobject", "OpenGLPGroup", "OpenGLPMPoint"]
|
|
4
4
|
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
5
7
|
import moderngl
|
|
6
8
|
import numpy as np
|
|
7
9
|
|
|
8
10
|
from manim.constants import *
|
|
9
11
|
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
|
10
12
|
from manim.utils.bezier import interpolate
|
|
11
|
-
from manim.utils.color import
|
|
13
|
+
from manim.utils.color import (
|
|
14
|
+
BLACK,
|
|
15
|
+
WHITE,
|
|
16
|
+
YELLOW,
|
|
17
|
+
ParsableManimColor,
|
|
18
|
+
color_gradient,
|
|
19
|
+
color_to_rgba,
|
|
20
|
+
)
|
|
12
21
|
from manim.utils.config_ops import _Uniforms
|
|
13
22
|
from manim.utils.iterables import resize_with_interpolation
|
|
14
23
|
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
from manim.typing import (
|
|
28
|
+
FloatRGBA_Array,
|
|
29
|
+
FloatRGBALike_Array,
|
|
30
|
+
Point3D_Array,
|
|
31
|
+
Point3DLike_Array,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
__all__ = ["OpenGLPMobject", "OpenGLPGroup", "OpenGLPMPoint"]
|
|
35
|
+
|
|
15
36
|
|
|
16
37
|
class OpenGLPMobject(OpenGLMobject):
|
|
17
38
|
shader_folder = "true_dot"
|
|
@@ -25,7 +46,11 @@ class OpenGLPMobject(OpenGLMobject):
|
|
|
25
46
|
point_radius = _Uniforms()
|
|
26
47
|
|
|
27
48
|
def __init__(
|
|
28
|
-
self,
|
|
49
|
+
self,
|
|
50
|
+
stroke_width: float = 2.0,
|
|
51
|
+
color: ParsableManimColor = YELLOW,
|
|
52
|
+
render_primitive: int = moderngl.POINTS,
|
|
53
|
+
**kwargs,
|
|
29
54
|
):
|
|
30
55
|
self.stroke_width = stroke_width
|
|
31
56
|
super().__init__(color=color, render_primitive=render_primitive, **kwargs)
|
|
@@ -33,15 +58,21 @@ class OpenGLPMobject(OpenGLMobject):
|
|
|
33
58
|
self.stroke_width * OpenGLPMobject.OPENGL_POINT_RADIUS_SCALE_FACTOR
|
|
34
59
|
)
|
|
35
60
|
|
|
36
|
-
def reset_points(self):
|
|
37
|
-
self.rgbas = np.zeros((1, 4))
|
|
38
|
-
self.points = np.zeros((0, 3))
|
|
61
|
+
def reset_points(self) -> Self:
|
|
62
|
+
self.rgbas: FloatRGBA_Array = np.zeros((1, 4))
|
|
63
|
+
self.points: Point3D_Array = np.zeros((0, 3))
|
|
39
64
|
return self
|
|
40
65
|
|
|
41
66
|
def get_array_attrs(self):
|
|
42
67
|
return ["points", "rgbas"]
|
|
43
68
|
|
|
44
|
-
def add_points(
|
|
69
|
+
def add_points(
|
|
70
|
+
self,
|
|
71
|
+
points: Point3DLike_Array,
|
|
72
|
+
rgbas: FloatRGBALike_Array | None = None,
|
|
73
|
+
color: ParsableManimColor | None = None,
|
|
74
|
+
opacity: float | None = None,
|
|
75
|
+
) -> Self:
|
|
45
76
|
"""Add points.
|
|
46
77
|
|
|
47
78
|
Points must be a Nx3 numpy array.
|
|
@@ -63,13 +94,11 @@ class OpenGLPMobject(OpenGLMobject):
|
|
|
63
94
|
return self
|
|
64
95
|
|
|
65
96
|
def thin_out(self, factor=5):
|
|
66
|
-
"""
|
|
67
|
-
Removes all but every nth point for n = factor
|
|
68
|
-
"""
|
|
97
|
+
"""Removes all but every nth point for n = factor"""
|
|
69
98
|
for mob in self.family_members_with_points():
|
|
70
99
|
num_points = mob.get_num_points()
|
|
71
100
|
|
|
72
|
-
def thin_func():
|
|
101
|
+
def thin_func(num_points=num_points):
|
|
73
102
|
return np.arange(0, num_points, factor)
|
|
74
103
|
|
|
75
104
|
if len(mob.points) == len(mob.rgbas):
|
|
@@ -124,9 +153,7 @@ class OpenGLPMobject(OpenGLMobject):
|
|
|
124
153
|
return self
|
|
125
154
|
|
|
126
155
|
def sort_points(self, function=lambda p: p[0]):
|
|
127
|
-
"""
|
|
128
|
-
function is any map from R^3 to R
|
|
129
|
-
"""
|
|
156
|
+
"""function is any map from R^3 to R"""
|
|
130
157
|
for mob in self.family_members_with_points():
|
|
131
158
|
indices = np.argsort(np.apply_along_axis(function, 1, mob.points))
|
|
132
159
|
for key in mob.data:
|
|
@@ -162,7 +189,7 @@ class OpenGLPMobject(OpenGLMobject):
|
|
|
162
189
|
|
|
163
190
|
class OpenGLPGroup(OpenGLPMobject):
|
|
164
191
|
def __init__(self, *pmobs, **kwargs):
|
|
165
|
-
if not all(
|
|
192
|
+
if not all(isinstance(m, OpenGLPMobject) for m in pmobs):
|
|
166
193
|
raise Exception("All submobjects must be of type OpenglPMObject")
|
|
167
194
|
super().__init__(**kwargs)
|
|
168
195
|
self.add(*pmobs)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from collections.abc import Iterable
|
|
3
4
|
from pathlib import Path
|
|
4
|
-
from typing import Iterable
|
|
5
5
|
|
|
6
6
|
import moderngl
|
|
7
7
|
import numpy as np
|
|
@@ -9,14 +9,16 @@ from PIL import Image
|
|
|
9
9
|
|
|
10
10
|
from manim.constants import *
|
|
11
11
|
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
|
12
|
+
from manim.typing import Point3D_Array, Vector3D_Array
|
|
12
13
|
from manim.utils.bezier import integer_interpolate, interpolate
|
|
13
14
|
from manim.utils.color import *
|
|
14
15
|
from manim.utils.config_ops import _Data, _Uniforms
|
|
15
|
-
from manim.utils.deprecation import deprecated
|
|
16
16
|
from manim.utils.images import change_to_rgba_array, get_full_raster_image_path
|
|
17
17
|
from manim.utils.iterables import listify
|
|
18
18
|
from manim.utils.space_ops import normalize_along_axis
|
|
19
19
|
|
|
20
|
+
__all__ = ["OpenGLSurface", "OpenGLTexturedSurface"]
|
|
21
|
+
|
|
20
22
|
|
|
21
23
|
class OpenGLSurface(OpenGLMobject):
|
|
22
24
|
r"""Creates a Surface.
|
|
@@ -98,6 +100,7 @@ class OpenGLSurface(OpenGLMobject):
|
|
|
98
100
|
# can crop up in the shaders.
|
|
99
101
|
self.epsilon = epsilon
|
|
100
102
|
|
|
103
|
+
self.triangle_indices = None
|
|
101
104
|
super().__init__(
|
|
102
105
|
color=color,
|
|
103
106
|
opacity=opacity,
|
|
@@ -127,7 +130,7 @@ class OpenGLSurface(OpenGLMobject):
|
|
|
127
130
|
# - Those generated by values nudged by du
|
|
128
131
|
# - Those generated by values nudged by dv
|
|
129
132
|
point_lists = []
|
|
130
|
-
for
|
|
133
|
+
for du, dv in [(0, 0), (self.epsilon, 0), (0, self.epsilon)]:
|
|
131
134
|
uv_grid = np.array([[[u + du, v + dv] for v in v_range] for u in u_range])
|
|
132
135
|
point_grid = np.apply_along_axis(lambda p: self.uv_func(*p), 2, uv_grid)
|
|
133
136
|
point_lists.append(point_grid.reshape((nu * nv, dim)))
|
|
@@ -158,12 +161,14 @@ class OpenGLSurface(OpenGLMobject):
|
|
|
158
161
|
def get_triangle_indices(self):
|
|
159
162
|
return self.triangle_indices
|
|
160
163
|
|
|
161
|
-
def get_surface_points_and_nudged_points(
|
|
164
|
+
def get_surface_points_and_nudged_points(
|
|
165
|
+
self,
|
|
166
|
+
) -> tuple[Point3D_Array, Point3D_Array, Point3D_Array]:
|
|
162
167
|
points = self.points
|
|
163
168
|
k = len(points) // 3
|
|
164
169
|
return points[:k], points[k : 2 * k], points[2 * k :]
|
|
165
170
|
|
|
166
|
-
def get_unit_normals(self):
|
|
171
|
+
def get_unit_normals(self) -> Vector3D_Array:
|
|
167
172
|
s_points, du_points, dv_points = self.get_surface_points_and_nudged_points()
|
|
168
173
|
normals = np.cross(
|
|
169
174
|
(du_points - s_points) / self.epsilon,
|
|
@@ -260,7 +265,9 @@ class OpenGLSurface(OpenGLMobject):
|
|
|
260
265
|
shader_data["du_point"] = du_points
|
|
261
266
|
shader_data["dv_point"] = dv_points
|
|
262
267
|
if self.colorscale:
|
|
263
|
-
|
|
268
|
+
if not hasattr(self, "color_by_val"):
|
|
269
|
+
self.color_by_val = self._get_color_by_value(s_points)
|
|
270
|
+
shader_data["color"] = self.color_by_val
|
|
264
271
|
else:
|
|
265
272
|
self.fill_in_shader_color_info(shader_data)
|
|
266
273
|
return shader_data
|
|
@@ -340,91 +347,6 @@ class OpenGLSurface(OpenGLMobject):
|
|
|
340
347
|
def get_shader_vert_indices(self):
|
|
341
348
|
return self.get_triangle_indices()
|
|
342
349
|
|
|
343
|
-
@deprecated(
|
|
344
|
-
since="v0.16.0",
|
|
345
|
-
message="Use colorscale attribute instead.",
|
|
346
|
-
)
|
|
347
|
-
def set_fill_by_value(self, axes, colors):
|
|
348
|
-
# directly copied from three_dimensions.py with some compatibility changes.
|
|
349
|
-
"""Sets the color of each mobject of a parametric surface to a color relative to its z-value
|
|
350
|
-
|
|
351
|
-
Parameters
|
|
352
|
-
----------
|
|
353
|
-
axes :
|
|
354
|
-
The axes for the parametric surface, which will be used to map z-values to colors.
|
|
355
|
-
colors :
|
|
356
|
-
A list of colors, ordered from lower z-values to higher z-values. If a list of tuples is passed
|
|
357
|
-
containing colors paired with numbers, then those numbers will be used as the pivots.
|
|
358
|
-
|
|
359
|
-
Returns
|
|
360
|
-
-------
|
|
361
|
-
:class:`~.Surface`
|
|
362
|
-
The parametric surface with a gradient applied by value. For chaining.
|
|
363
|
-
|
|
364
|
-
Examples
|
|
365
|
-
--------
|
|
366
|
-
.. manim:: FillByValueExample
|
|
367
|
-
:save_last_frame:
|
|
368
|
-
|
|
369
|
-
class FillByValueExample(ThreeDScene):
|
|
370
|
-
def construct(self):
|
|
371
|
-
resolution_fa = 42
|
|
372
|
-
self.set_camera_orientation(phi=75 * DEGREES, theta=-120 * DEGREES)
|
|
373
|
-
axes = ThreeDAxes(x_range=(0, 5, 1), y_range=(0, 5, 1), z_range=(-1, 1, 0.5))
|
|
374
|
-
def param_surface(u, v):
|
|
375
|
-
x = u
|
|
376
|
-
y = v
|
|
377
|
-
z = np.sin(x) * np.cos(y)
|
|
378
|
-
return z
|
|
379
|
-
surface_plane = Surface(
|
|
380
|
-
lambda u, v: axes.c2p(u, v, param_surface(u, v)),
|
|
381
|
-
resolution=(resolution_fa, resolution_fa),
|
|
382
|
-
v_range=[0, 5],
|
|
383
|
-
u_range=[0, 5],
|
|
384
|
-
)
|
|
385
|
-
# surface_plane.set_style(fill_opacity=1)
|
|
386
|
-
surface_plane.set_fill_by_value(axes=axes, colors=[(RED, -0.4), (YELLOW, 0), (GREEN, 0.4)])
|
|
387
|
-
self.add(axes, surface_plane)
|
|
388
|
-
"""
|
|
389
|
-
if type(colors[0]) is tuple:
|
|
390
|
-
new_colors, pivots = [[i for i, j in colors], [j for i, j in colors]]
|
|
391
|
-
else:
|
|
392
|
-
new_colors = colors
|
|
393
|
-
|
|
394
|
-
pivot_min = axes.z_range[0]
|
|
395
|
-
pivot_max = axes.z_range[1]
|
|
396
|
-
pivot_frequency = (pivot_max - pivot_min) / (len(new_colors) - 1)
|
|
397
|
-
pivots = np.arange(
|
|
398
|
-
start=pivot_min,
|
|
399
|
-
stop=pivot_max + pivot_frequency,
|
|
400
|
-
step=pivot_frequency,
|
|
401
|
-
)
|
|
402
|
-
|
|
403
|
-
for mob in self.family_members_with_points():
|
|
404
|
-
# import ipdb; ipdb.set_trace(context=7)
|
|
405
|
-
z_value = axes.point_to_coords(mob.get_midpoint())[2]
|
|
406
|
-
if z_value <= pivots[0]:
|
|
407
|
-
mob.set_color(new_colors[0])
|
|
408
|
-
elif z_value >= pivots[-1]:
|
|
409
|
-
mob.set_color(new_colors[-1])
|
|
410
|
-
else:
|
|
411
|
-
for i, pivot in enumerate(pivots):
|
|
412
|
-
if pivot > z_value:
|
|
413
|
-
color_index = (z_value - pivots[i - 1]) / (
|
|
414
|
-
pivots[i] - pivots[i - 1]
|
|
415
|
-
)
|
|
416
|
-
color_index = min(color_index, 1)
|
|
417
|
-
mob_color = interpolate_color(
|
|
418
|
-
new_colors[i - 1],
|
|
419
|
-
new_colors[i],
|
|
420
|
-
color_index,
|
|
421
|
-
)
|
|
422
|
-
mob.set_color(mob_color, recurse=False)
|
|
423
|
-
|
|
424
|
-
break
|
|
425
|
-
|
|
426
|
-
return self
|
|
427
|
-
|
|
428
350
|
|
|
429
351
|
class OpenGLSurfaceGroup(OpenGLSurface):
|
|
430
352
|
def __init__(self, *parametric_surfaces, resolution=None, **kwargs):
|
|
@@ -462,7 +384,7 @@ class OpenGLTexturedSurface(OpenGLSurface):
|
|
|
462
384
|
|
|
463
385
|
if not isinstance(uv_surface, OpenGLSurface):
|
|
464
386
|
raise Exception("uv_surface must be of type OpenGLSurface")
|
|
465
|
-
if
|
|
387
|
+
if isinstance(image_file, np.ndarray):
|
|
466
388
|
image_file = change_to_rgba_array(image_file)
|
|
467
389
|
|
|
468
390
|
# Set texture information
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
3
5
|
import numpy as np
|
|
4
6
|
|
|
5
7
|
from manim.mobject.opengl.opengl_surface import OpenGLSurface
|
|
6
8
|
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVGroup, OpenGLVMobject
|
|
7
9
|
|
|
10
|
+
__all__ = ["OpenGLSurfaceMesh"]
|
|
11
|
+
|
|
8
12
|
|
|
9
13
|
class OpenGLSurfaceMesh(OpenGLVGroup):
|
|
10
14
|
def __init__(
|
|
11
15
|
self,
|
|
12
|
-
uv_surface,
|
|
13
|
-
resolution=None,
|
|
14
|
-
stroke_width=1,
|
|
15
|
-
normal_nudge=1e-2,
|
|
16
|
-
depth_test=True,
|
|
17
|
-
flat_stroke=False,
|
|
18
|
-
**kwargs,
|
|
16
|
+
uv_surface: OpenGLSurface,
|
|
17
|
+
resolution: tuple[int, int] | None = None,
|
|
18
|
+
stroke_width: float = 1,
|
|
19
|
+
normal_nudge: float = 1e-2,
|
|
20
|
+
depth_test: bool = True,
|
|
21
|
+
flat_stroke: bool = False,
|
|
22
|
+
**kwargs: Any,
|
|
19
23
|
):
|
|
20
24
|
if not isinstance(uv_surface, OpenGLSurface):
|
|
21
25
|
raise Exception("uv_surface must be of type OpenGLSurface")
|
|
@@ -29,7 +33,7 @@ class OpenGLSurfaceMesh(OpenGLVGroup):
|
|
|
29
33
|
**kwargs,
|
|
30
34
|
)
|
|
31
35
|
|
|
32
|
-
def init_points(self):
|
|
36
|
+
def init_points(self) -> None:
|
|
33
37
|
uv_surface = self.uv_surface
|
|
34
38
|
|
|
35
39
|
full_nu, full_nv = uv_surface.resolution
|