mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-31 08:12:13 +00:00
Merge branch 'develop' into bg-prepare
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
[*Solved issues]
|
||||
|
||||
* [@https://svn.boost.org/trac10/ticket/13386 13386] Workaround for some gcc compilers
|
||||
* [@https://svn.boost.org/trac10/ticket/13381 13381] Compile error with matrix_transformer in Visual C++ 2015
|
||||
* [@https://svn.boost.org/trac10/ticket/13436 13436] Incorrectness in boost::geometry::model::polygon documentation
|
||||
|
||||
|
||||
@@ -610,7 +610,11 @@ struct buffered_piece_collection
|
||||
if (multi0 == multi1)
|
||||
{
|
||||
const deflate_properties& prop = properties[multi0];
|
||||
if (! prop.has_inflated && prop.count < 3)
|
||||
|
||||
// NOTE: Keep brackets around prop.count
|
||||
// avoid gcc-bug "parse error in template argument list"
|
||||
// GCC versions 5.4 and 5.5 (and probably more)
|
||||
if (! prop.has_inflated && (prop.count) < 3)
|
||||
{
|
||||
// Property is not inflated
|
||||
// Not enough points, this might be caused by <float> where
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2015-2017 Oracle and/or its affiliates.
|
||||
// Copyright (c) 2015-2018 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
@@ -177,7 +178,7 @@ public:
|
||||
|
||||
CT const pi = math::pi<CT>();
|
||||
|
||||
if (BOOST_GEOMETRY_CONDITION(EnableAzimuth))
|
||||
if (BOOST_GEOMETRY_CONDITION(CalcFwdAzimuth))
|
||||
{
|
||||
CT alpha1 = v + u;
|
||||
if (alpha1 > pi)
|
||||
@@ -188,7 +189,7 @@ public:
|
||||
result.azimuth = alpha1;
|
||||
}
|
||||
|
||||
if (BOOST_GEOMETRY_CONDITION(EnableReverseAzimuth))
|
||||
if (BOOST_GEOMETRY_CONDITION(CalcRevAzimuth))
|
||||
{
|
||||
CT alpha2 = pi - (v - u);
|
||||
if (alpha2 > pi)
|
||||
|
||||
@@ -200,8 +200,8 @@ private :
|
||||
CT lon3, CT lat3, //query point p3
|
||||
Spheroid const& spheroid)
|
||||
{
|
||||
typedef typename FormulaPolicy::template inverse<CT, true, false, false, true, true>
|
||||
inverse_distance_quantities_type;
|
||||
typedef typename FormulaPolicy::template inverse<CT, true, true, false, true, true>
|
||||
inverse_distance_azimuth_quantities_type;
|
||||
typedef typename FormulaPolicy::template inverse<CT, false, true, false, false, false>
|
||||
inverse_azimuth_type;
|
||||
typedef typename FormulaPolicy::template inverse<CT, false, true, true, false, false>
|
||||
@@ -419,8 +419,8 @@ private :
|
||||
|
||||
CT a4 = inverse_azimuth_type::apply(res14.lon2, res14.lat2,
|
||||
lon2, lat2, spheroid).azimuth;
|
||||
res34 = inverse_distance_quantities_type::apply(res14.lon2, res14.lat2,
|
||||
lon3, lat3, spheroid);
|
||||
res34 = inverse_distance_azimuth_quantities_type::apply(res14.lon2, res14.lat2,
|
||||
lon3, lat3, spheroid);
|
||||
g4 = res34.azimuth - a4;
|
||||
|
||||
|
||||
@@ -483,20 +483,20 @@ private :
|
||||
|
||||
std::cout << "s34(sph) =" << s34_sph << std::endl;
|
||||
std::cout << "s34(geo) ="
|
||||
<< inverse_distance_quantities_type::apply(get<0>(p4), get<1>(p4), lon3, lat3, spheroid).distance
|
||||
<< inverse_distance_azimuth_quantities_type::apply(get<0>(p4), get<1>(p4), lon3, lat3, spheroid).distance
|
||||
<< ", p4=(" << get<0>(p4) * math::r2d<double>() << ","
|
||||
<< get<1>(p4) * math::r2d<double>() << ")"
|
||||
<< std::endl;
|
||||
|
||||
CT s31 = inverse_distance_quantities_type::apply(lon3, lat3, lon1, lat1, spheroid).distance;
|
||||
CT s32 = inverse_distance_quantities_type::apply(lon3, lat3, lon2, lat2, spheroid).distance;
|
||||
CT s31 = inverse_distance_azimuth_quantities_type::apply(lon3, lat3, lon1, lat1, spheroid).distance;
|
||||
CT s32 = inverse_distance_azimuth_quantities_type::apply(lon3, lat3, lon2, lat2, spheroid).distance;
|
||||
|
||||
CT a4 = inverse_azimuth_type::apply(get<0>(p4), get<1>(p4), lon2, lat2, spheroid).azimuth;
|
||||
geometry::formula::result_direct<CT> res4 = direct_distance_type::apply(get<0>(p4), get<1>(p4), .04, a4, spheroid);
|
||||
CT p4_plus = inverse_distance_quantities_type::apply(res4.lon2, res4.lat2, lon3, lat3, spheroid).distance;
|
||||
CT p4_plus = inverse_distance_azimuth_quantities_type::apply(res4.lon2, res4.lat2, lon3, lat3, spheroid).distance;
|
||||
|
||||
geometry::formula::result_direct<CT> res1 = direct_distance_type::apply(lon1, lat1, s14-.04, a12, spheroid);
|
||||
CT p4_minus = inverse_distance_quantities_type::apply(res1.lon2, res1.lat2, lon3, lat3, spheroid).distance;
|
||||
CT p4_minus = inverse_distance_azimuth_quantities_type::apply(res1.lon2, res1.lat2, lon3, lat3, spheroid).distance;
|
||||
|
||||
std::cout << "s31=" << s31 << "\ns32=" << s32
|
||||
<< "\np4_plus=" << p4_plus << ", p4=(" << res4.lon2 * math::r2d<double>() << "," << res4.lat2 * math::r2d<double>() << ")"
|
||||
|
||||
@@ -44,6 +44,31 @@ class cross_track_box_box_generic
|
||||
{
|
||||
public :
|
||||
|
||||
template <typename Point, typename Strategy>
|
||||
ReturnType static inline diagonal_case(Point topA,
|
||||
Point topB,
|
||||
Point bottomA,
|
||||
Point bottomB,
|
||||
bool north_shortest,
|
||||
bool non_overlap,
|
||||
Strategy ps_strategy)
|
||||
{
|
||||
if (north_shortest && non_overlap)
|
||||
{
|
||||
return ps_strategy.get_distance_strategy().apply(topA, bottomB);
|
||||
}
|
||||
if (north_shortest && !non_overlap)
|
||||
{
|
||||
return ps_strategy.apply(topA, topB, bottomB);
|
||||
}
|
||||
if (!north_shortest && non_overlap)
|
||||
{
|
||||
return ps_strategy.get_distance_strategy().apply(bottomA, topB);
|
||||
}
|
||||
return ps_strategy.apply(bottomA, topB, bottomB);
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
typename Box1,
|
||||
@@ -162,9 +187,9 @@ public :
|
||||
ReturnType bottom_common = (std::max)(lat_min1, lat_min2);
|
||||
|
||||
// true if the closest points are on northern hemisphere
|
||||
bool north_shortest = math::abs(top_common) > math::abs(bottom_common)
|
||||
|| lat_max1 <= lat_min2
|
||||
|| lat_min1 >= lat_max2;
|
||||
bool north_shortest = top_common + bottom_common > 0;
|
||||
// true if box bands do not overlap
|
||||
bool non_overlap = top_common < bottom_common;
|
||||
|
||||
if (north_shortest)
|
||||
{
|
||||
@@ -183,44 +208,40 @@ public :
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX
|
||||
std::cout << "(bottom left)";
|
||||
#endif
|
||||
if (north_shortest)
|
||||
{
|
||||
return ps_strategy.apply(top_right2, top_left1, bottom_left1);
|
||||
}
|
||||
return ps_strategy.apply(bottom_right2, top_left1, bottom_left1);
|
||||
return diagonal_case(top_right2, top_left1,
|
||||
bottom_right2, bottom_left1,
|
||||
north_shortest, non_overlap,
|
||||
ps_strategy);
|
||||
}
|
||||
if (bottom_max && right_wrap)
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX
|
||||
std::cout << "(bottom right)";
|
||||
#endif
|
||||
if (north_shortest)
|
||||
{
|
||||
return ps_strategy.apply(top_left2, top_right1, bottom_right1);
|
||||
}
|
||||
return ps_strategy.apply(bottom_left2, top_right1, bottom_right1);
|
||||
return diagonal_case(top_left2, top_right1,
|
||||
bottom_left2, bottom_right1,
|
||||
north_shortest, non_overlap,
|
||||
ps_strategy);
|
||||
}
|
||||
if (!bottom_max && !right_wrap)
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX
|
||||
std::cout << "(top left)";
|
||||
#endif
|
||||
if (north_shortest)
|
||||
{
|
||||
return ps_strategy.apply(top_left1, top_right2, bottom_right2);
|
||||
}
|
||||
return ps_strategy.apply(bottom_left1, top_right2, bottom_right2);
|
||||
return diagonal_case(top_left1, top_right2,
|
||||
bottom_left1, bottom_right2,
|
||||
north_shortest, non_overlap,
|
||||
ps_strategy);
|
||||
}
|
||||
if (!bottom_max && right_wrap)
|
||||
{
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX
|
||||
std::cout << "(top right)";
|
||||
#endif
|
||||
if (north_shortest)
|
||||
{
|
||||
return ps_strategy.apply(top_right1, top_left2, bottom_left2);
|
||||
}
|
||||
return ps_strategy.apply(bottom_right1, top_left2, bottom_left2);
|
||||
return diagonal_case(top_right1, top_left2,
|
||||
bottom_right1, bottom_left2,
|
||||
north_shortest, non_overlap,
|
||||
ps_strategy);
|
||||
}
|
||||
return ReturnType(0);
|
||||
}
|
||||
|
||||
@@ -235,14 +235,23 @@ void test_distance_box_box(Strategy_pp const& strategy_pp,
|
||||
strategy_bb);
|
||||
|
||||
// case 10
|
||||
tester::apply("bb10", box1, "BOX(4 18, 8 22)",
|
||||
tester::apply("bb10a", box1, "BOX(4 18, 8 22)",
|
||||
ps_distance("POINT(10 20)", "SEGMENT(8 18, 8 22)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
tester::apply("bb10", box1, "BOX(4 20, 8 22)",
|
||||
std::string const box1m = "BOX(10 -20,20 -10)";
|
||||
tester::apply("bb10am", box1m, "BOX(4 -22, 8 -18)",
|
||||
ps_distance("POINT(10 20)", "SEGMENT(8 18, 8 22)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
tester::apply("bb10b", box1, "BOX(4 20, 8 22)",
|
||||
ps_distance("POINT(10 20)", "SEGMENT(8 20, 8 22)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
tester::apply("bb10bm", box1m, "BOX(4 -22, 8 -20)",
|
||||
ps_distance("POINT(10 20)", "SEGMENT(8 22, 8 20)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
// case 11
|
||||
tester::apply("bb11", box1, "BOX(4 22, 8 24)",
|
||||
pp_distance("POINT(8 22)", "POINT(10 20)", strategy_pp),
|
||||
@@ -299,6 +308,14 @@ void test_distance_box_box(Strategy_pp const& strategy_pp,
|
||||
ps_distance("POINT(20 25)", "SEGMENT(30 -15, 30 30)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
tester::apply("bb-eq1b", "BOX(30 -15, 40 30)", "BOX(10 -20, 20 10)",
|
||||
ps_distance("POINT(30 -15)", "SEGMENT(20 10, 20 -20)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
tester::apply("bb-eq1bm", "BOX(30 -30, 40 15)", "BOX(10 -10, 20 20)",
|
||||
ps_distance("POINT(30 15)", "SEGMENT(20 -10, 20 20)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
tester::apply("bb-eq2", "BOX(30 -15, 40 20)", "BOX(10 -20, 20 25)",
|
||||
ps_distance("POINT(30 20)", "SEGMENT(20 -20, 20 25)", strategy_ps),
|
||||
strategy_bb);
|
||||
|
||||
Reference in New Issue
Block a user