• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3 
4 // Copyright (c) 2010 Alfredo Correa
5 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
6 
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 
11 #include <boost/config.hpp>
12 #include <geometry_test_common.hpp>
13 
14 #include<boost/geometry/geometry.hpp>
15 #include<boost/geometry/geometries/adapted/boost_array.hpp>
16 #include<boost/geometry/geometries/adapted/c_array.hpp>
17 #include<boost/geometry/geometries/adapted/boost_tuple.hpp>
18 #include<iostream>
19 
20 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian)21 BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian)
22 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
23 
24 #ifndef BOOST_NO_CXX11_HDR_ARRAY
25 #include<boost/geometry/geometries/adapted/std_array.hpp>
26 BOOST_GEOMETRY_REGISTER_STD_ARRAY_CS(cs::cartesian)
27 #endif //BOOST_NO_CXX11_HDR_ARRAY
28 
29 int test_main(int, char* [])
30 {
31     bg::model::point<double, 3, bg::cs::cartesian> p1(1,2,3);
32     double p2[3] = {4,5,6};
33     boost::tuple<double, double, double> p3(7,8,9);
34     boost::array<double, 3> p4 = {{10,11,12}};
35     std::clog << bg::distance(p1, p2) << std::endl;
36     std::clog << bg::distance(p2, p3) << std::endl;
37     std::clog << bg::distance(p3, p4) << std::endl;
38 
39 #ifndef BOOST_NO_CXX11_HDR_ARRAY
40 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
41     std::array<double, 3> p5 = {13,14,15};
42 #else
43     std::array<double, 3> p5; p5[0] = 13; p5[1] = 14; p5[2] = 15;
44 #endif // BOOST_NO_CXX11_HDR_INITIALIZER_LIST
45     std::clog << bg::distance(p4, p5) << std::endl;
46 #endif //BOOST_NO_CXX11_HDR_ARRAY
47 
48     return 0;
49 }
50 
51