-
Notifications
You must be signed in to change notification settings - Fork 0
/
proj_test.py
52 lines (48 loc) · 1.09 KB
/
proj_test.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
from plot import Plot
from plot.utils import vec3
from plot.camera import Camera
def main(p: Plot):
p.clipping = False
p.setup()
paths = [
[
vec3(-1, -1, -1),
vec3(-1, -1, 1),
vec3(1, -1, 1),
vec3(1, -1, -1),
vec3(-1, -1, -1),
],
[
vec3(-1, 1, -1),
vec3(-1, 1, 1),
vec3(1, 1, 1),
vec3(1, 1, -1),
vec3(-1, 1, -1),
],
[
vec3(-1, 1, -1),
vec3(-1, -1, -1),
],
[
vec3(-1, 1, 1),
vec3(-1, -1, 1),
],
[
vec3(1, 1, 1),
vec3(1, -1, 1),
],
[
vec3(1, 1, -1),
vec3(1, -1, -1),
],
]
cam = Camera()
cam.set_view(vec3(4, 8, 10), vec3(0))
cam.set_proj_persp(20, -1, 1)
# cam.set_proj_orth(4, -1, 1)
for path in paths:
p.goto(*cam.eval(path[0]).xy)
for point in path[1:]:
point = cam.eval(point)
print(point)
p.lineto(*point.xy)