Skip to content

Commit 7718c2b

Browse files
Nikhil0504jsonvillanuevaabhijithmuthyala
authored
Add example for :class:~.ParametricSurface (#1657)
* Add example. * fix example placement. * Update manim/mobject/three_dimensions.py Co-authored-by: Jason Villanueva <[email protected]> * Update manim/mobject/three_dimensions.py Co-authored-by: Abhijith Muthyala <[email protected]> * Update manim/mobject/three_dimensions.py Co-authored-by: Abhijith Muthyala <[email protected]> * Update three_dimensions.py Co-authored-by: Jason Villanueva <[email protected]> Co-authored-by: Abhijith Muthyala <[email protected]>
1 parent da1dd29 commit 7718c2b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

manim/mobject/three_dimensions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@ def __init__(self, shade_in_3d=True, **kwargs):
3232

3333

3434
class ParametricSurface(VGroup):
35+
"""Creates a Parametric Surface
36+
37+
Examples
38+
--------
39+
.. manim:: ParaSurface
40+
:save_last_frame:
41+
42+
class ParaSurface(ThreeDScene):
43+
def func(self, u, v):
44+
return np.array([np.cos(u) * np.cos(v), np.cos(u) * np.sin(v), u])
45+
46+
def construct(self):
47+
axes = ThreeDAxes(x_range=[-4,4], x_length=8)
48+
surface = ParametricSurface(
49+
lambda u, v: axes.c2p(*self.func(u, v)),
50+
u_min=-PI,
51+
u_max=PI,
52+
v_min=0,
53+
v_max=TAU,
54+
)
55+
self.set_camera_orientation(theta=70 * DEGREES, phi=75 * DEGREES)
56+
self.add(axes, surface)
57+
"""
58+
3559
def __init__(
3660
self,
3761
func,

0 commit comments

Comments
 (0)