PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/doc/src/examples/core/set_box.cpp

http://hadesmem.googlecode.com/
C++ | 44 lines | 14 code | 13 blank | 17 comment | 0 complexity | 3e0c6d598958da5cbe68dc038796f3c7 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//[set_box
11//` Set the coordinate of a box
12
13#include <iostream>
14
15#include <boost/geometry.hpp>
16#include <boost/geometry/geometries/point_xy.hpp>
17
18namespace bg = boost::geometry;
19
20int main()
21{
22    bg::model::box<bg::model::d2::point_xy<double> > box;
23
24    bg::set<bg::min_corner, 0>(box, 0);
25    bg::set<bg::min_corner, 1>(box, 2);
26    bg::set<bg::max_corner, 0>(box, 4);
27    bg::set<bg::max_corner, 1>(box, 5);
28
29    std::cout << "Extent: " << bg::dsv(box) << std::endl;
30
31    return 0;
32}
33
34//]
35
36
37//[set_box_output
38/*`
39Output:
40[pre
41Extent: ((0, 2), (4, 5))
42]
43*/
44//]