mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-30 07:52:09 +00:00
[formulas] Add asserts for validity of azimuth passed to thomas_direct and differential_quantities.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#ifndef BOOST_GEOMETRY_FORMULAS_INVERSE_DIFFERENTIAL_QUANTITIES_HPP
|
||||
#define BOOST_GEOMETRY_FORMULAS_INVERSE_DIFFERENTIAL_QUANTITIES_HPP
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
|
||||
#include <boost/geometry/util/condition.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
@@ -73,6 +74,9 @@ public:
|
||||
CT const sig_12 = dlon / one_minus_f;
|
||||
if (BOOST_GEOMETRY_CONDITION(EnableReducedLength))
|
||||
{
|
||||
CT const pi = math::pi<CT>();
|
||||
BOOST_GEOMETRY_ASSERT(-pi <= azimuth && azimuth <= pi);
|
||||
|
||||
int azi_sign = math::sign(azimuth) >= 0 ? 1 : -1; // for antipodal
|
||||
CT m12 = azi_sign * sin(sig_12) * b;
|
||||
reduced_length = m12;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
#include <boost/geometry/core/radius.hpp>
|
||||
|
||||
#include <boost/geometry/util/condition.hpp>
|
||||
@@ -80,6 +81,8 @@ public:
|
||||
CT const pi = math::pi<CT>();
|
||||
CT const pi_half = pi / c2;
|
||||
|
||||
BOOST_GEOMETRY_ASSERT(-pi <= azimuth12 && azimuth12 <= pi);
|
||||
|
||||
// keep azimuth small - experiments show low accuracy
|
||||
// if the azimuth is closer to (+-)180 deg.
|
||||
CT azi12_alt = azimuth12;
|
||||
|
||||
Reference in New Issue
Block a user