diff --git a/doc/readme.txt b/doc/readme.txt index c4cdc22ba..3a844bd35 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -32,14 +32,14 @@ src: examples used in documentation and tools (doxygen_xml2qbk) Per new algorithm (e.g. foo), one should add: 1) in file boost/geometry/algorithms/foo.hpp, include a "\ingroup foo" in the doxygen comments - (if a directory is created e.g. boost/geometry/algorithms/detail/foo the path should be added in doc/doxy/Doxyfile) -2) in file doc/doxy/doxygen_input/groups/groups.hpp, define the group "foo" -3) in file doc/make_qbk.py, include the algorithm "foo" -4) in file doc/reference.qbk, include the foo.qbk ([include generated/foo.qbk]) -5) in file doc/quickref.xml, include a section on foo conform other sections -6) in file doc/src/docutils/tools/support_status/support_status.cpp include the algorithm (3 places) (optionally) -7) in file doc/reference/foo.qbk (to be created), include the support status and write other text, and include examples (optionally) -8) in file doc/imports.qbk, include the example foo.cpp (if any) -9) create file doc/src/examples/algorithm/foo.cpp (optional) +2) if a directory is created e.g. boost/geometry/algorithms/detail/foo the path should be added in doc/doxy/Doxyfile +3) in file doc/doxy/doxygen_input/groups/groups.hpp, define the group "foo" +4) in file doc/make_qbk.py, include the algorithm "foo" +5) in file doc/reference.qbk, include the foo.qbk ([include generated/foo.qbk]) +6) in file doc/quickref.xml, include a section on foo conform other sections +7) in file doc/src/docutils/tools/support_status/support_status.cpp include the algorithm (3 places) (optionally) +8) in file doc/reference/foo.qbk (to be created), include the support status and write other text, and include examples (optionally) +9) in file doc/imports.qbk, include the example foo.cpp (if any) +10) create file doc/src/examples/algorithm/foo.cpp (optional) diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp index 65571c921..3780705bf 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp @@ -672,7 +672,7 @@ struct buffered_piece_collection { // Make sure the closing point is identical (they are calculated // separately by different pieces) - range::back(added) = range::front(added); + range::back(added) = range::added); } for (std::size_t i = first_piece_index; i < boost::size(m_pieces); i++) diff --git a/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp b/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp index 3de60795a..b33b4be3b 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp @@ -34,23 +34,20 @@ struct linear_to_areal Segment& shortest_seg, Strategies const& strategies) { - using most_precise_type = typename select_coordinate_type - < - Linear, - Areal - >::type; + using most_precise_type = typename select_coordinate_type::type; using point_type = typename std::conditional - < - std::is_same, most_precise_type>::value, - typename point_type::type, - typename point_type::type - >::type; + < + std::is_same::type, most_precise_type>::value, + typename point_type::type, + typename point_type::type + >::type; using linestring_type = geometry::model::linestring; - /* TODO: currently intersection does not support tupled input - * this should be implemented directly with dynamic geometries + /* TODO: currently intersection does not support some cases of tupled input + * such as linestring - multipolygon + * this could be implemented directly with dynamic geometries using polygon_type = geometry::model::polygon; std::tuple < @@ -111,8 +108,7 @@ struct segment_to_areal Strategies const& strategies, bool = false) { - using linestring_type = geometry::model::linestring - ::type>; + using linestring_type = geometry::model::linestring::type>; linestring_type linestring; convert(segment, linestring); linear_to_areal::apply(linestring, areal, shortest_seg, strategies); @@ -141,18 +137,14 @@ struct areal_to_areal Segment& shortest_seg, Strategies const& strategies) { - using most_precise_type = typename select_coordinate_type - < - Areal1, - Areal2 - >::type; + using most_precise_type = typename select_coordinate_type::type; using point_type = typename std::conditional - < - std::is_same, most_precise_type>::value, - typename point_type::type, - typename point_type::type - >::type; + < + std::is_same::type, most_precise_type>::value, + typename point_type::type, + typename point_type::type + >::type; using linestring_type = geometry::model::linestring; using polygon_type = geometry::model::polygon; diff --git a/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp b/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp index 8524c15c9..0de45ed91 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp @@ -87,26 +87,15 @@ public: closest_points::creturn_t d[4]; - //TODO: this could be simplified by getting distance strategy in a unique way - d[0] = strategy::distance::services::get_comparable - < - decltype(strategies.distance(cp0, q[0])) - >::apply(strategies.distance(cp0, q[0])).apply(cp0, q[0]); - d[1] = strategy::distance::services::get_comparable - < - decltype(strategies.distance(cp1, q[1])) - >::apply(strategies.distance(cp1, q[1])).apply(cp1, q[1]); - d[2] = strategy::distance::services::get_comparable - < - decltype(strategies.distance(p[0], cp2)) - >::apply(strategies.distance(p[0], cp2)).apply(p[0], cp2); - d[3] = strategy::distance::services::get_comparable - < - decltype(strategies.distance(p[1], cp3)) - >::apply(strategies.distance(p[1], cp3)).apply(p[1], cp3); + auto const cds = strategies::distance::detail::make_comparable(strategies) + .distance(detail::dummy_point(), detail::dummy_point()); + + d[0] = cds.apply(cp0, q[0]); + d[1] = cds.apply(cp1, q[1]); + d[2] = cds.apply(p[0], cp2); + d[3] = cds.apply(p[1], cp3); - std::size_t imin = std::distance(boost::addressof(d[0]), - std::min_element(d, d + 4)); + std::size_t imin = std::distance(boost::addressof(d[0]), std::min_element(d, d + 4)); switch (imin) { diff --git a/include/boost/geometry/strategies/closest_points/geographic.hpp b/include/boost/geometry/strategies/closest_points/geographic.hpp index 4fc606551..d950a951c 100644 --- a/include/boost/geometry/strategies/closest_points/geographic.hpp +++ b/include/boost/geometry/strategies/closest_points/geographic.hpp @@ -27,10 +27,6 @@ namespace boost { namespace geometry namespace strategies { namespace closest_points { -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - template < typename FormulaPolicy = geometry::strategy::andoyer, @@ -43,6 +39,7 @@ class geographic using base_t = strategies::distance::geographic; public: + geographic() = default; explicit geographic(Spheroid const& spheroid) @@ -50,8 +47,8 @@ public: {} template - auto closest_points(Geometry1 const&, Geometry2 const&, - distance::detail::enable_if_ps_t * = nullptr) const + auto closest_points(Geometry1 const&, Geometry2 const&, + distance::detail::enable_if_ps_t * = nullptr) const { return strategy::closest_points::geographic_cross_track < @@ -60,40 +57,6 @@ public: CalculationType >(base_t::m_spheroid); } - -}; - - -} // namespace detail -#endif // DOXYGEN_NO_DETAIL - -template -< - typename FormulaPolicy = strategy::andoyer, - typename Spheroid = srs::spheroid, - typename CalculationType = void -> -class geographic - : public strategies::closest_points::detail::geographic - < - FormulaPolicy, - Spheroid, - CalculationType - > -{ - using base_t = strategies::closest_points::detail::geographic - < - FormulaPolicy, - Spheroid, - CalculationType - >; - -public: - geographic() = default; - - explicit geographic(Spheroid const& spheroid) - : base_t(spheroid) - {} }; @@ -101,13 +64,7 @@ namespace services { template -struct default_strategy -< - Geometry1, - Geometry2, - geographic_tag, - geographic_tag -> +struct default_strategy { using type = strategies::closest_points::geographic<>; }; diff --git a/include/boost/geometry/strategies/closest_points/spherical.hpp b/include/boost/geometry/strategies/closest_points/spherical.hpp index faeea4563..18beb1c0c 100644 --- a/include/boost/geometry/strategies/closest_points/spherical.hpp +++ b/include/boost/geometry/strategies/closest_points/spherical.hpp @@ -10,15 +10,6 @@ #ifndef BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_SPHERICAL_HPP #define BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_SPHERICAL_HPP - -//#include - -//#include -//#include -//#include -//#include -//#include - #include #include @@ -36,15 +27,15 @@ namespace boost { namespace geometry namespace strategies { namespace closest_points { -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -template +template +< + typename RadiusTypeOrSphere = double, + typename CalculationType = void +> class spherical - : public strategies::distance::detail::spherical + : public strategies::distance::spherical { - using base_t = strategies::distance::detail::spherical; + using base_t = strategies::distance::spherical; public: spherical() = default; @@ -56,35 +47,10 @@ public: template auto closest_points(Geometry1 const&, Geometry2 const&, - distance::detail::enable_if_ps_t * = nullptr) const + distance::detail::enable_if_ps_t * = nullptr) const { - return strategy::closest_points::cross_track( - base_t::radius()); + return strategy::closest_points::cross_track(base_t::radius()); } - -}; - - -} // namespace detail -#endif // DOXYGEN_NO_DETAIL - -template -< - typename RadiusTypeOrSphere = double, - typename CalculationType = void -> -class spherical - : public strategies::closest_points::detail::spherical -{ - using base_t = strategies::closest_points::detail::spherical; - -public: - spherical() = default; - - template - explicit spherical(RadiusOrSphere const& radius_or_sphere) - : base_t(radius_or_sphere) - {} }; diff --git a/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp b/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp index acae73bfa..b932e4c4a 100644 --- a/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp +++ b/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp @@ -85,6 +85,19 @@ class geographic_cross_track false, true >; + + template + struct calculation_type + : promote_floating_point + < + typename select_calculation_type + < + Point, + PointOfSegment, + CalculationType + >::type + > + {}; public : explicit geographic_cross_track(Spheroid const& spheroid = Spheroid()) @@ -103,7 +116,7 @@ public : model::point < - typename base_t::template return_type::type, + typename calculation_type::type, dimension::value, typename coordinate_system::type > cp; diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp index f65cbb86e..6676254e6 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp @@ -65,7 +65,7 @@ namespace strategy { namespace distance namespace detail { -template +template struct set_result { template @@ -165,8 +165,7 @@ public: strategy::default_order::value >; - return meridian_inverse::meridian_not_crossing_pole_dist(lat1, lat2, - m_spheroid); + return meridian_inverse::meridian_not_crossing_pole_dist(lat1, lat2, m_spheroid); } private: @@ -192,16 +191,14 @@ private: if (g4 < -1.25*pi)//close to -270 { #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK - std::cout << "g4=" << g4 * math::r2d() << ", close to -270" - << std::endl; + std::cout << "g4=" << g4 * math::r2d() << ", close to -270" << std::endl; #endif return g4 + 1.5 * pi; } else if (g4 > 1.25*pi)//close to 270 { #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK - std::cout << "g4=" << g4 * math::r2d() << ", close to 270" - << std::endl; + std::cout << "g4=" << g4 * math::r2d() << ", close to 270" << std::endl; #endif der = -der; return - g4 + 1.5 * pi; @@ -209,8 +206,7 @@ private: else if (g4 < 0 && g4 > -0.75*pi)//close to -90 { #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK - std::cout << "g4=" << g4 * math::r2d() << ", close to -90" - << std::endl; + std::cout << "g4=" << g4 * math::r2d() << ", close to -90" << std::endl; #endif der = -der; return -g4 - pi/2; @@ -227,23 +223,10 @@ private: CT const& s14_start, CT const& a12, result_type& result) { - using direct_distance_type = typename FormulaPolicy::template direct - < - CT, - true, - false, - false, - false - >; - using inverse_distance_type = typename FormulaPolicy::template inverse - < - CT, - true, - false, - false, - false, - false - >; + using direct_distance_type = + typename FormulaPolicy::template direct; + using inverse_distance_type = + typename FormulaPolicy::template inverse; geometry::formula::result_direct res14; @@ -263,40 +246,34 @@ private: #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "dist(pl,p3)=" - << inverse_distance_type::apply(lon3, lat3, - pr_lon, pr_lat, - spheroid).distance + << inverse_distance_type::apply(lon3, lat3, pr_lon, pr_lat, spheroid).distance << std::endl; std::cout << "dist(pr,p3)=" - << inverse_distance_type::apply(lon3, lat3, - pr_lon, pr_lat, - spheroid).distance + << inverse_distance_type::apply(lon3, lat3, pr_lon, pr_lat, spheroid).distance << std::endl; #endif - CT const dist_l = inverse_distance_type::apply - (lon3, lat3, pl_lon, pl_lat, spheroid).distance; - CT const dist_r = inverse_distance_type::apply - (lon3, lat3, pr_lon, pr_lat, spheroid).distance; + CT const dist_l = + inverse_distance_type::apply(lon3, lat3, pl_lon, pl_lat, spheroid).distance; + CT const dist_r = + inverse_distance_type::apply(lon3, lat3, pr_lon, pr_lat, spheroid).distance; + if (dist_l < dist_r) { - s14 -= inverse_distance_type::apply(res14.lon2, res14.lat2, - pl_lon, pl_lat, - spheroid).distance/2; + s14 -= inverse_distance_type::apply(res14.lon2, res14.lat2, pl_lon, + pl_lat, spheroid).distance/2; pr_lon = res14.lon2; pr_lat = res14.lat2; } else { - s14 += inverse_distance_type::apply(res14.lon2, res14.lat2, - pr_lon, pr_lat, - spheroid).distance/2; + s14 += inverse_distance_type::apply(res14.lon2, res14.lat2, pr_lon, + pr_lat, spheroid).distance/2; pl_lon = res14.lon2; pl_lat = res14.lat2; } - CT new_distance = inverse_distance_type::apply(lon3, lat3, - res14.lon2, res14.lat2, - spheroid).distance; + CT new_distance = inverse_distance_type::apply(lon3, lat3, res14.lon2, res14.lat2, + spheroid).distance; dist_improve = new_distance != result.distance; @@ -316,16 +293,14 @@ private: << std::endl<< std::endl; if (!dist_improve) { - std::cout << "Stop msg: res34.distance >= prev_distance" - << std::endl; + std::cout << "Stop msg: res34.distance >= prev_distance" << std::endl; } if (counter == BOOST_GEOMETRY_DETAIL_POINT_SEGMENT_DISTANCE_MAX_STEPS) { std::cout << "Stop msg: counter" << std::endl; } #endif - set_result::apply(new_distance, res14.lon2, - res14.lat2, result); + set_result::apply(new_distance, res14.lon2, res14.lat2, result); } while (dist_improve && counter++ < BOOST_GEOMETRY_DETAIL_POINT_SEGMENT_DISTANCE_MAX_STEPS); @@ -339,14 +314,14 @@ private: CT const& s14_start, CT const& a12, result_type& result) { - using inverse_distance_azimuth_quantities_type = typename - FormulaPolicy::template inverse; + using inverse_distance_azimuth_quantities_type = + typename FormulaPolicy::template inverse; - using inverse_dist_azimuth_type = typename FormulaPolicy::template - inverse; + using inverse_dist_azimuth_type = + typename FormulaPolicy::template inverse; - using direct_distance_type = typename FormulaPolicy::template - direct; + using direct_distance_type = + typename FormulaPolicy::template direct; CT const half_pi = math::pi() / CT(2); geometry::formula::result_direct res14; @@ -370,10 +345,10 @@ private: // g4 is the angle between segment (p1,p2) and segment (p3,p4) // that meet on p4 (GEO) - CT a4 = inverse_dist_azimuth_type - ::apply(res14.lon2, res14.lat2, lon2, lat2, spheroid).azimuth; - res34 = inverse_distance_azimuth_quantities_type - ::apply(res14.lon2, res14.lat2, lon3, lat3, spheroid); + CT a4 = inverse_dist_azimuth_type::apply(res14.lon2, res14.lat2, + lon2, lat2, spheroid).azimuth; + res34 = inverse_distance_azimuth_quantities_type::apply(res14.lon2, res14.lat2, + lon3, lat3, spheroid); g4 = res34.azimuth - a4; // cos(s14/earth_radius) is the spherical limit @@ -391,13 +366,13 @@ private: if (dist_improve) { - set_result::apply(res34.distance, - res14.lon2, res14.lat2, result); + set_result::apply(res34.distance, res14.lon2, res14.lat2, + result); } else { - set_result::apply(prev_distance, - prev_res.lon2, prev_res.lat2, result); + set_result::apply(prev_distance, prev_res.lon2, prev_res.lat2, + result); } #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK @@ -420,8 +395,7 @@ private: } if (!dist_improve) { - std::cout << "Stop msg: res34.distance >= prev_distance" - << std::endl; + std::cout << "Stop msg: res34.distance >= prev_distance" << std::endl; } if (delta_g4 == 0) { @@ -436,8 +410,7 @@ private: } while (g4 != half_pi && dist_improve && delta_g4 != 0 - && counter++ - < BOOST_GEOMETRY_DETAIL_POINT_SEGMENT_DISTANCE_MAX_STEPS); + && counter++ < BOOST_GEOMETRY_DETAIL_POINT_SEGMENT_DISTANCE_MAX_STEPS); #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "distance=" << res34.distance << std::endl; @@ -449,22 +422,25 @@ private: << res14.lat2 * math::r2d() << ")" << std::endl; - 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 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_dist_azimuth_type - ::apply(res14.lon2, res14.lat2, lon2, lat2, spheroid).azimuth; + CT a4 = inverse_dist_azimuth_type::apply(res14.lon2, res14.lat2, lon2, lat2, spheroid) + .azimuth; + geometry::formula::result_direct res4 = - direct_distance_type::apply(res14.lon2, res14.lat2, .04, a4, spheroid); - CT p4_plus = inverse_distance_azimuth_quantities_type - ::apply(res4.lon2, res4.lat2, lon3, lat3, spheroid).distance; + direct_distance_type::apply(res14.lon2, res14.lat2, .04, a4, spheroid); + + CT p4_plus = inverse_distance_azimuth_quantities_type::apply(res4.lon2, res4.lat2, lon3, + lat3, spheroid).distance; - geometry::formula::result_direct res1 - = direct_distance_type::apply(lon1, lat1, s14-.04, a12, spheroid); - CT p4_minus = inverse_distance_azimuth_quantities_type - ::apply(res1.lon2, res1.lat2, lon3, lat3, spheroid).distance; + geometry::formula::result_direct res1 = + direct_distance_type::apply(lon1, lat1, s14-.04, a12, spheroid); + + 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=(" @@ -522,11 +498,11 @@ protected: CT const& lo3, CT const& la3, //query point p3 Spheroid const& spheroid) { - using inverse_dist_azimuth_type = typename FormulaPolicy::template - inverse; + using inverse_dist_azimuth_type = + typename FormulaPolicy::template inverse; - using inverse_dist_azimuth_reverse_type = typename FormulaPolicy:: - template inverse; + using inverse_dist_azimuth_reverse_type = + typename FormulaPolicy::template inverse; CT const earth_radius = geometry::formula::mean_radius(spheroid); @@ -572,8 +548,7 @@ protected: //segment on equator //Note: antipodal points on equator does not define segment on equator //but pass by the pole - CT diff = geometry::math::longitude_distance_signed(lon1, lon2); + CT diff = geometry::math::longitude_distance_signed(lon1, lon2); using meridian_inverse = typename formula::meridian_inverse; @@ -622,20 +597,16 @@ protected: #endif CT sign_non_zero = lat3 >= c0 ? 1 : -1; - auto res13 = apply(lon1, lat1, lon1, half_pi * sign_non_zero, lon3, - lat3, spheroid); + auto res13 = apply(lon1, lat1, lon1, half_pi * sign_non_zero, lon3, lat3, spheroid); - auto res23 = apply(lon2, lat2, lon2, half_pi * sign_non_zero, lon3, - lat3, spheroid); + auto res23 = apply(lon2, lat2, lon2, half_pi * sign_non_zero, lon3, lat3, spheroid); return (res13.distance) < (res23.distance) ? res13 : res23; } - auto res12 = inverse_dist_azimuth_reverse_type::apply(lon1, lat1, lon2, - lat2, spheroid); + auto res12 = inverse_dist_azimuth_reverse_type::apply(lon1, lat1, lon2, lat2, spheroid); - auto res13 = inverse_dist_azimuth_type::apply(lon1, lat1, lon3, lat3, - spheroid); + auto res13 = inverse_dist_azimuth_type::apply(lon1, lat1, lon3, lat3, spheroid); if (geometry::math::equals(res12.distance, c0)) { @@ -644,8 +615,7 @@ protected: std::cout << "distance between points=" << res13.distance << std::endl; #endif - typename meridian_inverse::result res = meridian_inverse::apply( - lon1, lat1, lon3, lat3, spheroid); + auto res = meridian_inverse::apply(lon1, lat1, lon3, lat3, spheroid); return non_iterative_case(lon3, lat3, lon1, lat2, res.meridian ? res.distance : res13.distance); @@ -657,7 +627,7 @@ protected: // TODO: meridian case optimization if (geometry::math::equals(a312, c0) && meridian_not_crossing_pole) { - std::tuple minmax_elem = std::minmax(lat1, lat2); + auto const minmax_elem = std::minmax(lat1, lat2); if (lat3 >= std::get<0>(minmax_elem) && lat3 <= std::get<1>(minmax_elem)) @@ -690,8 +660,7 @@ protected: return non_iterative_case(lon3, lat3, lon1, lat1, spheroid); } - auto res23 = inverse_dist_azimuth_type::apply(lon2, lat2, lon3, lat3, - spheroid); + auto res23 = inverse_dist_azimuth_type::apply(lon2, lat2, lon3, lat3, spheroid); CT a321 = res23.azimuth - res12.reverse_azimuth + pi; CT projection2 = cos( a321 ) * res23.distance / res12.distance; @@ -733,14 +702,13 @@ protected: geometry::strategy::distance::haversine str(earth_radius); CT s13_sph = str.apply(p1, p3); - //CT s14 = acos( cos(s13/earth_radius) / cos(s34/earth_radius) ) - // * earth_radius; + //CT s14 = acos( cos(s13/earth_radius) / cos(s34/earth_radius) ) * earth_radius; CT cos_frac = cos(s13_sph / earth_radius) / cos(s34_sph / earth_radius); CT s14_sph = cos_frac >= 1 ? CT(0) : cos_frac <= -1 ? pi * earth_radius : acos(cos_frac) * earth_radius; - CT a12_sph = geometry::formula::spherical_azimuth<>(lon1, lat1, lon2, lat2); + CT const a12_sph = geometry::formula::spherical_azimuth<>(lon1, lat1, lon2, lat2); auto res = geometry::formula::spherical_direct(lon1, lat1, s14_sph, a12_sph, srs::sphere(earth_radius)); @@ -772,8 +740,7 @@ protected: CT >::apply(lon1, lat1, res.lon2, res.lat2, spheroid); - newton(lon1, lat1, lon2, lat2, lon3, lat3, spheroid, s14_start, - res12.azimuth, result); + newton(lon1, lat1, lon2, lat2, lon3, lat3, spheroid, s14_start, res12.azimuth, result); } return result; diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track.hpp index 21b303679..7fad3092f 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track.hpp @@ -68,7 +68,7 @@ namespace detail CalculationType lon = geometry::get_as_radian<0>(p); CalculationType lat = geometry::get_as_radian<1>(p); - CalculationType crs_AD = geometry::formula::spherical_azimuth + CalculationType const crs_AD = geometry::formula::spherical_azimuth < CalculationType, false @@ -549,28 +549,7 @@ template class cross_track { public : - using equals_point_point_strategy_type = within::spherical_point_point; - - using relate_segment_segment_strategy_type = intersection::spherical_segments - < - CalculationType - >; - - static inline relate_segment_segment_strategy_type get_relate_segment_segment_strategy() - { - return relate_segment_segment_strategy_type(); - } - - using point_in_geometry_strategy_type = within::spherical_winding - < - void, void, CalculationType - >; - - static inline point_in_geometry_strategy_type get_point_in_geometry_strategy() - { - return point_in_geometry_strategy_type(); - } - + template struct return_type : promote_floating_point diff --git a/test/algorithms/closest_points/empty_geometry.hpp b/test/algorithms/closest_points/empty_geometry.hpp index 1874109f7..176ba60a7 100644 --- a/test/algorithms/closest_points/empty_geometry.hpp +++ b/test/algorithms/closest_points/empty_geometry.hpp @@ -27,8 +27,7 @@ void test_empty_input(Geometry1 const& geometry1, { return; } - BOOST_CHECK_MESSAGE(false, - "A empty_input_exception should have been thrown"); + BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown"); try { @@ -38,8 +37,7 @@ void test_empty_input(Geometry1 const& geometry1, { return; } - BOOST_CHECK_MESSAGE(false, - "A empty_input_exception should have been thrown"); + BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown"); try { @@ -49,8 +47,7 @@ void test_empty_input(Geometry1 const& geometry1, { return; } - BOOST_CHECK_MESSAGE(false, - "A empty_input_exception should have been thrown"); + BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown"); try { @@ -60,8 +57,7 @@ void test_empty_input(Geometry1 const& geometry1, { return; } - BOOST_CHECK_MESSAGE(false, - "A empty_input_exception should have been thrown"); + BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown"); } diff --git a/test/algorithms/closest_points/l_l.cpp b/test/algorithms/closest_points/l_l.cpp index 2d9c58cf7..c4f47aed1 100644 --- a/test/algorithms/closest_points/l_l.cpp +++ b/test/algorithms/closest_points/l_l.cpp @@ -85,11 +85,11 @@ void test_closest_points_segment_linestring(Strategies const& strategies) strategies, true, true); //geometries intersect -// tester::apply("SEGMENT(0 0,1 1)", -// "LINESTRING(0 2,0 1,1 0,2 0)", -// "SEGMENT(0.5 0.5,0.5 0.5)", -// "SEGMENT(0.5 0.500057,0.5 0.500057)", -// strategies); + tester::apply("SEGMENT(0 0,1 1)", + "LINESTRING(0 2,0 1,1 0,2 0)", + "SEGMENT(0.5 0.5,0.5 0.5)", + "SEGMENT(0.5 0.500057,0.5 0.500057)", + strategies); } //=========================================================================== @@ -167,11 +167,11 @@ void test_closest_points_segment_multi_linestring(Strategies const& strategies) strategies, true, true); //geometries intersect -// tester::apply("SEGMENT(0 0,1 1)", -// "MULTILINESTRING((0 2,0 1,1 0,2 0)(1 0,3 0))", -// "SEGMENT(0.5 0.5,0.5 0.5)", -// "SEGMENT(0.5 0.500057,0.5 0.500057)", -// strategies); + tester::apply("SEGMENT(0 0,1 1)", + "MULTILINESTRING((0 2,0 1,1 0,2 0)(1 0,3 0))", + "SEGMENT(0.5 0.5,0.5 0.5)", + "SEGMENT(0.5 0.500057,0.5 0.500057)", + strategies); } //===========================================================================