-
Notifications
You must be signed in to change notification settings - Fork 0
/
primitive_creation.py
59 lines (51 loc) · 1.47 KB
/
primitive_creation.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
55
56
57
58
59
from D_mesh import d_mesh, d_vertex, d_tri
def make_cube():
cube = d_mesh('cube')
aaa = cube.add_vertex(1.0,1.0,1.0)
aab = cube.add_vertex(1.0,1.0,-1.0)
aba = cube.add_vertex(1.0,-1.0,1.0)
abb = cube.add_vertex(1.0,-1.0,-1.0)
baa = cube.add_vertex(-1.0,1.0,1.0)
bab = cube.add_vertex(-1.0,1.0,-1.0)
bba = cube.add_vertex(-1.0,-1.0,1.0)
bbb = cube.add_vertex(-1.0,-1.0,-1.0)
cube.add_face(aaa,aab,abb)
cube.add_face(aba,aaa,abb)
cube.add_face(bba,aaa,aba)
cube.add_face(baa,aaa,bba)
cube.add_face(bab,baa,aaa)
cube.add_face(bab,aaa,aab)
cube.add_face(bbb,bab,aab)
cube.add_face(bbb,aab,abb)
cube.add_face(bbb,aba,abb)
cube.add_face(bbb,bba,aba)
cube.add_face(bbb,bba,baa)
cube.add_face(bbb,baa,bab)
cube.find_edge_twins()
cube.draw()
return cube
def make_zig():
cube = d_mesh('cube')
aaa = cube.add_vertex(0.5,0.5,1.0)
aab = cube.add_vertex(1.0,1.0,-1.0)
aba = cube.add_vertex(0.5,-0.5,1.0)
abb = cube.add_vertex(1.0,-1.0,-1.0)
baa = cube.add_vertex(-0.5,0.5,1.0)
bab = cube.add_vertex(-1.0,1.0,-1.0)
bba = cube.add_vertex(-0.5,-0.5,1.0)
bbb = cube.add_vertex(-1.0,-1.0,-1.0)
cube.add_face(aaa,aab,abb)
cube.add_face(aba,aaa,abb)
cube.add_face(bba,aaa,aba)
cube.add_face(baa,aaa,bba)
cube.add_face(bab,baa,aaa)
cube.add_face(bab,aaa,aab)
cube.add_face(bbb,bab,aab)
cube.add_face(bbb,aab,abb)
cube.add_face(bbb,aba,abb)
cube.add_face(bbb,bba,aba)
cube.add_face(bbb,bba,baa)
cube.add_face(bbb,baa,bab)
cube.find_edge_twins()
cube.draw()
return cube