~guillaume-chereau/stellarium/no-partial-draw

« back to all changes in this revision

Viewing changes to src/core/modules/Comet.cpp

  • Committer: Bogdan Marinov
  • Date: 2014-03-15 13:27:37 UTC
  • Revision ID: bogdan.marinov84@gmail.com-20140315132737-oxj7h2lv59dke1bp
fixed MSVC compiler issue - ambiguous use of POW;
+ a minor code reuse (don't do a calculation twice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
471
471
}
472
472
 
473
473
// Formula found at http://www.projectpluto.com/update7b.htm#comet_tail_formula
474
 
Vec2f Comet::getComaDiameterAndTailLengthAU() const {
475
 
        float r=getHeliocentricEclipticPos().length();
476
 
        float mhelio=absoluteMagnitude+slopeParameter*log10(r);
477
 
        float Do=pow(10.0f, ((-0.0033f*mhelio - 0.07f)*mhelio + 3.25f));
478
 
        float D =Do*(1.0f-pow(10.0, -2.0f*r))*(1.0f-pow(10.0, -r))* (1000.0f*AU_KM);
479
 
        float Lo=pow(10.0f, ((-0.0075f*mhelio - 0.19f)*mhelio + 2.1f));
480
 
        float L = Lo*(1.0f-pow(10.0, -4.0f*r))*(1.0f-pow(10.0, -2.0f*r))* (1e6*AU_KM);
 
474
Vec2f Comet::getComaDiameterAndTailLengthAU() const
 
475
{
 
476
        float r = getHeliocentricEclipticPos().length();
 
477
        float mhelio = absoluteMagnitude + slopeParameter * log10(r);
 
478
        float Do = pow(10.0f, ((-0.0033f*mhelio - 0.07f) * mhelio + 3.25f));
 
479
        float common = 1.0f - pow(10.0f, (-2.0f*r));
 
480
        float D = Do * common * (1.0f - pow(10.0f, -r)) * (1000.0f*AU_KM);
 
481
        float Lo = pow(10.0f, ((-0.0075f*mhelio - 0.19f) * mhelio + 2.1f));
 
482
        float L = Lo*(1.0f-pow(10.0f, -4.0f*r)) * common * (1e6*AU_KM);
481
483
        return Vec2f(D, L);
482
484
}
483
485