-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuerpos.py
164 lines (130 loc) · 5.33 KB
/
cuerpos.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
from punto import *
from patch import *
from variables import *
def patchesCubo(origin,lengthx,lengthy,lengthz,lum,color):
patchesCubo = []
iterationsx = (int)(SECTIONS*lengthx)
iterationsy = (int)(SECTIONS*lengthy)
iterationsz = (int)(SECTIONS*lengthz)
x0 = origin.x
y0 = origin.y
z0 = origin.z
for i in xrange(0, iterationsx): #eje horizonal
for j in xrange(0, iterationsy): #eje vertical
patch = None # variable temporal para cada patch
p1 = Punto(x0, y0, z0)
p2 = Punto(x0 + step, y0, z0)
p3 = Punto(x0, y0 + step, z0)
p4 = Punto(x0 + step, y0 + step, z0)
patch = Patch(p3, p4, p2, p1)
y0 += step
patch.reflectance_red = color[0]
patch.reflectance_green = color[1]
patch.reflectance_blue = color[2]
# asocio el parche recien creado a la lista
patchesCubo.append(patch)
x0 += step
y0 = origin.y
#planoXZ
x0 = origin.x
y0 = origin.y
z0 = origin.z
for i in xrange(0, iterationsx): #eje horizonal
for j in xrange(0, iterationsz): #eje vertical
patch = None # variable temporal para cada patch
p1 = Punto(x0, y0, z0)
p2 = Punto(x0, y0, z0 + step)
p3 = Punto(x0 + step, y0, z0)
p4 = Punto(x0 + step, y0, z0 + step)
patch = Patch(p3, p4, p2, p1)
z0 += step
patch.reflectance_red = color[0]
patch.reflectance_green = color[1]
patch.reflectance_blue = color[2]
# asocio el parche recien creado a la lista
patchesCubo.append(patch)
x0 += step
z0 = origin.z
############################################################
x0 = origin.x
y0 = origin.y
z0 = origin.z
for i in xrange(0, iterationsx): #eje horizonal
for j in xrange(0, iterationsy): #eje vertical
patch = None # variable temporal para cada patch
p1 = Punto(x0, y0, z0+lengthz)
p2 = Punto(x0 + step, y0, z0+lengthz)
p3 = Punto(x0, y0 + step, z0+lengthz)
p4 = Punto(x0 + step, y0 + step, z0+lengthz)
patch = Patch(p1, p2, p4, p3)
y0 += step
patch.reflectance_red = color[0]
patch.reflectance_green = color[1]
patch.reflectance_blue = color[2]
# asocio el parche recien creado a la lista
patchesCubo.append(patch)
x0 += step
y0 = origin.y
#planoYZ
x0 = origin.x
y0 = origin.y
z0 = origin.z
for i in xrange(0, iterationsz): #eje horizonal
for j in xrange(0, iterationsy): #eje vertical
patch = None # variable temporal para cada patch
p1 = Punto( x0+lengthx, y0, z0)
p2 = Punto( x0+lengthx, y0 + step, z0)
p3 = Punto( x0+lengthx, y0, z0 + step)
p4 = Punto( x0+lengthx, y0 + step, z0 + step)
patch = Patch(p1, p2, p4, p3)
y0 += step
patch.reflectance_red = color[0]
patch.reflectance_green = color[1]
patch.reflectance_blue = color[2]
# asocio el parche recien creado a la lista
patchesCubo.append(patch)
z0 += step
y0 = origin.y
#planoXZ
x0 = origin.x
y0 = origin.y
z0 = origin.z
for i in xrange(0, iterationsx): #eje horizonal
for j in xrange(0, iterationsz): #eje vertical
patch = None # variable temporal para cada patch
p1 = Punto(x0, y0+lengthy, z0)
p2 = Punto(x0, y0+lengthy, z0 + step)
p3 = Punto(x0 + step, y0+lengthy, z0)
p4 = Punto(x0 + step, y0+lengthy, z0 + step)
patch = Patch(p1, p2, p4, p3)
z0 += step
patch.reflectance_red = color[0]
patch.reflectance_green = color[1]
patch.reflectance_blue = color[2]
# asocio el parche recien creado a la lista
patchesCubo.append(patch)
x0 += step
z0 = origin.z
#planoYZ
x0 = origin.x
y0 = origin.y
z0 = origin.z
for i in xrange(0, iterationsz): #eje horizonal
for j in xrange(0, iterationsy): #eje vertical
patch = None # variable temporal para cada patch
p1 = Punto( x0, y0, z0)
p2 = Punto( x0, y0 + step, z0)
p3 = Punto( x0, y0, z0 + step)
p4 = Punto( x0, y0 + step, z0 + step)
patch = Patch(p3, p4, p2, p1)
y0 += step
patch.reflectance_red = color[0]
patch.reflectance_green = color[1]
patch.reflectance_blue = color[2]
# asocio el parche recien creado a la lista
patchesCubo.append(patch)
z0 += step
y0 = origin.y
for patch in patchesCubo:
patch.oclussion = True
return patchesCubo