Skip to content

Commit 0b30769

Browse files
authored
use exact stars magnitude when there is a artificial cutoff (#4438)
1 parent 92028a1 commit 0b30769

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/core/modules/ZoneArray.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,12 @@ void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool isInsid
436436

437437
// Allow artificial cutoff:
438438
// find the (integer) mag at which is just bright enough to be drawn.
439-
int cutoffMagStep=limitMagIndex;
439+
int cutoffMagStep=limitMagIndex; // for steps
440+
float cutoffMag = 999999.; // for precise magnitude cutoff
440441
if (drawer->getFlagStarMagnitudeLimit())
441442
{
442-
cutoffMagStep = static_cast<int>((drawer->getCustomStarMagnitudeLimit()*1000.0 - (mag_min - 7000.))*0.02); // 1/(50 milli-mag)
443+
cutoffMag = drawer->getCustomStarMagnitudeLimit() * 1000.0f; // in milli-mag
444+
cutoffMagStep = static_cast<int>((cutoffMag - (mag_min - 7000.))*0.02); // 1/(50 milli-mag)
443445
if (cutoffMagStep>limitMagIndex)
444446
cutoffMagStep = limitMagIndex;
445447
}
@@ -459,7 +461,7 @@ void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool isInsid
459461

460462
// first part is check for Star1 and is global zone, so to keep looping for long-range prediction
461463
// second part is old behavior, to skip stars below you that are too faint to display for Star2 and Star3
462-
if (magIndex > cutoffMagStep) { // should always use catalog magnitude, otherwise will mess up the order
464+
if ((magIndex > cutoffMagStep) || (starMag > cutoffMag)) { // should always use catalog magnitude, otherwise will mess up the order
463465
if (fabs(dyrs) <= 5000. || !s->isVIP() || !globalzone) // if any of these true, we should always break
464466
break;
465467
}
@@ -488,7 +490,7 @@ void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool isInsid
488490
// recompute magIndex with the new magnitude
489491
magIndex = static_cast<int>((starMag - (mag_min - 7000.)) * 0.02); // 1 / (50 milli-mag)
490492

491-
if (magIndex > cutoffMagStep) { // check again with the new magIndex
493+
if ((magIndex > cutoffMagStep) || (starMag > cutoffMag)) { // check again with the new magIndex
492494
continue; // allow continue for other star that might became bright enough in the future
493495
}
494496
// Array of 2 numbers containing radius and magnitude

0 commit comments

Comments
 (0)