]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/strategies/projected_point_ax.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / strategies / projected_point_ax.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
7
8 // This file was modified by Oracle on 2014.
9 // Modifications copyright (c) 2014, Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13
14 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
15 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
16
17 // Use, modification and distribution is subject to the Boost Software License,
18 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
19 // http://www.boost.org/LICENSE_1_0.txt)
20
21
22 #include <strategies/test_projected_point.hpp>
23
24
25 template <typename P1, typename P2>
26 void test_all_2d_ax()
27 {
28 typedef bg::strategy::distance::detail::projected_point_ax<> strategy_type;
29 typedef bg::strategy::distance::detail::projected_point_ax
30 <
31 void,
32 bg::strategy::distance::comparable::pythagoras<>
33 > comparable_strategy_type;
34
35 typedef typename strategy_type::result_type<P1, P2>::type result_type;
36
37 strategy_type strategy;
38 comparable_strategy_type comparable_strategy;
39 boost::ignore_unused(strategy);
40 boost::ignore_unused(comparable_strategy);
41
42 test_2d<P1, P2>("POINT(1 1)", "POINT(0 0)", "POINT(2 3)",
43 result_type(0, 0.27735203958327),
44 result_type(0, 0.27735203958327 * 0.27735203958327),
45 strategy, comparable_strategy);
46
47 test_2d<P1, P2>("POINT(2 2)", "POINT(1 4)", "POINT(4 1)",
48 result_type(0, 0.5 * sqrt(2.0)),
49 result_type(0, 0.5),
50 strategy, comparable_strategy);
51
52 test_2d<P1, P2>("POINT(6 1)", "POINT(1 4)", "POINT(4 1)",
53 result_type(sqrt(2.0), sqrt(2.0)),
54 result_type(2.0, 2.0),
55 strategy, comparable_strategy);
56
57 test_2d<P1, P2>("POINT(1 6)", "POINT(1 4)", "POINT(4 1)",
58 result_type(sqrt(2.0), sqrt(2.0)),
59 result_type(2.0, 2.0),
60 strategy, comparable_strategy);
61 }
62
63 template <typename P>
64 void test_all_2d_ax()
65 {
66 test_all_2d_ax<P, bg::model::point<int, 2, bg::cs::cartesian> >();
67 test_all_2d_ax<P, bg::model::point<float, 2, bg::cs::cartesian> >();
68 test_all_2d_ax<P, bg::model::point<double, 2, bg::cs::cartesian> >();
69 test_all_2d_ax<P, bg::model::point<long double, 2, bg::cs::cartesian> >();
70 }
71
72 int test_main(int, char* [])
73 {
74 test_all_2d_ax<bg::model::point<int, 2, bg::cs::cartesian> >();
75 test_all_2d_ax<bg::model::point<float, 2, bg::cs::cartesian> >();
76 test_all_2d_ax<bg::model::point<double, 2, bg::cs::cartesian> >();
77
78 #if defined(HAVE_TTMATH)
79 test_all_2d_ax
80 <
81 bg::model::point<ttmath_big, 2, bg::cs::cartesian>,
82 bg::model::point<ttmath_big, 2, bg::cs::cartesian>
83 >();
84 #endif
85
86
87 return 0;
88 }