summaryrefslogtreecommitdiffstats
path: root/Sun.h
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-07 16:52:50 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-07 16:52:50 +0100
commitf53113f02ea5369e50bd33232db3d2b48f64cc1c (patch)
tree5aa4a0a5fb301a9bedd50cc1445c844fb3175210 /Sun.h
parentabcf04bac0fe9b7b8358af6ed4e2f11d9bbb0fc8 (diff)
downloadc3d-f53113f02ea5369e50bd33232db3d2b48f64cc1c.tar
c3d-f53113f02ea5369e50bd33232db3d2b48f64cc1c.zip
Cuboid nicht benätigt und NOTNEEDED ordner hinzugefügt und Fehler behoben
Diffstat (limited to 'Sun.h')
-rw-r--r--Sun.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/Sun.h b/Sun.h
index a242e5f..6fc7857 100644
--- a/Sun.h
+++ b/Sun.h
@@ -12,26 +12,24 @@ class Sun
void setlatitude(float latitude0){latitude=latitude0;};
float declination(int day) {return 23.4*sin(2*M_PI*(284+day+1)/365);}
- float hourangle(int time) {return 15*(time+1/*-12*/);}
+ float hourangle(int time) {return 15*(time+1-12);}
float elevationangle(int day, int time) {
return asin(sin(declination(day)*M_PI/180)*
- sin(latitude*M_PI/180)*
+ sin(latitude*M_PI/180)+
cos(hourangle(time)*M_PI/180)*
cos(declination(day)*M_PI/180)*
- cos(latitude*M_PI/180))
- *180/M_PI;
+ cos(latitude*M_PI/180))*180/M_PI;
}
float azimutangle(int day, int time){
- float tau, sin_tau, cos_tau, sin_phi, cos_phi, tan_dec;
+ float tau = hourangle(time)*M_PI/180;
+ float sin_tau = sin(tau);
+ float cos_tau = cos(tau);
+ float sin_phi = sin(latitude*M_PI/180);
+ float cos_phi = cos(latitude*M_PI/180);
+ float tan_dek = tan(declination(day)*M_PI/180);
- tan_dec = tan(declination(day)*M_PI/180);
- tau = hourangle(time)*M_PI/180;
- sin_tau = sin(tau);
- cos_tau = cos(tau);
- sin_phi = sin(latitude*M_PI/180);
- cos_phi = cos(latitude*M_PI/180);
-
- return atan2(sin_tau, cos_tau*sin_phi-tan_dec*cos_phi)/180*M_PI;
+ return atan2(sin_tau, cos_tau*sin_phi-tan_dek*cos_phi)*180/M_PI;
+// return asin(cos(declination(day))*sin(elevationangle(day, time))/cos(hourangle(time)));
}
private:
float latitude;