diff options
Diffstat (limited to 'boost/geometry/strategies')
9 files changed, 86 insertions, 52 deletions
diff --git a/boost/geometry/strategies/cartesian/box_in_box.hpp b/boost/geometry/strategies/cartesian/box_in_box.hpp index fe77de9e2d..28a6f29336 100644 --- a/boost/geometry/strategies/cartesian/box_in_box.hpp +++ b/boost/geometry/strategies/cartesian/box_in_box.hpp @@ -36,8 +36,7 @@ namespace within { -template <typename Geometry, std::size_t Dimension, typename CSTag> -struct box_within_range +struct box_within_coord { template <typename BoxContainedValue, typename BoxContainingValue> static inline bool apply(BoxContainedValue const& bed_min, @@ -51,8 +50,7 @@ struct box_within_range }; -template <typename Geometry, std::size_t Dimension, typename CSTag> -struct box_covered_by_range +struct box_covered_by_coord { template <typename BoxContainedValue, typename BoxContainingValue> static inline bool apply(BoxContainedValue const& bed_min, @@ -65,7 +63,19 @@ struct box_covered_by_range }; -struct box_within_longitude_check +template <typename Geometry, std::size_t Dimension, typename CSTag> +struct box_within_range + : box_within_coord +{}; + + +template <typename Geometry, std::size_t Dimension, typename CSTag> +struct box_covered_by_range + : box_covered_by_coord +{}; + + +struct box_within_longitude_diff { template <typename CalcT> static inline bool apply(CalcT const& diff_ed) @@ -74,7 +84,7 @@ struct box_within_longitude_check } }; -struct box_covered_by_longitude_check +struct box_covered_by_longitude_diff { template <typename CalcT> static inline bool apply(CalcT const&) @@ -84,6 +94,7 @@ struct box_covered_by_longitude_check }; template <typename Geometry, + typename CoordCheck, typename InteriorCheck> struct box_longitude_range { @@ -101,6 +112,11 @@ struct box_longitude_range typedef typename coordinate_system<Geometry>::type::units units_t; typedef math::detail::constants_on_spheroid<calc_t, units_t> constants; + if (CoordCheck::apply(bed_min, bed_max, bing_min, bing_max)) + { + return true; + } + // min <= max <=> diff >= 0 calc_t const diff_ed = bed_max - bed_min; calc_t const diff_ing = bing_max - bing_min; @@ -122,7 +138,8 @@ struct box_longitude_range calc_t const diff_min = math::longitude_distance_unsigned<units_t>(bing_min, bed_min); // max of contained translated into the containing origin must be lesser than max of containing - return bing_min + diff_min + diff_ed <= bing_max; + return bing_min + diff_min + diff_ed <= bing_max + /*|| bing_max - diff_min - diff_ed >= bing_min*/; } }; @@ -130,13 +147,13 @@ struct box_longitude_range // spherical_equatorial_tag, spherical_polar_tag and geographic_cat are casted to spherical_tag template <typename Geometry> struct box_within_range<Geometry, 0, spherical_tag> - : box_longitude_range<Geometry, box_within_longitude_check> + : box_longitude_range<Geometry, box_within_coord, box_within_longitude_diff> {}; template <typename Geometry> struct box_covered_by_range<Geometry, 0, spherical_tag> - : box_longitude_range<Geometry, box_covered_by_longitude_check> + : box_longitude_range<Geometry, box_covered_by_coord, box_covered_by_longitude_diff> {}; diff --git a/boost/geometry/strategies/cartesian/point_in_box.hpp b/boost/geometry/strategies/cartesian/point_in_box.hpp index 28ed8215e7..227a98f2ad 100644 --- a/boost/geometry/strategies/cartesian/point_in_box.hpp +++ b/boost/geometry/strategies/cartesian/point_in_box.hpp @@ -33,9 +33,7 @@ namespace boost { namespace geometry { namespace strategy namespace within { - -template <typename Geometry, std::size_t Dimension, typename CSTag> -struct within_range +struct within_coord { template <typename Value1, typename Value2> static inline bool apply(Value1 const& value, Value2 const& min_value, Value2 const& max_value) @@ -44,9 +42,7 @@ struct within_range } }; - -template <typename Geometry, std::size_t Dimension, typename CSTag> -struct covered_by_range +struct covered_by_coord { template <typename Value1, typename Value2> static inline bool apply(Value1 const& value, Value2 const& min_value, Value2 const& max_value) @@ -55,32 +51,47 @@ struct covered_by_range } }; +template <typename Geometry, std::size_t Dimension, typename CSTag> +struct within_range + : within_coord +{}; + + +template <typename Geometry, std::size_t Dimension, typename CSTag> +struct covered_by_range + : covered_by_coord +{}; + // NOTE: the result would be the same if instead of structs defined below // the above xxx_range were used with the following arguments: // (min_value + diff_min, min_value, max_value) -struct within_longitude_range +struct within_longitude_diff { template <typename CalcT> static inline bool apply(CalcT const& diff_min, CalcT const& min_value, CalcT const& max_value) { CalcT const c0 = 0; - return diff_min > c0 && min_value + diff_min < max_value; + return diff_min > c0 + && (min_value + diff_min < max_value + /*|| max_value - diff_min > min_value*/); } }; -struct covered_by_longitude_range +struct covered_by_longitude_diff { template <typename CalcT> static inline bool apply(CalcT const& diff_min, CalcT const& min_value, CalcT const& max_value) { - return min_value + diff_min <= max_value; + return min_value + diff_min <= max_value + /*|| max_value - diff_min >= min_value*/; } }; template <typename Geometry, - typename ResultCheck> + typename CoordCheck, + typename DiffCheck> struct longitude_range { template <typename Value1, typename Value2> @@ -93,6 +104,11 @@ struct longitude_range typedef typename coordinate_system<Geometry>::type::units units_t; typedef math::detail::constants_on_spheroid<calc_t, units_t> constants; + if (CoordCheck::apply(value, min_value, max_value)) + { + return true; + } + // min <= max <=> diff >= 0 calc_t const diff_ing = max_value - min_value; @@ -105,7 +121,7 @@ struct longitude_range // calculate positive longitude translation with min_value as origin calc_t const diff_min = math::longitude_distance_unsigned<units_t, calc_t>(min_value, value); - return ResultCheck::template apply<calc_t>(diff_min, min_value, max_value); + return DiffCheck::template apply<calc_t>(diff_min, min_value, max_value); } }; @@ -113,13 +129,13 @@ struct longitude_range // spherical_equatorial_tag, spherical_polar_tag and geographic_cat are casted to spherical_tag template <typename Geometry> struct within_range<Geometry, 0, spherical_tag> - : longitude_range<Geometry, within_longitude_range> + : longitude_range<Geometry, within_coord, within_longitude_diff> {}; template <typename Geometry> struct covered_by_range<Geometry, 0, spherical_tag> - : longitude_range<Geometry, covered_by_longitude_range> + : longitude_range<Geometry, covered_by_coord, covered_by_longitude_diff> {}; diff --git a/boost/geometry/strategies/geographic/distance_andoyer.hpp b/boost/geometry/strategies/geographic/distance_andoyer.hpp index 1646727d09..1946cd1090 100644 --- a/boost/geometry/strategies/geographic/distance_andoyer.hpp +++ b/boost/geometry/strategies/geographic/distance_andoyer.hpp @@ -20,9 +20,10 @@ #include <boost/geometry/core/radius.hpp> #include <boost/geometry/core/srs.hpp> -#include <boost/geometry/algorithms/detail/andoyer_inverse.hpp> #include <boost/geometry/algorithms/detail/flattening.hpp> +#include <boost/geometry/formulas/andoyer_inverse.hpp> + #include <boost/geometry/strategies/distance.hpp> #include <boost/geometry/util/math.hpp> @@ -89,7 +90,7 @@ public : inline typename calculation_type<Point1, Point2>::type apply(Point1 const& point1, Point2 const& point2) const { - return geometry::detail::andoyer_inverse + return geometry::formula::andoyer_inverse < typename calculation_type<Point1, Point2>::type, true, false diff --git a/boost/geometry/strategies/geographic/distance_thomas.hpp b/boost/geometry/strategies/geographic/distance_thomas.hpp index 7252b723dd..39e0ecfa6f 100644 --- a/boost/geometry/strategies/geographic/distance_thomas.hpp +++ b/boost/geometry/strategies/geographic/distance_thomas.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2015. -// Modifications copyright (c) 2015 Oracle and/or its affiliates. +// This file was modified by Oracle on 2015, 2016. +// Modifications copyright (c) 2015-2016 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -23,7 +23,7 @@ #include <boost/geometry/util/promote_floating_point.hpp> #include <boost/geometry/util/select_calculation_type.hpp> -#include <boost/geometry/algorithms/detail/thomas_inverse.hpp> +#include <boost/geometry/formulas/thomas_inverse.hpp> namespace boost { namespace geometry { @@ -78,7 +78,7 @@ public : inline typename calculation_type<Point1, Point2>::type apply(Point1 const& point1, Point2 const& point2) const { - return geometry::detail::thomas_inverse + return geometry::formula::thomas_inverse < typename calculation_type<Point1, Point2>::type, true, false diff --git a/boost/geometry/strategies/geographic/distance_vincenty.hpp b/boost/geometry/strategies/geographic/distance_vincenty.hpp index 65bfa19939..e79e9aeb46 100644 --- a/boost/geometry/strategies/geographic/distance_vincenty.hpp +++ b/boost/geometry/strategies/geographic/distance_vincenty.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014, 2016. +// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -23,7 +23,7 @@ #include <boost/geometry/util/promote_floating_point.hpp> #include <boost/geometry/util/select_calculation_type.hpp> -#include <boost/geometry/algorithms/detail/vincenty_inverse.hpp> +#include <boost/geometry/formulas/vincenty_inverse.hpp> namespace boost { namespace geometry { @@ -80,7 +80,7 @@ public : inline typename calculation_type<Point1, Point2>::type apply(Point1 const& point1, Point2 const& point2) const { - return geometry::detail::vincenty_inverse + return geometry::formula::vincenty_inverse < typename calculation_type<Point1, Point2>::type, true, false diff --git a/boost/geometry/strategies/geographic/side_andoyer.hpp b/boost/geometry/strategies/geographic/side_andoyer.hpp index e0f0c04067..c3e71cd1cd 100644 --- a/boost/geometry/strategies/geographic/side_andoyer.hpp +++ b/boost/geometry/strategies/geographic/side_andoyer.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014, 2015, 2016. +// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -15,7 +15,7 @@ #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_SIDE_ANDOYER_HPP -#include <boost/geometry/algorithms/detail/andoyer_inverse.hpp> +#include <boost/geometry/formulas/andoyer_inverse.hpp> #include <boost/geometry/strategies/geographic/side_detail.hpp> @@ -36,9 +36,9 @@ namespace strategy { namespace side */ template <typename Model, typename CalculationType = void> class andoyer - : public detail::by_azimuth<geometry::detail::andoyer_inverse, Model, CalculationType> + : public detail::by_azimuth<geometry::formula::andoyer_inverse, Model, CalculationType> { - typedef detail::by_azimuth<geometry::detail::andoyer_inverse, Model, CalculationType> base_t; + typedef detail::by_azimuth<geometry::formula::andoyer_inverse, Model, CalculationType> base_t; public: andoyer(Model const& model = Model()) diff --git a/boost/geometry/strategies/geographic/side_detail.hpp b/boost/geometry/strategies/geographic/side_detail.hpp index c00213d072..ce1b47c88e 100644 --- a/boost/geometry/strategies/geographic/side_detail.hpp +++ b/boost/geometry/strategies/geographic/side_detail.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014, 2015, 2016. +// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -46,7 +46,7 @@ namespace detail \tparam Model Reference model of coordinate system. \tparam CalculationType \tparam_calculation */ -template <template<typename, bool, bool> class InverseFormula, +template <template<typename, bool, bool, bool, bool, bool> class InverseFormula, typename Model, typename CalculationType = void> class by_azimuth @@ -68,7 +68,7 @@ public: >::type >::type calc_t; - typedef InverseFormula<calc_t, false, true> inverse_formula; + typedef InverseFormula<calc_t, false, true, false, false, false> inverse_formula; calc_t a1p = azimuth<calc_t, inverse_formula>(p1, p, m_model); calc_t a12 = azimuth<calc_t, inverse_formula>(p1, p2, m_model); diff --git a/boost/geometry/strategies/geographic/side_thomas.hpp b/boost/geometry/strategies/geographic/side_thomas.hpp index a96cabdaab..96b0323307 100644 --- a/boost/geometry/strategies/geographic/side_thomas.hpp +++ b/boost/geometry/strategies/geographic/side_thomas.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014, 2015, 2016. +// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -15,7 +15,7 @@ #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_SIDE_THOMAS_HPP -#include <boost/geometry/algorithms/detail/thomas_inverse.hpp> +#include <boost/geometry/formulas/thomas_inverse.hpp> #include <boost/geometry/strategies/geographic/side_detail.hpp> @@ -36,9 +36,9 @@ namespace strategy { namespace side */ template <typename Model, typename CalculationType = void> class thomas - : public detail::by_azimuth<geometry::detail::thomas_inverse, Model, CalculationType> + : public detail::by_azimuth<geometry::formula::thomas_inverse, Model, CalculationType> { - typedef detail::by_azimuth<geometry::detail::thomas_inverse, Model, CalculationType> base_t; + typedef detail::by_azimuth<geometry::formula::thomas_inverse, Model, CalculationType> base_t; public: thomas(Model const& model = Model()) diff --git a/boost/geometry/strategies/geographic/side_vincenty.hpp b/boost/geometry/strategies/geographic/side_vincenty.hpp index a8ef9550d6..103277a8bd 100644 --- a/boost/geometry/strategies/geographic/side_vincenty.hpp +++ b/boost/geometry/strategies/geographic/side_vincenty.hpp @@ -2,8 +2,8 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014, 2015. -// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014, 2015, 2016. +// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -15,7 +15,7 @@ #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_SIDE_VINCENTY_HPP -#include <boost/geometry/algorithms/detail/vincenty_inverse.hpp> +#include <boost/geometry/formulas/vincenty_inverse.hpp> #include <boost/geometry/strategies/geographic/side_detail.hpp> @@ -36,9 +36,9 @@ namespace strategy { namespace side */ template <typename Model, typename CalculationType = void> class vincenty - : public detail::by_azimuth<geometry::detail::vincenty_inverse, Model, CalculationType> + : public detail::by_azimuth<geometry::formula::vincenty_inverse, Model, CalculationType> { - typedef detail::by_azimuth<geometry::detail::vincenty_inverse, Model, CalculationType> base_t; + typedef detail::by_azimuth<geometry::formula::vincenty_inverse, Model, CalculationType> base_t; public: vincenty(Model const& model = Model()) |