[strategies] [tests] Test degenerate pt/box and box/box cases; fix a bug in pt-sgmt distance strategy

This commit is contained in:
Vissarion Fysikopoulos
2017-12-01 14:58:16 +02:00
parent 0a3204a494
commit e4a587c0f4
9 changed files with 301 additions and 65 deletions

View File

@@ -65,7 +65,8 @@ public :
(math::equals(lat2, half_pi) && math::equals(lat1, -half_pi)) )
{
// single meridian not crossing pole
res.distance = apply(lat2, spheroid) - apply(lat1, spheroid);
res.distance = apply(lat2, spheroid)
- apply(lat1, spheroid);
res.meridian = true;
}

View File

@@ -76,7 +76,7 @@ public :
template <typename CT>
static inline CT apply(CT lon1, CT lat1, CT lon2, CT lat2,
Spheroid const& spheroid) const
Spheroid const& spheroid)
{
typedef typename formula::elliptic_arc_length
<
@@ -120,8 +120,8 @@ public :
CT, strategy::default_order<FormulaPolicy>::value
> elliptic_arc_length;
return elliptic_arc_length::apply(lat2, m_spheroid)
- elliptic_arc_length::apply(lat1, m_spheroid);
return math::abs(elliptic_arc_length::apply(lat2, m_spheroid)
- elliptic_arc_length::apply(lat1, m_spheroid));
}
inline Spheroid const& model() const

View File

@@ -242,6 +242,12 @@ private :
{
#ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK
std::cout << "Equatorial segment" << std::endl;
std::cout << "segment=(" << lon1 * math::r2d<CT>();
std::cout << "," << lat1 * math::r2d<CT>();
std::cout << "),(" << lon2 * math::r2d<CT>();
std::cout << "," << lat2 * math::r2d<CT>();
std::cout << ")\np=(" << lon3 * math::r2d<CT>();
std::cout << "," << lat3 * math::r2d<CT>() << ")\n";
#endif
if (lon3 <= lon1)
{
@@ -254,6 +260,11 @@ private :
return non_iterative_case(lon3, lat1, lon3, lat3, spheroid);
}
if ((lon1 == lon2 || math::equals(math::abs(diff), pi) )&& lat1 > lat2)
{
std::swap(lat1,lat2);
}
if (math::equals(math::abs(diff), pi))
{
#ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK

View File

@@ -198,7 +198,7 @@ template <typename Units, bool IsEquatorial>
struct latitude_convert_if_polar
{
template <typename T>
static inline void apply(T & lat) {}
static inline void apply(T &) {}
};
template <typename Units>