]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/make.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / make.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
10// Use, modification and distribution is subject to the Boost Software License,
11// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12// http://www.boost.org/LICENSE_1_0.txt)
13
14#ifndef BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP
15#define BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP
16
17#include <boost/geometry/algorithms/assign.hpp>
18
19#include <boost/geometry/geometries/concepts/check.hpp>
20
21namespace boost { namespace geometry
22{
23
24#ifndef DOXYGEN_NO_DETAIL
25namespace detail { namespace make
26{
27
28/*!
29\brief Construct a geometry
30\ingroup make
31\tparam Geometry \tparam_geometry
32\tparam Range \tparam_range_point
33\param range \param_range_point
34\return The constructed geometry, here: a linestring or a ring
35
36\qbk{distinguish, with a range}
37\qbk{
38[heading Example]
39[make_with_range] [make_with_range_output]
40
41[heading See also]
42\* [link geometry.reference.algorithms.assign.assign_points assign]
43}
44 */
45template <typename Geometry, typename Range>
46inline Geometry make_points(Range const& range)
47{
48 concepts::check<Geometry>();
49
50 Geometry geometry;
51 geometry::append(geometry, range);
52 return geometry;
53}
54
55}} // namespace detail::make
56#endif // DOXYGEN_NO_DETAIL
57
58/*!
59\brief Construct a geometry
60\ingroup make
61\details
62\note It does not work with array-point types, like int[2]
63\tparam Geometry \tparam_geometry
64\tparam Type \tparam_numeric to specify the coordinates
65\param c1 \param_x
66\param c2 \param_y
67\return The constructed geometry, here: a 2D point
68
69\qbk{distinguish, 2 coordinate values}
70\qbk{
71[heading Example]
72[make_2d_point] [make_2d_point_output]
73
74[heading See also]
75\* [link geometry.reference.algorithms.assign.assign_values_3_2_coordinate_values assign]
76}
77*/
78template <typename Geometry, typename Type>
79inline Geometry make(Type const& c1, Type const& c2)
80{
81 concepts::check<Geometry>();
82
83 Geometry geometry;
84 dispatch::assign
85 <
86 typename tag<Geometry>::type,
87 Geometry,
88 geometry::dimension<Geometry>::type::value
89 >::apply(geometry, c1, c2);
90 return geometry;
91}
92
93/*!
94\brief Construct a geometry
95\ingroup make
96\tparam Geometry \tparam_geometry
97\tparam Type \tparam_numeric to specify the coordinates
98\param c1 \param_x
99\param c2 \param_y
100\param c3 \param_z
101\return The constructed geometry, here: a 3D point
102
103\qbk{distinguish, 3 coordinate values}
104\qbk{
105[heading Example]
106[make_3d_point] [make_3d_point_output]
107
108[heading See also]
109\* [link geometry.reference.algorithms.assign.assign_values_4_3_coordinate_values assign]
110}
111 */
112template <typename Geometry, typename Type>
113inline Geometry make(Type const& c1, Type const& c2, Type const& c3)
114{
115 concepts::check<Geometry>();
116
117 Geometry geometry;
118 dispatch::assign
119 <
120 typename tag<Geometry>::type,
121 Geometry,
122 geometry::dimension<Geometry>::type::value
123 >::apply(geometry, c1, c2, c3);
124 return geometry;
125}
126
127template <typename Geometry, typename Type>
128inline Geometry make(Type const& c1, Type const& c2, Type const& c3, Type const& c4)
129{
130 concepts::check<Geometry>();
131
132 Geometry geometry;
133 dispatch::assign
134 <
135 typename tag<Geometry>::type,
136 Geometry,
137 geometry::dimension<Geometry>::type::value
138 >::apply(geometry, c1, c2, c3, c4);
139 return geometry;
140}
141
142
143
144
145
146/*!
147\brief Construct a box with inverse infinite coordinates
148\ingroup make
149\details The make_inverse function initializes a 2D or 3D box with large coordinates, the
150 min corner is very large, the max corner is very small. This is useful e.g. in combination
151 with the expand function, to determine the bounding box of a series of geometries.
152\tparam Geometry \tparam_geometry
153\return The constructed geometry, here: a box
154
155\qbk{
156[heading Example]
157[make_inverse] [make_inverse_output]
158
159[heading See also]
160\* [link geometry.reference.algorithms.assign.assign_inverse assign_inverse]
161}
162 */
163template <typename Geometry>
164inline Geometry make_inverse()
165{
166 concepts::check<Geometry>();
167
168 Geometry geometry;
169 dispatch::assign_inverse
170 <
171 typename tag<Geometry>::type,
172 Geometry
173 >::apply(geometry);
174 return geometry;
175}
176
177/*!
178\brief Construct a geometry with its coordinates initialized to zero
179\ingroup make
180\details The make_zero function initializes a 2D or 3D point or box with coordinates of zero
181\tparam Geometry \tparam_geometry
182\return The constructed and zero-initialized geometry
183 */
184template <typename Geometry>
185inline Geometry make_zero()
186{
187 concepts::check<Geometry>();
188
189 Geometry geometry;
190 dispatch::assign_zero
191 <
192 typename tag<Geometry>::type,
193 Geometry
194 >::apply(geometry);
195 return geometry;
196}
197
198}} // namespace boost::geometry
199
200#endif // BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP