]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/assign_point_from_index.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / algorithms / assign_point_from_index.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // QuickBook Example
3
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 //[assign_point_from_index
11 //` Shows how to retrieve one point from a box (either lower-left or upper-right) or segment
12
13 #include <iostream>
14
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/point_xy.hpp>
17 #include <boost/geometry/geometries/segment.hpp>
18
19 using namespace boost::geometry;
20
21 int main()
22 {
23 typedef model::d2::point_xy<double> point;
24 typedef model::segment<point> segment;
25
26 segment s;
27 assign_values(s, 1, 1, 2, 2);
28
29 point first, second;
30 assign_point_from_index<0>(s, first);
31 assign_point_from_index<1>(s, second);
32 std::cout
33 << "segment: " << dsv(s) << std::endl
34 << "first: " << dsv(first) << std::endl
35 << "second: " << dsv(second) << std::endl;
36
37 return 0;
38 }
39
40 //]
41
42
43 //[assign_point_from_index_output
44 /*`
45 Output:
46 [pre
47 segment: ((1, 1), (2, 2))
48 first: (1, 1)
49 second: (2, 2)
50 ]
51 */
52 //]