forked from vivek3141/videos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elliptic.py
54 lines (43 loc) · 1.17 KB
/
elliptic.py
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
from manimlib import *
import itertools
class Cylinder(Sphere):
def func(self, u, v):
return np.array([
np.cos(v),
np.sin(v),
np.cos(u)
])
class UnwrappedCylinder(Cylinder):
def func(self, u, v):
return np.array([
v - PI,
-self.radius,
np.cos(u)
])
class Scene(Scene):
def interact(self):
self.quit_interaction = False
self.lock_static_mobject_data()
try:
while True:
self.update_frame()
except KeyboardInterrupt:
self.unlock_mobject_data()
class LatticeTorus(Scene):
def construct(self):
f_plane_kwargs = {
"x_range": (-4, 4),
"y_range": (-3, 3)
}
points = VGroup()
plane2 = NumberPlane(**f_plane_kwargs)
for x, y in itertools.product(*[np.arange(args[0], args[1]+1, args[2]) for args in plane2.get_all_ranges()]):
points.add(Dot([x, y, 0]))
self.add(plane2, points)
self.embed()
def cyln(self, u, v):
return np.array([
np.cos(u),
np.sin(u),
v
])