-
Notifications
You must be signed in to change notification settings - Fork 218
/
Copy pathside3d.cpp
76 lines (67 loc) · 3.2 KB
/
side3d.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2020 Tinko Bartels, Berlin, Germany.
// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2020 program.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <array>
#include <geometry_test_common.hpp>
#include <boost/geometry/extensions/generic_robust_predicates/strategies/cartesian/detail/expressions.hpp>
#include <boost/geometry/extensions/generic_robust_predicates/strategies/cartesian/detail/stage_a.hpp>
template <typename CalculationType>
void test_all()
{
using bg::detail::generic_robust_predicates::orient3d;
using bg::detail::generic_robust_predicates::stage_a_semi_static;
using bg::detail::generic_robust_predicates::stage_a_almost_static;
using bg::detail::generic_robust_predicates::stage_a_static;
using ct = CalculationType;
using semi_static = stage_a_semi_static<orient3d, ct>;
BOOST_CHECK_EQUAL(1,
semi_static::apply(1, 0, 0,
0, 1, 0,
1, 1, 0,
0, 0, 1));
BOOST_CHECK_EQUAL(-1,
semi_static::apply(1, 0, 0,
0, 1, 0,
1, 1, 0,
0, 0, -1));
BOOST_CHECK_EQUAL(0,
semi_static::apply(1, 0, 0,
0, 1, 0,
1, 1, 0,
0, 0, 0));
stage_a_static<orient3d, ct> stat(10, 10, 10,
10, 10, 10,
10, 10, 10,
10, 10, 10,
0, 0, 0,
0, 0, 0,
0, 0, 0,
0, 0, 0);
BOOST_CHECK_EQUAL(1, stat.apply(1, 0, 0,
0, 1, 0,
1, 1, 0,
0, 0, 1));
stage_a_static<orient3d, ct> pessimistic(1e40, 1e40, 1e40,
1e40, 1e40, 1e40,
1e40, 1e40, 1e40,
1e40, 1e40, 1e40,
0, 0, 0,
0, 0, 0,
0, 0, 0,
0, 0, 0);
BOOST_CHECK_EQUAL(bg::detail::generic_robust_predicates::sign_uncertain,
pessimistic.apply(1, 0, 0,
0, 1, 0,
1, 1, 0,
0, 0, 1));
}
int test_main(int, char* [])
{
test_all<double>();
return 0;
}