Skip to content

Commit

Permalink
Fix Modify when Dec is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Aug 9, 2024
1 parent 927c4f9 commit 95aa3a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/celengine/stardbbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ checkPolarCoordinates(const StarDatabaseBuilder::StcHeader& header,
// Disable Sonar on the below: suggests using value-or which would eagerly-evaluate the replacement value
double distance = distanceValue.has_value() ? *distanceValue : v.norm(); //NOSONAR
double ra = raValue.has_value() ? *raValue : (math::radToDeg(std::atan2(v.y(), v.x())) / astro::DEG_PER_HRA); //NOSONAR
double dec = decValue.has_value() ? *decValue : math::radToDeg(std::asin(std::clamp(v.z(), -1.0, 1.0))); //NOSONAR
double dec = decValue.has_value() ? *decValue : math::radToDeg(std::asin(std::clamp(v.z() / v.norm(), -1.0, 1.0))); //NOSONAR

position = astro::equatorialToCelestialCart(ra, dec, distance).cast<float>();
return true;
Expand Down

0 comments on commit 95aa3a9

Please sign in to comment.