Skip to content

Commit 0283b6f

Browse files
MysaaJavabehackl
andauthored
Update docs/source/examples/3d.rst
Co-authored-by: Benjamin Hackl <[email protected]>
1 parent 8ce994a commit 0283b6f

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

docs/source/examples/3d.rst

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,49 +82,51 @@
8282
.. manim:: ThreeDFunctionPlot
8383

8484
class ThreeDFunctionPlot(ThreeDScene):
85-
8685
def construct(self):
87-
88-
resolution_fa=22
86+
resolution_fa = 22
8987
self.set_camera_orientation(phi=75 * DEGREES, theta=-30 * DEGREES)
9088

91-
def param_plane(u,v):
92-
x=u
93-
y=v
94-
z=0
95-
return np.array([x,y,z])
96-
plane = ParametricSurface( param_plane,
97-
resolution = (resolution_fa,resolution_fa),
98-
v_min = -2,
99-
v_max = +2,
100-
u_min = -2,
101-
u_max = +2 )
102-
plane.scale_about_point(2,ORIGIN)
103-
104-
def param_gauss(u,v):
105-
x=u
106-
y=v
89+
def param_plane(u, v):
90+
x = u
91+
y = v
92+
z = 0
93+
return np.array([x, y, z])
94+
95+
plane = ParametricSurface(
96+
param_plane,
97+
resolution=(resolution_fa, resolution_fa),
98+
v_min=-2,
99+
v_max=+2,
100+
u_min=-2,
101+
u_max=+2,
102+
)
103+
plane.scale_about_point(2, ORIGIN)
104+
105+
def param_gauss(u, v):
106+
x = u
107+
y = v
107108
d = np.sqrt(x * x + y * y)
108109
sigma, mu = 0.4, 0.0
109-
z= np.exp(-((d - mu) ** 2 / (2.0 * sigma ** 2)))
110-
return np.array([x,y,z])
111-
112-
gauss_plane = ParametricSurface( param_gauss,
113-
resolution = (resolution_fa, resolution_fa),
114-
v_min = -2,
115-
v_max = +2,
116-
u_min = -2,
117-
u_max = +2 )
118-
119-
gauss_plane.scale_about_point(2,ORIGIN)
110+
z = np.exp(-((d - mu) ** 2 / (2.0 * sigma ** 2)))
111+
return np.array([x, y, z])
112+
113+
gauss_plane = ParametricSurface(
114+
param_gauss,
115+
resolution=(resolution_fa, resolution_fa),
116+
v_min=-2,
117+
v_max=+2,
118+
u_min=-2,
119+
u_max=+2,
120+
)
121+
122+
gauss_plane.scale_about_point(2, ORIGIN)
120123
gauss_plane.set_style(fill_opacity=1)
121124
gauss_plane.set_style(stroke_color=GREEN)
122-
gauss_plane.set_fill_by_checkerboard(GREEN,BLUE,opacity=0.1)
123-
125+
gauss_plane.set_fill_by_checkerboard(GREEN, BLUE, opacity=0.1)
126+
124127
axes = ThreeDAxes()
125-
128+
126129
self.add(axes)
127130
self.play(Write(plane))
128-
self.play(Transform(plane,gauss_plane))
131+
self.play(Transform(plane, gauss_plane))
129132
self.wait()
130-

0 commit comments

Comments
 (0)