-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test with 3d orientation predicate.
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} |