summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/surface-integrals/file1_projection.py
blob: 2d6f0676223be949a5731f255226b13c3002a993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
from manimlib.imports import *

class Surface(ThreeDScene):

	def construct(self):
		axes=ThreeDAxes()
		x=TextMobject("X")
		y=TextMobject("Y")
		z=TextMobject("Z")

		x.rotate(PI/2, axis=RIGHT)
		x.rotate(PI/4,axis=OUT)
		x.shift(5.8*DOWN)

		y.rotate(PI/2, axis=RIGHT)
		y.rotate(PI/8,axis=OUT)
		y.shift(5.8*RIGHT)

		z.rotate(PI/2, axis=RIGHT)
		z.rotate(PI/5,axis=OUT)
		z.shift(3.2*OUT+0.4*LEFT)
		axis_label=VGroup(x,y,z)





		para_hyp = ParametricSurface(
			lambda u, v: np.array([
				u,
				v,
				2+u/4+np.sin(v)
			]),v_min=-3,v_max=-0.4,u_min=-1,u_max=1,
			resolution=(15, 32)).scale(1)
		para_hyp.scale(0.3)
		para_hyp.shift(1.2*RIGHT + 0.2*OUT + 0.4*DOWN)
		para_hyp.rotate(PI,axis=RIGHT)
		para_hyp.scale(2.5)
		# para_hyp.rotate(PI/3.2,axis=OUT)
		para_hyp2= ParametricSurface(
			lambda u, v: np.array([
				u,
				v,
				2+u/4+np.sin(v)
			]),v_min=-3,v_max=-0.4,u_min=-1,u_max=1,
			resolution=(15, 32)).scale(1)
		para_hyp2.scale(0.3)
		para_hyp2.shift(1.2*RIGHT + 0.2*OUT + 0.4*DOWN)
		para_hyp2.rotate(PI,axis=RIGHT)
		para_hyp2.scale(2.5)

		rec=Rectangle(height=2.11, width=1.58, color=RED, fill_opacity=0.66)
		rec.shift(1.3*RIGHT +  2.295*DOWN)
		# rec.scale(2.5)


		l1=DashedLine(start=0.5*RIGHT+1.1*DOWN+1.55*OUT,end=0.5*RIGHT+1.1*DOWN)
		l2=DashedLine(start=2.1*RIGHT+1.1*DOWN+1.25*OUT,end=2.1*RIGHT+1.1*DOWN)
		l3=DashedLine(start=2.1*RIGHT+3.4*DOWN+1.6*OUT,end=2.1*RIGHT+3.4*DOWN)
		l4=DashedLine(start=0.5*RIGHT+3.4*DOWN+2*OUT,end=0.5*RIGHT+3.4*DOWN)
		l=VGroup(l1,l2,l3,l4)

		
		
		s=TextMobject("S",tex_to_color_map={"S": YELLOW})
		s.rotate(PI/4,axis=RIGHT)
		s.rotate(PI/15,axis=OUT)
		s.shift(RIGHT + 2*OUT + 1.5*DOWN)
		d=TextMobject("D",tex_to_color_map={"D": YELLOW})
		d.scale(0.85)
		d.shift(1.26*RIGHT +  2.45*DOWN)




		
		self.set_camera_orientation(phi=75 * DEGREES,theta=-60*DEGREES)
		self.begin_ambient_camera_rotation(rate=-0.02)
		self.play(ShowCreation(axes),ShowCreation(axis_label))
		self.wait(1.3)
		self.play(ShowCreation(para_hyp))
		self.play(ShowCreation(s))
		self.add(para_hyp2)
		self.play(Transform(para_hyp,rec),run_time=2)
		self.play(ShowCreation(d))
		
		self.wait(3)