diff options
author | Constantin Riß <constantin.riss@dre.de> | 2009-12-30 17:29:46 +0100 |
---|---|---|
committer | Constantin Riß <constantin.riss@dre.de> | 2009-12-30 17:29:46 +0100 |
commit | 85f21b7ff3c227c73e8182b0480b6cbf8cb3f28d (patch) | |
tree | 1ad9013807189f07d40b1e04c5d9117ead8d7120 | |
parent | d0b6aa0c6406c0a22404d8999f889242cef54e1e (diff) | |
download | c3d-85f21b7ff3c227c73e8182b0480b6cbf8cb3f28d.tar c3d-85f21b7ff3c227c73e8182b0480b6cbf8cb3f28d.zip |
kleine änderung
-rw-r--r-- | Temparray.h | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/Temparray.h b/Temparray.h index fe9e91b..e730e07 100644 --- a/Temparray.h +++ b/Temparray.h @@ -8,8 +8,8 @@ class Temparray { public: Temparray(float initialtemp, int x0, int y0, int z0){ - float *temperature = new float[x0, y0, z0, 4, 6]; - Cubehole *cubearray = new Cubehole[x0, y0, z0]; + float *temperature = new float[x0, y0, z0, 6, 4]; + Cubehole *cubearray = new Cubehole[x0, y0, z0, 6]; tempInit(initialtemp, x0, y0, z0); size[0] = x0; size[1] = y0; size[2] = z0; } @@ -18,29 +18,34 @@ class Temparray delete[] cubearray; } - void setTemp(float temp, int x, int y, int z, int direct, int pos){ - temperature[x, y, z, direct, pos] = temp; + void setTemp(float temp, int x, int y, int z, int line, int pos){ + temperature[x, y, z, line, pos] = temp; + calcAverage(); } - void deactivateCube(int x, int y, int z){ - for(int i=0; i<4; i++){ - for(int j=0; j<6; j++){ +/* void deactivateCube(int x, int y, int z){ + for(int i=0; i<6; i++){ + for(int j=0; j<4; j++){ setTemp(-100, x, y, z, i, j); } } - } + }*/ void display(); private: float *temperature; Cubehole *cubearray; int size[3]; + float averagetemp; + + void setColor(){ + } void tempInit(float temp0, int x0, int y0, int z0){ 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<4; l++){ - for(int m=0; m<6; m++){ + for(int l=0; l<6; l++){ + for(int m=0; m<4; m++){ setTemp(temp0, i, j, k, l, m); } } @@ -48,6 +53,25 @@ class Temparray } } } + void calcAverage(){ + float tempcache = 0; + int times = 0; + for(int i=0; i<size[0]; i++){ + for(int j=0; j<size[1]; j++){ + for(int k=0; k<size[2]; k++){ + for(int l=0; l<6; l++){ + for(int m=0; m<4; m++){ + if(temperature[i, j, k, l, m] != -100){ + tempcache += temperature[i, j, k, l, m]; + ++times; + } + } + } + } + } + } + averagetemp = tempcache/times; + } }; #endif /* _TEMPARRAY_H_ */ |