]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/doxy/doxygen_input/sourcecode/doxygen_3.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / doxy / doxygen_input / sourcecode / doxygen_3.cpp
CommitLineData
7c673cae
FG
1OBSOLETE
2
3// Boost.Geometry (aka GGL, Generic Geometry Library)
4//
5// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
6// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
7// Use, modification and distribution is subject to the Boost Software License,
8// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// Doxygen Examples, for e.g. email formal review
12
13#include <boost/foreach.hpp>
14
15#include <boost/geometry/geometry.hpp>
16
17
18
19void example_distance()
20{
21 int a[2] = {1,2};
22 int b[2] = {3,4};
23 double d = boost::geometry::distance(a, b);
24 std::cout << d << std::endl;
25}
26
27void example_length1()
28{
29 std::vector<boost::tuple<double, double, double> > line;
30 line.push_back(boost::make_tuple(1, 2, 3));
31 line.push_back(boost::make_tuple(4, 5, 6));
32 line.push_back(boost::make_tuple(7, 8, 9));
33 double length = boost::geometry::length(line);
34 std::cout << length << std::endl;
35}
36
37void example_length2()
38{
39 std::vector<boost::tuple<double, double> > line;
40 line.push_back(boost::make_tuple(1.1, 2.2));
41 line.push_back(boost::make_tuple(3.3, 4.4));
42 line.push_back(boost::make_tuple(5.5, 6.6));
43 std::cout << boost::geometry::length(
44 std::make_pair(boost::begin(line), boost::end(line) + -1)
45 )
46 << std::endl;
47}
48
49void example_less()
50{
51 typedef boost::tuple<double, double> P;
52 std::vector<P> line;
53 line.push_back(boost::make_tuple(8.1, 1.9));
54 line.push_back(boost::make_tuple(4.2, 7.5));
55 line.push_back(boost::make_tuple(2.3, 3.6));
56 std::sort(line.begin(), line.end(), boost::geometry::less<P>());
57
58 // Display ordered points
59 BOOST_FOREACH(P const& p, line)
60 {
61 std::cout << boost::geometry::dsv(p) << std::endl;
62 }
63}
64
65
66
67int main(void)
68{
69 example_distance();
70 example_length1();
71 example_length2();
72 example_less();
73 return 0;
74}