mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
[test] enhance/fix robustness tests
This commit is contained in:
parent
e99cfde120
commit
716c791365
@ -1,7 +1,7 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2019-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// This file was modified by Oracle on 2021.
|
// This file was modified by Oracle on 2021.
|
||||||
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
||||||
@ -11,6 +11,8 @@
|
|||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -42,11 +44,22 @@ static std::string case_c[2] =
|
|||||||
"MULTIPOLYGON(((1 1,0 1,0 3,1 3,1 1)))"
|
"MULTIPOLYGON(((1 1,0 1,0 3,1 3,1 1)))"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct test_settings
|
||||||
|
{
|
||||||
|
bool verbose{false};
|
||||||
|
bool do_output{false};
|
||||||
|
|
||||||
|
// Settings currently not modifiable, and still giving quite some errors
|
||||||
|
double start_bound{1.0e-2};
|
||||||
|
double step_factor{50.0}; // on each side -> 100 steps per factor
|
||||||
|
int max_factor{10000};
|
||||||
|
};
|
||||||
|
|
||||||
template <bg::overlay_type OverlayType, typename Geometry>
|
template <bg::overlay_type OverlayType, typename Geometry>
|
||||||
bool test_overlay(std::string const& caseid,
|
bool test_overlay(std::string const& caseid,
|
||||||
Geometry const& g1, Geometry const& g2,
|
Geometry const& g1, Geometry const& g2,
|
||||||
double expected_area,
|
double expected_area,
|
||||||
bool do_output)
|
test_settings const& settings)
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef typename boost::range_value<Geometry>::type geometry_out;
|
typedef typename boost::range_value<Geometry>::type geometry_out;
|
||||||
@ -62,9 +75,9 @@ bool test_overlay(std::string const& caseid,
|
|||||||
OverlayType
|
OverlayType
|
||||||
> overlay;
|
> overlay;
|
||||||
|
|
||||||
typedef typename bg::strategy::intersection::services::default_strategy
|
typedef typename bg::strategies::relate::services::default_strategy
|
||||||
<
|
<
|
||||||
typename bg::cs_tag<Geometry>::type
|
Geometry, Geometry
|
||||||
>::type strategy_type;
|
>::type strategy_type;
|
||||||
|
|
||||||
strategy_type strategy;
|
strategy_type strategy;
|
||||||
@ -86,7 +99,7 @@ bool test_overlay(std::string const& caseid,
|
|||||||
const double detected_area = bg::area(result);
|
const double detected_area = bg::area(result);
|
||||||
if (std::fabs(detected_area - expected_area) > 0.01)
|
if (std::fabs(detected_area - expected_area) > 0.01)
|
||||||
{
|
{
|
||||||
if (do_output)
|
if (settings.do_output)
|
||||||
{
|
{
|
||||||
std::cout << "ERROR: " << caseid << std::setprecision(18)
|
std::cout << "ERROR: " << caseid << std::setprecision(18)
|
||||||
<< " detected=" << detected_area
|
<< " detected=" << detected_area
|
||||||
@ -118,9 +131,9 @@ template <bg::overlay_type OverlayType, typename MultiPolygon>
|
|||||||
std::size_t test_case(std::size_t& error_count,
|
std::size_t test_case(std::size_t& error_count,
|
||||||
std::size_t case_index, std::size_t i, std::size_t j,
|
std::size_t case_index, std::size_t i, std::size_t j,
|
||||||
std::size_t min_vertex_index, std::size_t max_vertex_index,
|
std::size_t min_vertex_index, std::size_t max_vertex_index,
|
||||||
double x, double y, double expectation,
|
double offset_x, double offset_y, double expectation,
|
||||||
MultiPolygon const& poly1, MultiPolygon const& poly2,
|
MultiPolygon const& poly1, MultiPolygon const& poly2,
|
||||||
bool do_output)
|
test_settings const settings)
|
||||||
{
|
{
|
||||||
std::size_t n = 0;
|
std::size_t n = 0;
|
||||||
for (std::size_t k = min_vertex_index; k <= max_vertex_index; k++, ++n)
|
for (std::size_t k = min_vertex_index; k <= max_vertex_index; k++, ++n)
|
||||||
@ -130,21 +143,23 @@ std::size_t test_case(std::size_t& error_count,
|
|||||||
switch (case_index)
|
switch (case_index)
|
||||||
{
|
{
|
||||||
case 2 :
|
case 2 :
|
||||||
update(bg::interior_rings(poly2_adapted.front()).front(), x, y, k);
|
update(bg::interior_rings(poly2_adapted.front()).front(), offset_x, offset_y, k);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
update(bg::exterior_ring(poly2_adapted.front()), x, y, k);
|
update(bg::exterior_ring(poly2_adapted.front()), offset_x, offset_y, k);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "case_" << i << "_" << j << "_" << k;
|
out << "case_" << i << "_" << j << "_" << k;
|
||||||
if (! test_overlay<OverlayType>(out.str(), poly1, poly2_adapted, expectation, do_output))
|
if (! test_overlay<OverlayType>(out.str(), poly1, poly2_adapted, expectation, settings))
|
||||||
{
|
{
|
||||||
if (error_count == 0)
|
if (error_count == 0 && ! settings.do_output)
|
||||||
{
|
{
|
||||||
// First failure is always reported
|
// First failure is always reported
|
||||||
test_overlay<OverlayType>(out.str(), poly1, poly2_adapted, expectation, true);
|
test_settings adapted = settings;
|
||||||
|
adapted.do_output = true;
|
||||||
|
test_overlay<OverlayType>(out.str(), poly1, poly2_adapted, expectation, adapted);
|
||||||
}
|
}
|
||||||
error_count++;
|
error_count++;
|
||||||
}
|
}
|
||||||
@ -155,7 +170,7 @@ std::size_t test_case(std::size_t& error_count,
|
|||||||
template <typename T, bool Clockwise, bg::overlay_type OverlayType>
|
template <typename T, bool Clockwise, bg::overlay_type OverlayType>
|
||||||
std::size_t test_all(std::size_t case_index, std::size_t min_vertex_index,
|
std::size_t test_all(std::size_t case_index, std::size_t min_vertex_index,
|
||||||
std::size_t max_vertex_index,
|
std::size_t max_vertex_index,
|
||||||
double expectation, bool do_output)
|
double expectation, test_settings const& settings)
|
||||||
{
|
{
|
||||||
typedef bg::model::point<T, 2, bg::cs::cartesian> point_type;
|
typedef bg::model::point<T, 2, bg::cs::cartesian> point_type;
|
||||||
typedef bg::model::polygon<point_type, Clockwise> polygon;
|
typedef bg::model::polygon<point_type, Clockwise> polygon;
|
||||||
@ -177,21 +192,25 @@ std::size_t test_all(std::size_t case_index, std::size_t min_vertex_index,
|
|||||||
|
|
||||||
std::size_t error_count = 0;
|
std::size_t error_count = 0;
|
||||||
std::size_t n = 0;
|
std::size_t n = 0;
|
||||||
for (double factor = 1.0; factor > 1.0e-10; factor /= 10.0)
|
for (int factor = 1; factor < settings.max_factor; factor *= 2)
|
||||||
{
|
{
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
double const bound = 1.0e-5 * factor;
|
double const bound = settings.start_bound / factor;
|
||||||
double const step = 1.0e-6 * factor;
|
double const step = bound / settings.step_factor;
|
||||||
for (double x = -bound; x <= bound; x += step, ++i)
|
if (settings.verbose)
|
||||||
|
{
|
||||||
|
std::cout << "--> use " << bound << " " << step << std::endl;
|
||||||
|
}
|
||||||
|
for (double offset_x = -bound; offset_x <= bound; offset_x += step, ++i)
|
||||||
{
|
{
|
||||||
std::size_t j = 0;
|
std::size_t j = 0;
|
||||||
for (double y = -bound; y <= bound; y += step, ++j, ++n)
|
for (double offset_y = -bound; offset_y <= bound; offset_y += step, ++j, ++n)
|
||||||
{
|
{
|
||||||
n += test_case<OverlayType>(error_count,
|
n += test_case<OverlayType>(error_count,
|
||||||
case_index, i, j,
|
case_index, i, j,
|
||||||
min_vertex_index, max_vertex_index,
|
min_vertex_index, max_vertex_index,
|
||||||
x, y, expectation,
|
offset_x, offset_y, expectation,
|
||||||
poly1, poly2, do_output);
|
poly1, poly2, settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,22 +224,17 @@ std::size_t test_all(std::size_t case_index, std::size_t min_vertex_index,
|
|||||||
|
|
||||||
int test_main(int argc, char** argv)
|
int test_main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
typedef double coordinate_type;
|
BoostGeometryWriteTestConfiguration();
|
||||||
|
using coor_t = default_test_type;
|
||||||
|
|
||||||
const double factor = argc > 1 ? atof(argv[1]) : 2.0;
|
test_settings settings;
|
||||||
const bool do_output = argc > 2 && atol(argv[2]) == 1;
|
settings.do_output = argc > 2 && atol(argv[2]) == 1;
|
||||||
|
|
||||||
std::cout << std::endl << " -> TESTING "
|
// Test three polygons, for the last test two types of intersections
|
||||||
<< string_from_type<coordinate_type>::name()
|
test_all<coor_t, true, bg::overlay_union>(1, 0, 3, 22.0, settings);
|
||||||
<< " " << factor
|
test_all<coor_t, true, bg::overlay_union>(2, 0, 3, 73.0, settings);
|
||||||
<< std::endl;
|
test_all<coor_t, true, bg::overlay_intersection>(3, 1, 2, 2.0, settings);
|
||||||
|
test_all<coor_t, true, bg::overlay_union>(3, 1, 2, 14.0, settings);
|
||||||
test_all<coordinate_type, true, bg::overlay_union>(1, 0, 3, 22.0, do_output);
|
|
||||||
test_all<coordinate_type, true, bg::overlay_union>(2, 0, 3, 73.0, do_output);
|
|
||||||
test_all<coordinate_type, true, bg::overlay_intersection>(3, 1, 2, 2.0, do_output);
|
|
||||||
test_all<coordinate_type, true, bg::overlay_union>(3, 1, 2, 14.0, do_output);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
|
// NOTE: there is no randomness here. Count is to measure performance
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -113,8 +117,10 @@ int main(int argc, char** argv)
|
|||||||
("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
|
("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
|
||||||
("offset", po::value<int>(&offset)->default_value(0), "Offset of second triangle in x-direction")
|
("offset", po::value<int>(&offset)->default_value(0), "Offset of second triangle in x-direction")
|
||||||
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
@ -129,6 +135,7 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<default_test_type, false, false>(count, count_x, count_y, offset, settings);
|
test_all<default_test_type, false, false>(count, count_x, count_y, offset, settings);
|
||||||
@ -142,6 +149,7 @@ int main(int argc, char** argv)
|
|||||||
test_all<default_test_type, true, false>(count, count_x, count_y, offset, settings);
|
test_all<default_test_type, true, false>(count, count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_all<default_test_type, true, true>(count, count_x, count_y, offset, settings);
|
test_all<default_test_type, true, true>(count, count_x, count_y, offset, settings);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -256,8 +258,10 @@ int main(int argc, char** argv)
|
|||||||
("help", "Help message")
|
("help", "Help message")
|
||||||
("multi", po::value<bool>(&multi)->default_value(false), "Multiple tangencies at one point")
|
("multi", po::value<bool>(&multi)->default_value(false), "Multiple tangencies at one point")
|
||||||
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
@ -273,6 +277,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// template par's are: CoordinateType, Clockwise, Closed
|
// template par's are: CoordinateType, Clockwise, Closed
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<default_test_type, false, false>(multi, single_selftangent, settings);
|
test_all<default_test_type, false, false>(multi, single_selftangent, settings);
|
||||||
@ -286,6 +291,7 @@ int main(int argc, char** argv)
|
|||||||
test_all<default_test_type, true, false>(multi, single_selftangent, settings);
|
test_all<default_test_type, true, false>(multi, single_selftangent, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_all<default_test_type, true, true>(multi, single_selftangent, settings);
|
test_all<default_test_type, true, true>(multi, single_selftangent, settings);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
|
// NOTE: there is no randomness here. Count is to measure performance
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -109,12 +113,14 @@ void test_type(int count, int min_points, int max_points, T rotation, p_q_settin
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void test_all(std::string const& type, int count, int min_points, int max_points, T rotation, p_q_settings settings)
|
void test_all(std::string const& type, int count, int min_points, int max_points, T rotation, p_q_settings settings)
|
||||||
{
|
{
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (type == "float")
|
if (type == "float")
|
||||||
{
|
{
|
||||||
settings.tolerance = 1.0e-3;
|
settings.tolerance = 1.0e-3;
|
||||||
test_type<float, float>(count, min_points, max_points, rotation, settings);
|
test_type<float, float>(count, min_points, max_points, rotation, settings);
|
||||||
}
|
}
|
||||||
else if (type == "double")
|
else if (type == "double")
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_type<double, double>(count, min_points, max_points, rotation, settings);
|
test_type<double, double>(count, min_points, max_points, rotation, settings);
|
||||||
}
|
}
|
||||||
@ -130,7 +136,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
//int seed = static_cast<unsigned int>(std::time(0));
|
//int seed = static_cast<unsigned int>(std::time(0));
|
||||||
std::string type = "float";
|
std::string type = "double";
|
||||||
int min_points = 9;
|
int min_points = 9;
|
||||||
int max_points = 9;
|
int max_points = 9;
|
||||||
bool ccw = false;
|
bool ccw = false;
|
||||||
@ -140,15 +146,17 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
description.add_options()
|
description.add_options()
|
||||||
("help", "Help message")
|
("help", "Help message")
|
||||||
//("seed", po::value<int>(&seed), "Initialization seed for random generator")
|
// ("seed", po::value<int>(&seed), "Initialization seed for random generator")
|
||||||
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
||||||
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
||||||
("min_points", po::value<int>(&min_points)->default_value(9), "Minimum number of points")
|
("min_points", po::value<int>(&min_points)->default_value(9), "Minimum number of points")
|
||||||
("max_points", po::value<int>(&max_points)->default_value(9), "Maximum number of points")
|
("max_points", po::value<int>(&max_points)->default_value(9), "Maximum number of points")
|
||||||
("rotation", po::value<double>(&rotation)->default_value(1.0e-13), "Rotation angle")
|
("rotation", po::value<double>(&rotation)->default_value(1.0e-13), "Rotation angle")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
("type", po::value<std::string>(&type)->default_value("float"), "Type (float,double)")
|
("type", po::value<std::string>(&type)->default_value("double"), "Type (float,double)")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2011-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2011-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
|
// NOTE: there is no randomness here. Count is to measure performance
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -43,9 +47,8 @@ inline void make_polygon(MultiPolygon& mp, int count_x, int count_y, int index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename MultiPolygon>
|
template <typename MultiPolygon>
|
||||||
void test_intersects(int count_x, int count_y, int width_x, p_q_settings const& settings)
|
void test_intersects(int index, int count_x, int count_y, int width_x, p_q_settings const& settings)
|
||||||
{
|
{
|
||||||
MultiPolygon mp;
|
MultiPolygon mp;
|
||||||
|
|
||||||
@ -64,6 +67,10 @@ void test_intersects(int count_x, int count_y, int width_x, p_q_settings const&
|
|||||||
std::ostringstream filename;
|
std::ostringstream filename;
|
||||||
filename << "intersects_"
|
filename << "intersects_"
|
||||||
<< string_from_type<coordinate_type>::name()
|
<< string_from_type<coordinate_type>::name()
|
||||||
|
<< "_" << index
|
||||||
|
<< "_" << count_x
|
||||||
|
<< "_" << count_y
|
||||||
|
<< "_" << width_x
|
||||||
<< ".svg";
|
<< ".svg";
|
||||||
|
|
||||||
std::ofstream svg(filename.str().c_str());
|
std::ofstream svg(filename.str().c_str());
|
||||||
@ -92,7 +99,7 @@ void test_all(int count, int count_x, int count_y, int width_x, p_q_settings con
|
|||||||
|
|
||||||
for(int i = 0; i < count; i++)
|
for(int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
test_intersects<multi_polygon>(count_x, count_y, width_x, settings);
|
test_intersects<multi_polygon>(i, count_x, count_y, width_x, settings);
|
||||||
}
|
}
|
||||||
auto const t = std::chrono::high_resolution_clock::now();
|
auto const t = std::chrono::high_resolution_clock::now();
|
||||||
auto const elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(t - t0).count();
|
auto const elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(t - t0).count();
|
||||||
@ -123,8 +130,10 @@ int main(int argc, char** argv)
|
|||||||
("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
|
("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
|
||||||
("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
|
("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
|
||||||
("width_x", po::value<int>(&width_x)->default_value(7), "Width of triangle in x-direction")
|
("width_x", po::value<int>(&width_x)->default_value(7), "Width of triangle in x-direction")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
@ -139,6 +148,7 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<default_test_type, false, false>(count, count_x, count_y, width_x, settings);
|
test_all<default_test_type, false, false>(count, count_x, count_y, width_x, settings);
|
||||||
@ -152,6 +162,7 @@ int main(int argc, char** argv)
|
|||||||
test_all<default_test_type, true, false>(count, count_x, count_y, width_x, settings);
|
test_all<default_test_type, true, false>(count, count_x, count_y, width_x, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_all<default_test_type, true, true>(count, count_x, count_y, width_x, settings);
|
test_all<default_test_type, true, true>(count, count_x, count_y, width_x, settings);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -166,11 +168,13 @@ void test_type(int seed, int count, p_q_settings const& settings)
|
|||||||
template <bool Clockwise, bool Closed>
|
template <bool Clockwise, bool Closed>
|
||||||
void test_all(std::string const& type, int seed, int count, p_q_settings settings)
|
void test_all(std::string const& type, int seed, int count, p_q_settings settings)
|
||||||
{
|
{
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (type == "float")
|
if (type == "float")
|
||||||
{
|
{
|
||||||
test_type<float, Clockwise, Closed>(seed, count, settings);
|
test_type<float, Clockwise, Closed>(seed, count, settings);
|
||||||
}
|
}
|
||||||
else if (type == "double")
|
else if (type == "double")
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_type<double, Clockwise, Closed>(seed, count, settings);
|
test_type<double, Clockwise, Closed>(seed, count, settings);
|
||||||
}
|
}
|
||||||
@ -187,7 +191,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
int seed = static_cast<unsigned int>(std::time(0));
|
int seed = static_cast<unsigned int>(std::time(0));
|
||||||
std::string type = "float";
|
std::string type = "double";
|
||||||
bool ccw = false;
|
bool ccw = false;
|
||||||
bool open = false;
|
bool open = false;
|
||||||
p_q_settings settings;
|
p_q_settings settings;
|
||||||
@ -197,9 +201,11 @@ int main(int argc, char** argv)
|
|||||||
("seed", po::value<int>(&seed), "Initialization seed for random generator")
|
("seed", po::value<int>(&seed), "Initialization seed for random generator")
|
||||||
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
||||||
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
("type", po::value<std::string>(&type)->default_value("float"), "Type (float,double)")
|
("type", po::value<std::string>(&type)->default_value("double"), "Type (float,double)")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
@ -214,6 +220,7 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<false, false>(type, seed, count, settings);
|
test_all<false, false>(type, seed, count, settings);
|
||||||
@ -227,6 +234,7 @@ int main(int argc, char** argv)
|
|||||||
test_all<true, false>(type, seed, count, settings);
|
test_all<true, false>(type, seed, count, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_all<true, true>(type, seed, count, settings);
|
test_all<true, true>(type, seed, count, settings);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -174,8 +176,10 @@ int main(int argc, char** argv)
|
|||||||
("level", po::value<int>(&level)->default_value(3), "Level to reach (higher->slower)")
|
("level", po::value<int>(&level)->default_value(3), "Level to reach (higher->slower)")
|
||||||
("size", po::value<int>(&field_size)->default_value(10), "Size of the field")
|
("size", po::value<int>(&field_size)->default_value(10), "Size of the field")
|
||||||
("form", po::value<std::string>(&form)->default_value("box"), "Form of the polygons (box, triangle)")
|
("form", po::value<std::string>(&form)->default_value("box"), "Form of the polygons (box, triangle)")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
@ -193,7 +197,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
bool triangular = form != "box";
|
bool triangular = form != "box";
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<default_test_type, false, false>(seed, count, field_size, level, triangular, settings);
|
test_all<default_test_type, false, false>(seed, count, field_size, level, triangular, settings);
|
||||||
@ -207,6 +211,7 @@ int main(int argc, char** argv)
|
|||||||
test_all<default_test_type, true, false>(seed, count, field_size, level, triangular, settings);
|
test_all<default_test_type, true, false>(seed, count, field_size, level, triangular, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_all<default_test_type, true, true>(seed, count, field_size, level, triangular, settings);
|
test_all<default_test_type, true, true>(seed, count, field_size, level, triangular, settings);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
#include <test_overlay_p_q.hpp>
|
#include <test_overlay_p_q.hpp>
|
||||||
|
|
||||||
@ -98,8 +100,10 @@ int main(int argc, char** argv)
|
|||||||
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
("count", po::value<int>(&count)->default_value(1), "Number of tests")
|
||||||
("point_count", po::value<int>(&point_count)->default_value(1), "Number of points in the star")
|
("point_count", po::value<int>(&point_count)->default_value(1), "Number of points in the star")
|
||||||
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
("diff", po::value<bool>(&settings.also_difference)->default_value(false), "Include testing on difference")
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
|
||||||
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
("open", po::value<bool>(&open)->default_value(false), "Open polygons")
|
||||||
|
#endif
|
||||||
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
|
||||||
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
|
||||||
;
|
;
|
||||||
@ -117,7 +121,7 @@ int main(int argc, char** argv)
|
|||||||
int star_point_count = point_count * 2 + 1;
|
int star_point_count = point_count * 2 + 1;
|
||||||
int comb_comb_count = point_count;
|
int comb_comb_count = point_count;
|
||||||
|
|
||||||
|
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||||
if (ccw && open)
|
if (ccw && open)
|
||||||
{
|
{
|
||||||
test_all<default_test_type, false, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
|
test_all<default_test_type, false, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
|
||||||
@ -131,6 +135,7 @@ int main(int argc, char** argv)
|
|||||||
test_all<default_test_type, true, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
|
test_all<default_test_type, true, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
test_all<default_test_type, true, true>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
|
test_all<default_test_type, true, true>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2009-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// This file was modified by Oracle on 2021.
|
// This file was modified by Oracle on 2021.
|
||||||
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
||||||
@ -40,21 +40,16 @@
|
|||||||
|
|
||||||
struct p_q_settings
|
struct p_q_settings
|
||||||
{
|
{
|
||||||
bool svg;
|
bool svg{false};
|
||||||
bool also_difference;
|
bool also_difference{false};
|
||||||
bool validity;
|
bool validity{false};
|
||||||
bool wkt;
|
bool wkt{false};
|
||||||
bool verify_area;
|
bool verify_area{false};
|
||||||
double tolerance;
|
double tolerance{1.0e-3};
|
||||||
|
bool verbose{false};
|
||||||
|
|
||||||
p_q_settings()
|
// NOTE: since rescaling to integer the tolerance is less.
|
||||||
: svg(false)
|
// Was originally 1.0e-6 TODO: restore
|
||||||
, also_difference(false)
|
|
||||||
, validity(false)
|
|
||||||
, wkt(false)
|
|
||||||
, verify_area(false)
|
|
||||||
, tolerance(1.0e-3) // since rescaling to integer the tolerance should be less. Was originally 1.0e-6
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Geometry>
|
template <typename Geometry>
|
||||||
@ -209,6 +204,7 @@ static bool test_overlay_p_q(std::string const& caseid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool svg = settings.svg;
|
bool svg = settings.svg;
|
||||||
|
bool wkt = settings.wkt;
|
||||||
|
|
||||||
if (wrong || settings.wkt)
|
if (wrong || settings.wkt)
|
||||||
{
|
{
|
||||||
@ -216,53 +212,66 @@ static bool test_overlay_p_q(std::string const& caseid,
|
|||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
svg = true;
|
svg = true;
|
||||||
|
wkt = true;
|
||||||
}
|
}
|
||||||
bg::unique(out_i);
|
|
||||||
bg::unique(out_u);
|
|
||||||
|
|
||||||
std::cout
|
if (settings.verbose)
|
||||||
<< "type: " << string_from_type<CalculationType>::name()
|
|
||||||
<< " id: " << caseid
|
|
||||||
<< " area i: " << area_i
|
|
||||||
<< " area u: " << area_u
|
|
||||||
<< " area p: " << area_p
|
|
||||||
<< " area q: " << area_q
|
|
||||||
<< " sum: " << sum;
|
|
||||||
|
|
||||||
if (settings.also_difference)
|
|
||||||
{
|
{
|
||||||
std::cout
|
std::cout
|
||||||
<< " area d1: " << area_d1
|
<< "type: " << string_from_type<CalculationType>::name()
|
||||||
<< " area d2: " << area_d2;
|
<< " id: " << caseid
|
||||||
}
|
<< " area i: " << area_i
|
||||||
std::cout
|
<< " area u: " << area_u
|
||||||
<< std::endl
|
<< " area p: " << area_p
|
||||||
<< std::setprecision(9)
|
<< " area q: " << area_q
|
||||||
<< " p: " << bg::wkt(p) << std::endl
|
<< " sum: " << sum;
|
||||||
<< " q: " << bg::wkt(q) << std::endl
|
|
||||||
<< " i: " << bg::wkt(out_i) << std::endl
|
|
||||||
<< " u: " << bg::wkt(out_u) << std::endl
|
|
||||||
;
|
|
||||||
|
|
||||||
|
if (settings.also_difference)
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< " area d1: " << area_d1
|
||||||
|
<< " area d2: " << area_d2;
|
||||||
|
}
|
||||||
|
std::cout
|
||||||
|
<< std::endl
|
||||||
|
<< std::setprecision(9)
|
||||||
|
<< " p: " << bg::wkt(p) << std::endl
|
||||||
|
<< " q: " << bg::wkt(q) << std::endl
|
||||||
|
<< " i: " << bg::wkt(out_i) << std::endl
|
||||||
|
<< " u: " << bg::wkt(out_u) << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(svg)
|
std::string filename;
|
||||||
{
|
{
|
||||||
std::ostringstream filename;
|
std::ostringstream out;
|
||||||
filename << "overlay_" << caseid << "_"
|
out << "overlay_" << caseid << "_"
|
||||||
<< string_from_type<coordinate_type>::name();
|
<< string_from_type<coordinate_type>::name();
|
||||||
if (!std::is_same<coordinate_type, CalculationType>::value)
|
if (!std::is_same<coordinate_type, CalculationType>::value)
|
||||||
{
|
{
|
||||||
filename << string_from_type<CalculationType>::name();
|
out << string_from_type<CalculationType>::name();
|
||||||
}
|
}
|
||||||
|
out
|
||||||
filename
|
|
||||||
#if defined(BOOST_GEOMETRY_USE_RESCALING)
|
#if defined(BOOST_GEOMETRY_USE_RESCALING)
|
||||||
<< "_rescaled"
|
<< "_rescaled"
|
||||||
#endif
|
#endif
|
||||||
<< ".svg";
|
<< ".";
|
||||||
|
filename = out.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::ofstream svg(filename.str().c_str());
|
if (wkt)
|
||||||
|
{
|
||||||
|
std::ofstream stream(filename + "wkt");
|
||||||
|
// Stream input WKT's
|
||||||
|
stream << bg::wkt(p) << std::endl;
|
||||||
|
stream << bg::wkt(q) << std::endl;
|
||||||
|
// If you need the output WKT, then stream out_i and out_u
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (svg)
|
||||||
|
{
|
||||||
|
std::ofstream svg(filename + "svg");
|
||||||
|
|
||||||
bg::svg_mapper<point_type> mapper(svg, 500, 500);
|
bg::svg_mapper<point_type> mapper(svg, 500, 500);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||||
// Robustness Test
|
// Robustness Test
|
||||||
|
|
||||||
// Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2012-2021 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// This file was modified by Oracle on 2015-2021.
|
// This file was modified by Oracle on 2015-2021.
|
||||||
// Modifications copyright (c) 2015-2021 Oracle and/or its affiliates.
|
// Modifications copyright (c) 2015-2021 Oracle and/or its affiliates.
|
||||||
@ -13,6 +13,8 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||||
|
#define BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||||
|
#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# pragma warning( disable : 4244 )
|
# pragma warning( disable : 4244 )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user