]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/geometries/register/box.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / register / box.cpp
CommitLineData
7c673cae
FG
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//[register_box
11//` Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX
12
13#include <iostream>
14#include <boost/geometry.hpp>
15#include <boost/geometry/geometries/register/point.hpp>
16#include <boost/geometry/geometries/register/box.hpp>
17
18struct my_point
19{
20 double x, y;
21};
22
23struct my_box
24{
25 my_point ll, ur;
26};
27
28// Register the point type
29BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y)
30
31// Register the box type, also notifying that it is based on "my_point"
32BOOST_GEOMETRY_REGISTER_BOX(my_box, my_point, ll, ur)
33
34int main()
35{
36 my_box b = boost::geometry::make<my_box>(0, 0, 2, 2);
37 std::cout << "Area: " << boost::geometry::area(b) << std::endl;
38 return 0;
39}
40
41//]
42
43
44//[register_box_output
45/*`
46Output:
47[pre
48Area: 4
49]
50*/
51//]