Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add example for :class:~.`ParametricSurface` (#1657)

Nikhil Garuda7718c2bb0ef7
diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.py
index 7c1e9a780..5fc8fa480 100644
--- a/manim/mobject/three_dimensions.py
+++ b/manim/mobject/three_dimensions.py
@@ -32,6 +32,30 @@ class ThreeDVMobject(VMobject):
class ParametricSurface(VGroup):
+ """Creates a Parametric Surface
+
+ Examples
+ --------
+ .. manim:: ParaSurface
+ :save_last_frame:
+
+ class ParaSurface(ThreeDScene):
+ def func(self, u, v):
+ return np.array([np.cos(u) * np.cos(v), np.cos(u) * np.sin(v), u])
+
+ def construct(self):
+ axes = ThreeDAxes(x_range=[-4,4], x_length=8)
+ surface = ParametricSurface(
+ lambda u, v: axes.c2p(*self.func(u, v)),
+ u_min=-PI,
+ u_max=PI,
+ v_min=0,
+ v_max=TAU,
+ )
+ self.set_camera_orientation(theta=70 * DEGREES, phi=75 * DEGREES)
+ self.add(axes, surface)
+ """
+
def __init__(
self,
func,