Unexpected values of zero were plotted along the center of body in orthographic projections with odd size map dimensions. The problem was caused by a regression the MaRC::quadratic_roots() function when the b coefficient of the quadratic equation being solved was zero. The numerically stable form of the quadratic formula used in MaRC::quadratic_roots() uses the sign (signum) of the b coefficient. However, signum(0) is zero. That caused incorrect calculation of the roots, i.e. (0, ∞). Special handling for the case where b is zero was added.
The fix to MaRC::quadratic_roots() also corrects potential issues in pixel-to-latitude/longitude conversion through MaRC::OblateSpheroid::ellipse_intersection(), and coordinate transformation calculations in MaRC::ViewingGeometry::rot_matrices().
Precision in the orthographic projection was also improved by addressing a potential catastrophic cancellation prone subtraction. For example, (a2 - c2) is now (a - c)(a + c), where the cancellation due to subtraction in the latter form is benign.
Unexpected values of zero were plotted along the center of body in orthographic projections with odd size map dimensions. The problem was caused by a regression the
MaRC::quadratic_roots()
function when the b coefficient of the quadratic equation being solved was zero. The numerically stable form of the quadratic formula used inMaRC::quadratic_roots()
uses the sign (signum) of the b coefficient. However,signum(0)
is zero. That caused incorrect calculation of the roots, i.e. (0, ∞). Special handling for the case where b is zero was added.The fix to
MaRC::quadratic_roots()
also corrects potential issues in pixel-to-latitude/longitude conversion throughMaRC::OblateSpheroid::ellipse_intersection()
, and coordinate transformation calculations inMaRC::ViewingGeometry::rot_matrices()
.Precision in the orthographic projection was also improved by addressing a potential catastrophic cancellation prone subtraction. For example, (a2 - c2) is now (a - c)(a + c), where the cancellation due to subtraction in the latter form is benign.