summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-10 01:32:15 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-10 01:32:15 +0100
commit897a54945c4a9112ee5c97e2eb8937adc57f17fe (patch)
tree0254901d0df5a3ba3708a256c6e9d393847a2743
parentbc8c15f676a7733f665375a68219b23e6d2ef0f5 (diff)
downloadc3d-897a54945c4a9112ee5c97e2eb8937adc57f17fe.tar
c3d-897a54945c4a9112ee5c97e2eb8937adc57f17fe.zip
verbesserungen
-rw-r--r--DisplayClass.cpp25
-rw-r--r--Temparray.cpp69
2 files changed, 54 insertions, 40 deletions
diff --git a/DisplayClass.cpp b/DisplayClass.cpp
index 2a85cd2..b34156b 100644
--- a/DisplayClass.cpp
+++ b/DisplayClass.cpp
@@ -17,25 +17,32 @@ DisplayClass::~DisplayClass() {
}
void DisplayClass::renderScene(unsigned long delta, std::bitset<256>& keys) {
- /*angle += delta*0.025;
+ angle += delta*0.005;
if(angle >= 360)
- angle -= 360;*/
+ angle -= 360;
+
+ static bool on = true;
+ static float angle2 =5;
+ if (angle2 <= 10 && on){angle2 += 0.5;}
+ else if (angle2 >=0 && !on){angle2 -= 0.5;}
+ else if (angle2 >=10)on=false;
+ else if (angle2 <=0)on=true;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- keyhandler(keys);
+// keyhandler(keys);
glLoadIdentity(); // Clean up matrix
- glTranslatef(0.0, -2.0, -20.0); // Then set up transformation
-// glRotatef(10, 1.0, 0.0, 0.0);
-// glRotatef(angle, 0.0, 1.0, 0.0);
+ glTranslatef(0.0, -2.0, -12.0); // Then set up transformation
+ glRotatef(angle2, 1.0, 0.0, 0.0);
+ glRotatef(angle, 0.0, 1.0, 0.0);
// glRotatef(angle*2, 1.0, 0.0, 0.0);
-// glRotatef(angle*3, 0.0, 0.0, 1.0);
-// glRotatef(-angle*5, 1.0, 1.0, 1.0);
+// glRotatef(angle*3, 1.0, 0.5, 0.0);
+// glRotatef(-angle*5, 1.0, 1.0, 0.0);
// static Temparray temp(20, x, y, z);
- static House house(20, x, y, z, 100, 300, 53.55, 0.82, 2.82, 0.0047, 40, 45, 1900, 3, 11500);
+ static House house(20, x, y, z, 100, 400, 53.55, 0.82, 2.82, 0.0047, 40, 45, 1900, 3, 11500);
triangles=house.getTriangles();
house.controller();
//// temp.calcTemp();
diff --git a/Temparray.cpp b/Temparray.cpp
index 9c67afd..17889ae 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -41,7 +41,7 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
void Temparray::calcTemp(){
float conductivity = 0.7, specificcapacity = 1513;
- float areasmall, area, areabig, distance, capacity, capacity2, volume, thermalresistance, tau12, tau21;
+ float areasmall, area, areabig, distance, capacity, capacity2, volume, thermalresistance, thermalresistance2, tau12, tau21;
float meterperunit = 3.0;
float width, height, depth, innerwidth, innerdepth;
float width2, height2, depth2, innerwidth2, innerdepth2;
@@ -69,7 +69,11 @@ void Temparray::calcTemp(){
thermalresistance = ((depth2 / 2 - (depth2 - innerdepth2)/4) -
(depth / 2 - (depth - innerdepth)/4)) / 0.9 * meterperunit /
- (conductivity * ((area + areabig) / 2));
+ (conductivity * areabig);
+ thermalresistance2 = ((depth2 / 2 - (depth2 - innerdepth2)/4) -
+ (depth / 2 - (depth - innerdepth)/4)) / 0.9 * meterperunit /
+ (conductivity * area);
+
capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
height)/0.9*meterperunit);
@@ -82,7 +86,10 @@ void Temparray::calcTemp(){
thermalresistance = ((width2 / 2 - (width2 - innerwidth2)/4) -
(width / 2 - (width - innerwidth)/4)) / 0.9 * meterperunit /
- (conductivity * ((area + areabig) / 2));
+ (conductivity * areabig);
+ thermalresistance2 = ((width2 / 2 - (width2 - innerwidth2)/4) -
+ (width / 2 - (width - innerwidth)/4)) / 0.9 * meterperunit /
+ (conductivity * area);
capacity = specificcapacity *((((depth + innerdepth)/2)*((width - innerwidth)/2)*
height)/0.9*meterperunit);
@@ -90,7 +97,7 @@ void Temparray::calcTemp(){
height2)/0.9*meterperunit);
}
tau12 = capacity * thermalresistance;
- tau21 = capacity2 * thermalresistance;
+ tau21 = capacity2 * thermalresistance2;
temperaturenew(i, j, k, l, m) =
temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
@@ -107,13 +114,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, 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();
+ 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();
if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
/ 0.9 * meterperunit;
@@ -132,8 +139,8 @@ void Temparray::calcTemp(){
((depth + innerdepth)/2)*height)
/ 0.9 * meterperunit);
- loadableenergy = (probetemp - temperatureold(i, j, k, 5, m))/thermalresistance/10;
- unloadableenergy = (temperatureold(i, j, k, 5, m)-21.5)/thermalresistance/10;
+ loadableenergy = (probetemp - temperatureold(i, j, k, l, m))/thermalresistance/10;
+ unloadableenergy = (temperatureold(i, j, k, l, m)-21.5)/thermalresistance/10;
tau12 = capacity * thermalresistance;
@@ -150,8 +157,8 @@ void Temparray::calcTemp(){
}
if(inputpower > 0) {
factor = inputpower/loadableenergy;
- temperaturenew(i, j, k, 5, m) =
- temperaturenew(i, j, k, 5, m) + (probetemp-temperatureold(i, j, k, 5, m))
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) + (probetemp-temperatureold(i, j, k, l, m))
*thermalresistance*factor*(1-exp(-(1/tau12)));
}
}
@@ -168,13 +175,13 @@ void Temparray::calcTemp(){
}
if(inputpower > 0) {
factor = inputpower/unloadableenergy;
- temperaturenew(i, j, k, 5, m) =
- temperaturenew(i, j, k, 5, m) + (21.5-temperatureold(i, j, k, 5, m))
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) + (21.5-temperatureold(i, j, k, l, m))
*thermalresistance*factor*(1-exp(-(1/tau12)));
}
}
}
- //}
+ }
}
}
}
@@ -233,7 +240,7 @@ void Temparray::calcTemp(){
temperatureold(i, j-1, k, l, m))*(1-exp(-(1/tau21))));
}
- if(m == 0) {
+ /*if(m == 0) {
area = (sqrt(pow((depth-innerdepth)/2, 2) + pow((width-innerwidth)/2, 2))* height) /
0.9 * meterperunit;
@@ -324,7 +331,7 @@ void Temparray::calcTemp(){
temperaturenew(i, j, k, l, 0) =
temperaturenew(i, j, k, l, 0) + ((temperatureold(i, j, k, l, 3) -
temperatureold(i, j, k, l, 0))*(1-exp(-(1/tau21))));
- }
+ }*/
if(j == sy-1) {
if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
/ 0.9 * meterperunit;
@@ -364,12 +371,12 @@ void Temparray::calcTemp(){
height)/0.9*meterperunit);
tau12 = capacity * thermalresistance;
- temperaturenew(i, j, k, 0, 3) =
- temperaturenew(i, j, k, 0, 3) - ((temperatureold(i, j, k, 0, 3) -
- temperatureold(i-1, j, k, 0, 1))*(1-exp(-(1/tau12))));
- temperaturenew(i-1, j, k, 0, 1) =
- temperaturenew(i-1, j, k, 0, 1) + ((temperatureold(i, j, k, 0, 3) -
- temperatureold(i-1, j, k, 0, 1))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, 0, 1) =
+ temperaturenew(i, j, k, 0, 1) - ((temperatureold(i, j, k, 0, 1) -
+ temperatureold(i-1, j, k, 0, 3))*(1-exp(-(1/tau12))));
+ temperaturenew(i-1, j, k, 0, 3) =
+ temperaturenew(i-1, j, k, 0, 3) + ((temperatureold(i, j, k, 0, 1) -
+ temperatureold(i-1, j, k, 0, 3))*(1-exp(-(1/tau12))));
}
if (i == 0 || i == sx-1) {
int h=3;
@@ -410,12 +417,12 @@ void Temparray::calcTemp(){
height)/0.9*meterperunit);
tau12 = capacity * thermalresistance;
- temperaturenew(i, j, k, 0, 0) =
- temperaturenew(i, j, k, 0, 0) - ((temperatureold(i, j, k, 0, 0) -
- temperatureold(i-1, j, k-1, 0, 2))*(1-exp(-(1/tau12))));
- temperaturenew(i, j, k-1, 0, 2) =
- temperaturenew(i, j, k-1, 0, 2) + ((temperatureold(i, j, k, 0, 0) -
- temperatureold(i, j, k-1, 0, 2))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, 0, 2) =
+ temperaturenew(i, j, k, 0, 2) - ((temperatureold(i, j, k, 0, 2) -
+ temperatureold(i-1, j, k-1, 0, 0))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k-1, 0, 0) =
+ temperaturenew(i, j, k-1, 0, 0) + ((temperatureold(i, j, k, 0, 2) -
+ temperatureold(i, j, k-1, 0, 0))*(1-exp(-(1/tau12))));
}
if(k == 0 || k == sz-1) {
int h=0;