1
// Boost.Geometry (aka GGL, Generic Geometry Library)
4
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
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)
11
//` Show the use of the macro BOOST_GEOMETRY_REGISTER_POINT_2D
14
#include <boost/geometry.hpp>
15
#include <boost/geometry/geometries/register/point.hpp>
17
/*< Somewhere, any legacy point struct is defined >*/
23
BOOST_GEOMETRY_REGISTER_POINT_2D(legacy_point, double, cs::cartesian, x, y) /*< The magic: adapt it to Boost.Geometry Point Concept >*/
29
namespace bg = boost::geometry;
31
/*< Any Boost.Geometry function can be used for legacy point now. Here: assign_values and distance >*/
32
bg::assign_values(p1, 1, 1);
33
bg::assign_values(p2, 2, 2);
35
double d = bg::distance(p1, p2);
37
std::cout << "Distance: " << d << std::endl;
45
//[register_point_2d_output