@@ -392,25 +392,29 @@ void NomenclatureItem::draw(StelCore* core, StelPainter *painter)
392392 const float brightness=(nType>=NomenclatureItem::niSpecialPointPole ? 0 .5f : (solarAltitude<0 . ? 0 .25f : 1 .0f ));
393393 painter->setColor (color*brightness, labelsFader.getInterstate ());
394394 painter->drawCircle (static_cast <float >(srcPos[0 ]), static_cast <float >(srcPos[1 ]), 2 .f );
395- if (flagOutlineCraters && (nType==niCrater || nType==niSatelliteFeature)) // probably all satellite features are satellite craters
395+ // Highlight a few mostly circular classes with ellipses:
396+ // - Craters
397+ // - Satellite features (presumably all of these are satellite craters)
398+ // - Lunar Maria. Mare Frigoris is elongated, and an ellipse would extend over the Lunar rim.
399+ if (flagOutlineCraters && (nType==niCrater || nType==niSatelliteFeature || (nType==niMare && englishName!=" Mare Frigoris" )))
396400 {
397401 // Compute aspectRatio and angle from position of planet and own position, parallactic angle, ...
398- double ra, de, raPl, dePl;
399- StelUtils::rectToSphe (&ra, &de, XYZ);
400- StelUtils::rectToSphe (&raPl, &dePl, equPos);
401- const double distDegrees=StelLocation::distanceDegrees (raPl*M_180_PIf, dePl*M_180_PIf, ra*M_180_PIf, de*M_180_PIf);
402+ const double distDegrees=equPos.angle (XYZ)*M_180_PI;
402403 const double plRadiusDeg=planet->getAngularRadius (core);
403- const double sinDistCenter=distDegrees/plRadiusDeg; // 0...1
404- if (sinDistCenter<1 . f )
404+ const double sinDistCenter= distDegrees/plRadiusDeg; // should be 0...1, but 1 causes a flicker
405+ if (sinDistCenter<0.9999 )
405406 {
406- const double angleDistCenterRad=asin (sinDistCenter); // 0..pi/2 on the lunar/planet sphere
407+ const double angleDistCenterRad=asin (qMin ( 0.9999 , sinDistCenter) ); // 0..pi/2 on the lunar/planet sphere
407408 const double aspectRatio=cos (angleDistCenterRad);
409+ double ra, de, raPl, dePl;
410+ StelUtils::rectToSphe (&ra, &de, XYZ);
411+ StelUtils::rectToSphe (&raPl, &dePl, equPos);
408412 const double angle=atan2 (ra-raPl, de-dePl);
409413 const double par = static_cast <double >(getParallacticAngle (core));
410- painter->drawEllipse (static_cast < float >( srcPos[0 ]), static_cast < float >( srcPos[1 ]) , screenRadius, screenRadius*aspectRatio, angle-par );
414+ painter->drawEllipse (srcPos[0 ], srcPos[1 ], screenRadius, screenRadius*qMax ( 0.0001 , aspectRatio) , angle-par );
411415 }
412416 // else
413- // qWarning() << "Distance greater 1 encountered for crater " << englishName << "at " << longitude << "/" << latitude;
417+ // qWarning() << "Sine of Distance" << sinDistCenter << ">0.99975 encountered for crater " << englishName << "at " << longitude << "/" << latitude;
414418 }
415419 painter->drawText (static_cast <float >(srcPos[0 ]), static_cast <float >(srcPos[1 ]), nameI18n, 0 , 5 .f , 5 .f , false );
416420 }
0 commit comments