]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/geometries/segment.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
8 // This file was modified by Oracle on 2020.
9 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
19 #include <geometry_test_common.hpp>
21 #include <boost/core/ignore_unused.hpp>
23 #include <boost/geometry/geometries/concepts/segment_concept.hpp>
25 #include <boost/geometry/geometries/point.hpp>
26 #include <boost/geometry/geometries/segment.hpp>
28 #include <boost/geometry/geometries/adapted/c_array.hpp>
29 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
32 #include <test_common/test_point.hpp>
33 #include <test_geometries/custom_segment.hpp>
35 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian
)
36 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian
)
42 typedef bg::model::referring_segment
<P
> S
;
47 BOOST_CHECK_EQUAL(&s
.first
, &p1
);
48 BOOST_CHECK_EQUAL(&s
.second
, &p2
);
50 // Compilation tests, all things should compile.
51 BOOST_CONCEPT_ASSERT( (bg::concepts::ConstSegment
<S
>) );
52 BOOST_CONCEPT_ASSERT( (bg::concepts::Segment
<S
>) );
54 typedef typename
bg::coordinate_type
<S
>::type T
;
55 typedef typename
bg::point_type
<S
>::type SP
;
56 boost::ignore_unused
<T
, SP
>();
58 //std::cout << sizeof(typename coordinate_type<S>::type) << std::endl;
60 typedef bg::model::referring_segment
<P
const> refseg_t
;
61 //BOOST_CONCEPT_ASSERT( (concepts::ConstSegment<refseg_t>) );
65 typedef typename
bg::coordinate_type
<refseg_t
>::type CT
;
66 typedef typename
bg::point_type
<refseg_t
>::type CSP
;
67 boost::ignore_unused
<CT
, CSP
>();
81 BOOST_CHECK_EQUAL((bg::get
<0, 0>(seg
)), 1);
82 BOOST_CHECK_EQUAL((bg::get
<0, 1>(seg
)), 2);
83 BOOST_CHECK_EQUAL((bg::get
<1, 0>(seg
)), 3);
84 BOOST_CHECK_EQUAL((bg::get
<1, 1>(seg
)), 4);
91 typedef bg::model::segment
<P
> S
;
92 constexpr S s
= S
{ {1, 2, 3}, {4, 5} };
93 constexpr auto c1
= bg::get
<0, 0>(s
);
94 constexpr auto c2
= bg::get
<1, 2>(s
);
95 BOOST_CHECK_EQUAL(c1
, 1);
96 BOOST_CHECK_EQUAL(c2
, 0);
97 BOOST_CHECK_EQUAL((bg::get
<0, 0>(s
)), 1);
98 BOOST_CHECK_EQUAL((bg::get
<0, 1>(s
)), 2);
99 BOOST_CHECK_EQUAL((bg::get
<0, 2>(s
)), 3);
100 BOOST_CHECK_EQUAL((bg::get
<1, 0>(s
)), 4);
101 BOOST_CHECK_EQUAL((bg::get
<1, 1>(s
)), 5);
102 BOOST_CHECK_EQUAL((bg::get
<1, 2>(s
)), 0);
106 int test_main(int, char* [])
109 test_all
<float[3]>();
110 test_all
<double[3]>();
111 //test_all<test_point>();
112 test_all
<bg::model::point
<int, 3, bg::cs::cartesian
> >();
113 test_all
<bg::model::point
<float, 3, bg::cs::cartesian
> >();
114 test_all
<bg::model::point
<double, 3, bg::cs::cartesian
> >();
116 test_custom
<test::custom_segment
>();
117 test_custom
<test::custom_segment_of
<bg::model::point
<double, 2, bg::cs::cartesian
> > >();
118 test_custom
<test::custom_segment_of
<test::custom_point_for_segment
> >();
119 test_custom
<test::custom_segment_4
>();
121 test_constexpr
<bg::model::point
<double, 3, bg::cs::cartesian
> >();