mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 07:59:18 +02:00
reformat: use auto on certain types
This commit is contained in:
@@ -107,14 +107,14 @@ void cMoon::move() {
|
||||
if( m_observer.minute >= 0 ) { localtime.wMinute = m_observer.minute; }
|
||||
if( m_observer.second >= 0 ) { localtime.wSecond = m_observer.second; }
|
||||
|
||||
double localut =
|
||||
const double localut =
|
||||
localtime.wHour
|
||||
+ localtime.wMinute / 60.0 // too low resolution, noticeable skips
|
||||
+ localtime.wSecond / 3600.0; // good enough in normal circumstances
|
||||
/*
|
||||
+ localtime.wMilliseconds / 3600000.0; // for really smooth movement
|
||||
*/
|
||||
double daynumber
|
||||
+ localtime.wMilliseconds / 3600000.0; // for really smooth movement
|
||||
*/
|
||||
const double daynumber
|
||||
= 367 * localtime.wYear
|
||||
- 7 * ( localtime.wYear + ( localtime.wMonth + 9 ) / 12 ) / 4
|
||||
+ 275 * localtime.wMonth / 9
|
||||
@@ -128,7 +128,7 @@ void cMoon::move() {
|
||||
// obliquity of the ecliptic
|
||||
m_body.oblecl = clamp_circular( 23.4393 - 3.563e-7 * daynumber );
|
||||
// moon parameters
|
||||
double longascnode = clamp_circular( 125.1228 - 0.0529538083 * daynumber ); // N, degrees
|
||||
const double longascnode = clamp_circular( 125.1228 - 0.0529538083 * daynumber ); // N, degrees
|
||||
double const inclination = 5.1454; // i, degrees
|
||||
double const mndistance = 60.2666; // a, in earth radii
|
||||
// argument of perigee
|
||||
@@ -189,8 +189,8 @@ void cMoon::move() {
|
||||
m_body.declin = radtodeg * std::asin( std::sin (m_body.oblecl * degtorad) * std::sin(m_body.eclong * degtorad) );
|
||||
|
||||
// right ascension
|
||||
double top = std::cos( degtorad * m_body.oblecl ) * std::sin( degtorad * m_body.eclong );
|
||||
double bottom = std::cos( degtorad * m_body.eclong );
|
||||
const double top = std::cos( degtorad * m_body.oblecl ) * std::sin( degtorad * m_body.eclong );
|
||||
const double bottom = std::cos( degtorad * m_body.eclong );
|
||||
m_body.rascen = clamp_circular( radtodeg * std::atan2( top, bottom ) );
|
||||
|
||||
// Greenwich mean sidereal time
|
||||
@@ -213,11 +213,11 @@ void cMoon::move() {
|
||||
|
||||
double cz; // cosine of the solar zenith angle
|
||||
|
||||
double tdatcd = std::cos( degtorad * m_body.declin );
|
||||
double tdatch = std::cos( degtorad * m_body.hrang );
|
||||
double tdatcl = std::cos( degtorad * m_observer.latitude );
|
||||
double tdatsd = std::sin( degtorad * m_body.declin );
|
||||
double tdatsl = std::sin( degtorad * m_observer.latitude );
|
||||
const double tdatcd = std::cos( degtorad * m_body.declin );
|
||||
const double tdatch = std::cos( degtorad * m_body.hrang );
|
||||
const double tdatcl = std::cos( degtorad * m_observer.latitude );
|
||||
const double tdatsd = std::sin( degtorad * m_body.declin );
|
||||
const double tdatsl = std::sin( degtorad * m_observer.latitude );
|
||||
|
||||
cz = tdatsd * tdatsl + tdatcd * tdatcl * tdatch;
|
||||
|
||||
@@ -271,15 +271,15 @@ void cMoon::irradiance() {
|
||||
static double degtorad = 0.0174532925; // converts from degrees to radians
|
||||
|
||||
m_body.dayang = ( simulation::Time.year_day() - 1 ) * 360.0 / 365.0;
|
||||
double sd = sin( degtorad * m_body.dayang ); // sine of the day angle
|
||||
double cd = cos( degtorad * m_body.dayang ); // cosine of the day angle or delination
|
||||
const double sd = sin( degtorad * m_body.dayang ); // sine of the day angle
|
||||
const double cd = cos( degtorad * m_body.dayang ); // cosine of the day angle or delination
|
||||
m_body.erv = 1.000110 + 0.034221*cd + 0.001280*sd;
|
||||
double d2 = 2.0 * m_body.dayang;
|
||||
double c2 = cos( degtorad * d2 );
|
||||
double s2 = sin( degtorad * d2 );
|
||||
const double d2 = 2.0 * m_body.dayang;
|
||||
const double c2 = cos( degtorad * d2 );
|
||||
const double s2 = sin( degtorad * d2 );
|
||||
m_body.erv += 0.000719*c2 + 0.000077*s2;
|
||||
|
||||
double solcon = 1367.0; // Solar constant, 1367 W/sq m
|
||||
const double solcon = 1367.0; // Solar constant, 1367 W/sq m
|
||||
|
||||
m_body.coszen = cos( degtorad * m_body.zenref );
|
||||
if( m_body.coszen > 0.0 ) {
|
||||
@@ -294,12 +294,12 @@ void cMoon::irradiance() {
|
||||
|
||||
void
|
||||
cMoon::phase() {
|
||||
SYSTEMTIME lt = simulation::Time.data();
|
||||
const SYSTEMTIME lt = simulation::Time.data();
|
||||
if (lt.wMonth == 5 && lt.wDay == 4) //May the forth be with you!
|
||||
m_phase = 50;
|
||||
else {
|
||||
// calculate moon's age in days from new moon
|
||||
float ip = normalize( ( simulation::Time.julian_day() - 2451550.1f ) / 29.530588853f );
|
||||
const float ip = normalize( ( simulation::Time.julian_day() - 2451550.1f ) / 29.530588853f );
|
||||
m_phase = ip * 29.53f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user