PageRenderTime 27ms CodeModel.GetById 23ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/doc/src/examples/algorithms/assign_point_to_index.cpp

http://hadesmem.googlecode.com/
C++ | 46 lines | 16 code | 13 blank | 17 comment | 0 complexity | 1958d9060c231c8b60b4c0205deee106 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// QuickBook Example
 3
 4// Copyright (c) 2011 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_to_index
11//` Shows how to assign the lower-left or upper-right point from a box
12
13#include <iostream>
14
15#include <boost/geometry.hpp>
16#include <boost/geometry/geometries/box.hpp>
17#include <boost/geometry/geometries/point_xy.hpp>
18
19using namespace boost::geometry;
20
21int main()
22{
23    typedef model::d2::point_xy<int> point;
24    typedef model::box<point> box;
25
26    point lower_left(0, 0), upper_right(2, 2);
27
28    box b;
29    assign_point_to_index<0>(lower_left, b);
30    assign_point_to_index<1>(upper_right, b);
31    std::cout << "box: " << dsv(b) << std::endl;
32
33    return 0;
34}
35
36//]
37
38
39//[assign_point_to_index_output
40/*`
41Output:
42[pre
43box: ((0, 0), (2, 2))
44]
45*/
46//]