]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/length.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / algorithms / length.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 //[length
11 //` The following simple example shows the calculation of the length of a linestring containing three points
12
13 #include <iostream>
14 #include <boost/geometry.hpp>
15 #include <boost/geometry/geometries/linestring.hpp>
16 #include <boost/geometry/geometries/point_xy.hpp>
17
18
19 int main()
20 {
21 using namespace boost::geometry;
22 model::linestring<model::d2::point_xy<double> > line;
23 read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
24 std::cout << "linestring length is "
25 << length(line)
26 << " units" << std::endl;
27
28 return 0;
29 }
30
31 //]
32
33
34 //[length_output
35 /*`
36 Output:
37 [pre
38 linestring length is 15.1127 units
39 ]
40 */
41 //]