Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ build-project algorithms ;
build-project gis ;
build-project iterators ;
build-project nsphere ;

build-project triangulation ;
12 changes: 12 additions & 0 deletions extensions/test/triangulation/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Boost.Geometry (aka GGL, Generic Geometry Library)
#
# 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)

test-suite boost-geometry-extensions-triangulation
:
[ run side_robust.cpp ]
[ run in_circle_robust.cpp ]
;

59 changes: 59 additions & 0 deletions extensions/test/triangulation/in_circle_robust.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 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 <geometry_test_common.hpp>

#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/extensions/triangulation/strategies/cartesian/in_circle_robust.hpp>

template <typename P>
void test_all()
{
typedef bg::strategy::in_circle::in_circle_robust<double, 2> inc2;
typedef bg::strategy::in_circle::in_circle_robust<double, 1> inc1;
typedef bg::strategy::in_circle::in_circle_robust<double, 0> inc0;

P col1(0.0, 0.0), col2(1.0, 0.0), col3(0.0, 1.0);
P in(0.5,0.5) , on(1.0, 0.0), out(-0.5, -0.5);
int in2 = inc2::apply(col1, col2, col3, in);
BOOST_CHECK_GT(in2, 0);
int in1 = inc1::apply(col1, col2, col3, in);
BOOST_CHECK_GT(in1, 0);
int in0 = inc0::apply(col1, col2, col3, in);
BOOST_CHECK_GT(in0, 0);

int on2 = inc2::apply(col1, col2, col3, on);
BOOST_CHECK_EQUAL(on2, 0);
int on1 = inc1::apply(col1, col2, col3, on);
BOOST_CHECK_EQUAL(on1, 0);
int on0 = inc0::apply(col1, col2, col3, on);
BOOST_CHECK_EQUAL(on0, 0);

int out2 = inc2::apply(col1, col2, col3, out);
BOOST_CHECK_GT(0, out2);
int out1 = inc1::apply(col1, col2, col3, out);
BOOST_CHECK_GT(0, out1);
int out0 = inc0::apply(col1, col2, col3, out);
BOOST_CHECK_GT(0, out0);

P hard1(0, 0), hard2(1e20, 0), hard3(0, 1e20);
P inhard(0.5, 0.5);
int hardr = inc2::apply(hard1, hard2, hard3, inhard);
BOOST_CHECK_GT(hardr, 0);
}


int test_main(int, char* [])
{
test_all<bg::model::d2::point_xy<double> >();
return 0;
}
62 changes: 62 additions & 0 deletions extensions/test/triangulation/side_robust.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 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 <geometry_test_common.hpp>

#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/extensions/triangulation/strategies/cartesian/side_robust.hpp>

template <typename P>
void test_all()
{
typedef bg::strategy::side::side_robust<double, 3> side3;
typedef bg::strategy::side::side_robust<double, 2> side2;
typedef bg::strategy::side::side_robust<double, 1> side1;
typedef bg::strategy::side::side_robust<double, 0> side0;

P col1(1.0, 1.0), col2(2.0, 2.0), col3(3.0, 3.0);
int col3r = side3::apply(col1, col2, col3);
BOOST_CHECK_EQUAL(0, col3r);
int col2r = side2::apply(col1, col2, col3);
BOOST_CHECK_EQUAL(0, col2r);
int col1r = side1::apply(col1, col2, col3);
BOOST_CHECK_EQUAL(0, col1r);
int col0r = side0::apply(col1, col2, col3);
BOOST_CHECK_EQUAL(0, col0r);

P easy1(0.0, 0.0), easy2(1.0, 1.0), easy3(0.0, 1.0);
int easy3r = side3::apply(easy1, easy2, easy3);
BOOST_CHECK_GT(easy3r, 0);
int easy2r = side2::apply(easy1, easy2, easy3);
BOOST_CHECK_GT(easy2r, 0);
int easy1r = side1::apply(easy1, easy2, easy3);
BOOST_CHECK_GT(easy1r, 0);
int easy0r = side0::apply(easy1, easy2, easy3);
BOOST_CHECK_GT(easy0r, 0);

P medium1(1.0, 1.0), medium2(1.0e20, 1.0e20), medium3(1.0, 2.0);
int medium3r = side3::apply(medium1, medium2, medium3);
BOOST_CHECK_GT(medium3r, 0);
int medium2r = side2::apply(medium1, medium2, medium3);
BOOST_CHECK_GT(medium2r, 0);

P hard1(1.0e-20, 1.0e-20), hard2(1.0e20, 1.0e20), hard3(1.0, 2.0);
int hard3r = side3::apply(hard1, hard2, hard3);
BOOST_CHECK_GT(hard3r, 0);
}


int test_main(int, char* [])
{
test_all<bg::model::d2::point_xy<double> >();
return 0;
}
Loading