1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. 4 // Copyright (c) 2013 Bruno Lalande, Paris, France. 5 // Copyright (c) 2013 Mateusz Loskot, London, UK. 6 // Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. 7 8 // Use, modification and distribution is subject to the Boost Software License, 9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 10 // http://www.boost.org/LICENSE_1_0.txt) 11 12 #ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP 13 #define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP 14 15 #include <stddef.h> 16 17 #include <boost/geometry/core/coordinate_type.hpp> 18 #include <boost/geometry/policies/robustness/robust_point_type.hpp> 19 #include <boost/geometry/policies/robustness/segment_ratio.hpp> 20 #include <boost/geometry/policies/robustness/segment_ratio_type.hpp> 21 22 namespace boost { namespace geometry 23 { 24 25 #ifndef DOXYGEN_NO_DETAIL 26 namespace detail 27 { 28 29 // Probably this will be moved out of namespace detail 30 struct no_rescale_policy 31 { 32 static bool const enabled = false; 33 34 // We don't rescale but return the reference of the input 35 template <std::size_t Dimension, typename Value> applyboost::geometry::detail::no_rescale_policy36 inline Value const& apply(Value const& value) const 37 { 38 return value; 39 } 40 }; 41 42 } // namespace detail 43 #endif 44 45 46 // Implement meta-functions for this policy 47 template <typename Point> 48 struct robust_point_type<Point, detail::no_rescale_policy> 49 { 50 // The point itself 51 typedef Point type; 52 }; 53 54 template <typename Point> 55 struct segment_ratio_type<Point, detail::no_rescale_policy> 56 { 57 // Define a segment_ratio defined on coordinate type, e.g. 58 // int/int or float/float 59 typedef typename geometry::coordinate_type<Point>::type coordinate_type; 60 typedef segment_ratio<coordinate_type> type; 61 }; 62 63 64 }} // namespace boost::geometry 65 66 #endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP 67