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
|
#include "Temparray.h"
Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
temparraynew = new float[x0*y0*z0*6*4];
temparrayold = new float[x0*y0*z0*6*4];
cubearray = new Cubehole[x0*y0*z0*6];
sx = x0;
sy = y0;
sz = z0;
tempInit(initialtemp, x0, y0, z0);
// static const float pos[5] = {-2.0, -1.0, 0.0, 1.0, 2.0};
for(int i = 0; i < x0; ++i) {
for(int j = 0; j < y0; ++j) {
for(int k = 0; k < z0; ++k) {
for(int l = 0; l < 6; ++l) {
cubehole(i, j, k, l).setSize((6-l)/6.0*0.9, 0.9, (6-l)/6.0*0.9, (5-l)/6.0*0.9, (5-l)/6.0*0.9);
float x, y, z;
if(x0 % 2 == 0) x = -(x0/2)+i+0.5;
else if(x0 % 2 == 1) x = -(x0-1)/2+i;
if(y0 % 2 == 0) y = -(y0/2)+j+0.5;
else if(y0 % 2 == 1) y = -(y0-1)/2+j;
if(z0 % 2 == 0) z = -(z0/2)+k+0.5;
else if(z0 % 2 == 1) z = -(z0-1)/2+k;
cubehole(i, j, k, l).setPos(x, y, z);
cubehole(i, j, k, l).setColor(vmml::vec4f(1.0, 0.5, 1.0, 1.0),
vmml::vec4f(0.5, 0.5, 1.0, 1.0),
vmml::vec4f(1.0, 0.5, 0.0, 1.0),
vmml::vec4f(0.0, 0.5, 0.0, 1.0));
}
}
}
}
cubehole(0, 0, 0, 0).setColor(vmml::vec4f(1.0, 0.5, 1.0, 1.0),
vmml::vec4f(0.5, 0.5, 1.0, 1.0),
vmml::vec4f(1.0, 0.5, 0.0, 1.0),
vmml::vec4f(0.0, 0.0, 0.0, 1.0));
}
void Temparray::calcTemp(int x, int y, int z, int line, int pos){
}
std::list<Triangle> Temparray::getTriangles(){
std::list<Triangle> triangles;
for(int i = 0; i < sx; ++i) {
for(int j = 0; j < sy; ++j) {
for(int k = 0; k < sz; ++k) {
for(int l = 0; l < 6; ++l) {
std::list<Triangle> t = cubehole(i, j, k, l).getTriangles();
triangles.splice(triangles.end(), t);
}
}
}
}
return triangles;
}
|