From d493571a6cd6a3adfce5a572ab451dd7c95197ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20Ri=C3=9F?= Date: Wed, 13 Jan 2010 21:07:04 +0100 Subject: =?UTF-8?q?Das=20Programm=20l=C3=A4uft=20jetzt=20und=20die=20Cubeh?= =?UTF-8?q?oles=20wurden=20verbessert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Temparray.h | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'Temparray.h') diff --git a/Temparray.h b/Temparray.h index e15ea22..1274cfb 100644 --- a/Temparray.h +++ b/Temparray.h @@ -10,12 +10,11 @@ class Temparray public: Temparray(float initialtemp, int x0, int y0, int z0); ~Temparray(){ - delete[] temperature; - delete[] cubearray; - } + } void setTemp(float temp, int x, int y, int z, int line, int pos){ - temperature[x*size[1]*size[2]*6*4 + y*size[2]*6*4 + z*6*4 + line*4 + pos] = temp; + temperature(x, y, z, line, pos) = temp; + calcAverage(); } void deactivateCube(int x, int y, int z){ @@ -26,16 +25,23 @@ class Temparray } } std::list getTriangles(); - void calcTemp(); private: - float *temperature; + float *temparray; Cubehole *cubearray; - int size[3]; + int sx, sy, sz; float averagetemp; - void setColor(int x, int y, int z, int line){ + float& temperature(int x, int y, int z, int line, int pos) { + return temparray[x*sy*sz*6*4 + y*sz*6*4 + z*6*4 + line*4 + pos]; } + + Cubehole& cubehole(int x, int y, int z, int line) { + return cubearray[x*sy*sz*6 + y*sz*6 + z*6 + line]; + } + +// void setColor(int x, int y, int z, int line){ +// } void tempInit(float temp0, int x0, int y0, int z0){ for(int i=0; i