summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DisplayClass.cpp71
-rw-r--r--Temparray.cpp26
2 files changed, 48 insertions, 49 deletions
diff --git a/DisplayClass.cpp b/DisplayClass.cpp
index 4051e20..872b730 100644
--- a/DisplayClass.cpp
+++ b/DisplayClass.cpp
@@ -61,44 +61,43 @@ void DisplayClass::renderScene(unsigned long delta, std::bitset<256>& keys) {
void DisplayClass::keyhandler(std::bitset<256>& keys){
static float abstand = 0;
if(keys.any()) {
- glLoadIdentity();
-
- static float rotm[16] = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1};
- char h = '2';
- if(keys.test(h))
- glRotatef(3, 1, 0, 0);
-
- h = '4';
- if(keys.test(h))
- glRotatef(-3, 0, 1, 0);
-
- h = '6';
- if(keys.test(h))
- glRotatef(3, 0, 1, 0);
-
- h = '8';
- if(keys.test(h))
- glRotatef(-3, 1, 0, 0);
-
- h = '+';
- if(keys.test(h))
- abstand -= 0.2;
+ glLoadIdentity();
+
+ static float rotm[16] = {
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1};
+ char h = '2';
+ if(keys.test(50))
+ glRotatef(3, 1, 0, 0);
+
+ h = '4';
+ if(keys.test(52))
+ glRotatef(-3, 0, 1, 0);
+
+ h = '6';
+ if(keys.test(54))
+ glRotatef(3, 0, 1, 0);
+
+ h = '8';
+ if(keys.test(56))
+ glRotatef(-3, 1, 0, 0);
+
+ h = '+';
+ if(keys.test(43))
+ abstand -= 0.2;
+
+ h = '-';
+ if(keys.test(45))
+ abstand += 0.2;
- h = '-';
- if(keys.test(h))
- abstand += 0.2;
+ glMultMatrixf(rotm);
+ glGetFloatv(GL_MODELVIEW_MATRIX, rotm);
- glMultMatrixf(rotm);
- glGetFloatv(GL_MODELVIEW_MATRIX, rotm);
-
- glLoadIdentity();
- glTranslatef(0, 0, abstand);
- glMultMatrixf(rotm);
-
+ glLoadIdentity();
+ glTranslatef(0, 0, abstand);
+ glMultMatrixf(rotm);
// glutPostRedisplay();
}
}
diff --git a/Temparray.cpp b/Temparray.cpp
index 7615d21..9c67afd 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -107,13 +107,13 @@ void Temparray::calcTemp(){
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) {
+ //for(int l = 0; l < 6; ++l) {
for(int m = 0; m < 4; m++) {
- width = cubehole(i, j, k, l).getWidth();
- height = cubehole(i, j, k, l).getHeight();
- depth = cubehole(i, j, k, l).getDepth();
- innerwidth = cubehole(i, j, k, l).getInnerWidth();
- innerdepth = cubehole(i, j, k, l).getInnerDepth();
+ width = cubehole(i, j, k, 5).getWidth();
+ height = cubehole(i, j, k, 5).getHeight();
+ depth = cubehole(i, j, k, 5).getDepth();
+ innerwidth = cubehole(i, j, k, 5).getInnerWidth();
+ innerdepth = cubehole(i, j, k, 5).getInnerDepth();
if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
/ 0.9 * meterperunit;
@@ -132,8 +132,8 @@ void Temparray::calcTemp(){
((depth + innerdepth)/2)*height)
/ 0.9 * meterperunit);
- loadableenergy = (probetemp - temperatureold(i, j, k, l, m))/thermalresistance/10;
- unloadableenergy = (temperatureold(i, j, k, l, m)-21.5)/thermalresistance/10;
+ loadableenergy = (probetemp - temperatureold(i, j, k, 5, m))/thermalresistance/10;
+ unloadableenergy = (temperatureold(i, j, k, 5, m)-21.5)/thermalresistance/10;
tau12 = capacity * thermalresistance;
@@ -150,8 +150,8 @@ void Temparray::calcTemp(){
}
if(inputpower > 0) {
factor = inputpower/loadableenergy;
- temperaturenew(i, j, k, l, m) =
- temperaturenew(i, j, k, l, m) + (probetemp-temperatureold(i, j, k, l, m))
+ temperaturenew(i, j, k, 5, m) =
+ temperaturenew(i, j, k, 5, m) + (probetemp-temperatureold(i, j, k, 5, m))
*thermalresistance*factor*(1-exp(-(1/tau12)));
}
}
@@ -168,13 +168,13 @@ void Temparray::calcTemp(){
}
if(inputpower > 0) {
factor = inputpower/unloadableenergy;
- temperaturenew(i, j, k, l, m) =
- temperaturenew(i, j, k, l, m) + (21.5-temperatureold(i, j, k, l, m))
+ temperaturenew(i, j, k, 5, m) =
+ temperaturenew(i, j, k, 5, m) + (21.5-temperatureold(i, j, k, 5, m))
*thermalresistance*factor*(1-exp(-(1/tau12)));
}
}
}
- }
+ //}
}
}
}