• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 //[c_array
11 //` Small example showing the combination of an array with a Boost.Geometry algorithm
12 
13 #include <iostream>
14 #include <boost/geometry.hpp>
15 #include <boost/geometry/geometries/adapted/c_array.hpp>
16 
BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)17 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
18 
19 int main()
20 {
21     int a[3] = {1, 2, 3};
22     int b[3] = {2, 3, 4};
23 
24     std::cout << boost::geometry::distance(a, b) << std::endl;
25 
26     return 0;
27 }
28 
29 //]
30 
31 //[c_array_output
32 /*`
33 Output:
34 [pre
35 1.73205
36 ]
37 */
38 //]
39