Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:50:23

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2021.
0008 // Modifications copyright (c) 2021, Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 
0011 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0012 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0013 
0014 // Use, modification and distribution is subject to the Boost Software License,
0015 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0016 // http://www.boost.org/LICENSE_1_0.txt)
0017 
0018 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP
0019 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP
0020 
0021 
0022 #include <cstddef>
0023 
0024 #include <boost/geometry/core/access.hpp>
0025 #include <boost/geometry/core/coordinate_type.hpp>
0026 #include <boost/geometry/geometries/concepts/check.hpp>
0027 #include <boost/geometry/util/algorithm.hpp>
0028 #include <boost/geometry/util/numeric_cast.hpp>
0029 
0030 
0031 namespace boost { namespace geometry
0032 {
0033 
0034 #ifndef DOXYGEN_NO_DETAIL
0035 namespace detail
0036 {
0037 
0038 /*!
0039 \brief Assign a box or segment with the value of a point
0040 \ingroup assign
0041 \tparam Index indicates which box-corner, min_corner (0) or max_corner (1)
0042     or which point of segment (0/1)
0043 \tparam Point \tparam_point
0044 \tparam Geometry \tparam_box_or_segment
0045 \param point \param_point
0046 \param geometry \param_box_or_segment
0047 
0048 \qbk{
0049 [heading Example]
0050 [assign_point_to_index] [assign_point_to_index_output]
0051 }
0052 */
0053 template <std::size_t Index, typename Geometry, typename Point>
0054 inline void assign_point_to_index(Point const& point, Geometry& geometry)
0055 {
0056     concepts::check<Point const>();
0057     concepts::check<Geometry>();
0058 
0059     detail::for_each_dimension<Geometry>([&](auto dimension)
0060     {
0061         geometry::set<Index, dimension>(geometry,
0062             util::numeric_cast<coordinate_type_t<Geometry>>(geometry::get<dimension>(point)));
0063     });
0064 }
0065 
0066 
0067 /*!
0068 \brief Assign a point with a point of a box or segment
0069 \ingroup assign
0070 \tparam Index indicates which box-corner, min_corner (0) or max_corner (1)
0071     or which point of segment (0/1)
0072 \tparam Geometry \tparam_box_or_segment
0073 \tparam Point \tparam_point
0074 \param geometry \param_box_or_segment
0075 \param point \param_point
0076 
0077 \qbk{
0078 [heading Example]
0079 [assign_point_from_index] [assign_point_from_index_output]
0080 }
0081 */
0082 template <std::size_t Index, typename Point, typename Geometry>
0083 inline void assign_point_from_index(Geometry const& geometry, Point& point)
0084 {
0085     concepts::check<Geometry const>();
0086     concepts::check<Point>();
0087 
0088     detail::for_each_dimension<Geometry>([&](auto dimension)
0089     {
0090         geometry::set<dimension>(point,
0091             util::numeric_cast
0092                 <
0093                     coordinate_type_t<Point>
0094                 >(geometry::get<Index, dimension>(geometry)));
0095     });
0096 }
0097 
0098 
0099 } // namespace detail
0100 #endif // DOXYGEN_NO_DETAIL
0101 
0102 
0103 }} // namespace boost::geometry
0104 
0105 
0106 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP