mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
[test][doc] Clean up numeric types in tests and adapt documentation
This commit is contained in:
parent
a4b2e6195e
commit
3272220a3c
@ -57,20 +57,7 @@ a <a href="http://en.wikipedia.org/wiki/Long_double">long double</a>, not standa
|
||||
|
||||
By default, algorithms select the coordinate type of the input geometries. If there are two input geometries, and they have different coordinate types, the coordinate type with the most precision is selected. This is done by the meta-function \b select_most_precise.
|
||||
|
||||
Boost.Geometry supports also high precision arithmetic types, by adaption. The numeric_adaptor, used for adaption, is not part of Boost.Geometry itself but developed by us and sent (as preview) to the Boost List (as it turned out, that functionality might also be provided by Boost.Math bindings, but the mechanism is the same). Types from the following libraries are supported:
|
||||
|
||||
- GMP (http://gmplib.org)
|
||||
- CLN (http://www.ginac.de/CLN)
|
||||
|
||||
Note that the libraries themselves are not included in Boost.Geometry, they are completely independant of each other.
|
||||
|
||||
These numeric types can be used as following:
|
||||
\code
|
||||
boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> p4;
|
||||
boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> p5;
|
||||
\endcode
|
||||
|
||||
All algorithms using these points will use the \b GMP resp. \b CLN library for calculations.
|
||||
Boost.Geometry supports also high precision arithmetic types, by adaption. For example from Boost.Multiprecision.
|
||||
|
||||
\section robustness_par4 Calculation types
|
||||
|
||||
@ -81,21 +68,21 @@ Example:
|
||||
|
||||
\code
|
||||
{
|
||||
typedef boost::geometry::point_xy<double> point_type;
|
||||
boost::geometry::linear_ring<point_type> ring;
|
||||
using point_type = bg::model::point<default_test_type, 2, bg::cs::cartesian> ;
|
||||
boost::geometry::model::ring<point_type> ring;
|
||||
ring.push_back(boost::geometry::make<point_type>(0.0, 0.0));
|
||||
ring.push_back(boost::geometry::make<point_type>(0.0, 0.0012));
|
||||
ring.push_back(boost::geometry::make<point_type>(1234567.89012345, 0.0));
|
||||
ring.push_back(ring.front());
|
||||
|
||||
typedef boost::numeric_adaptor::gmp_value_type gmp;
|
||||
using mp = boost::multiprecision::cpp_bin_float_100;
|
||||
|
||||
gmp area = boost::geometry::area(ring, boost::geometry::strategy::area::by_triangles<point_type, gmp>());
|
||||
auto area = boost::geometry::area(ring, boost::geometry::strategies::area::cartesian<mp>());
|
||||
std::cout << area << std::endl;
|
||||
}
|
||||
\endcode
|
||||
|
||||
Above shows how this is used to use \b GMP or \b CLN for double coordinates. Exactly the same mechanism works (of course) also to do calculation in double, where coordinates are stored in float.
|
||||
Above shows how this is used to use Boost.Multiprecision with double coordinates. Exactly the same mechanism works (of course) also to do calculation in double, where coordinates are stored in float.
|
||||
|
||||
\section robustness_par5 Strategies
|
||||
|
||||
|
@ -66,8 +66,5 @@ int test_main(int, char* [])
|
||||
test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -390,10 +390,6 @@ void test_invalid()
|
||||
test_one<linestring, polygon>("mysql_report_2015_04_10g", mysql_report_2015_04_10g, join_round32, end_round32, 86527.871, 100.0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
#include <ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
|
@ -534,7 +534,11 @@ int test_main(int, char* [])
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_ORDER)
|
||||
test_all<false, bg::model::point<default_test_type, 2, bg::cs::cartesian> >();
|
||||
#endif
|
||||
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
test_all<true, bg::model::point<mp_test_type, 2, bg::cs::cartesian> >();
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
BoostGeometryWriteExpectedFailures(1, 1);
|
||||
#endif
|
||||
|
@ -137,7 +137,7 @@ void test_rectangle_properties()
|
||||
"piece should not be empty");
|
||||
|
||||
// Check border-properties functionality (envelope, radius)
|
||||
double const area = bg::area(border.m_envelope);
|
||||
auto const area = bg::area(border.m_envelope);
|
||||
BOOST_CHECK_MESSAGE(area > 1.0 && area < 1.01,
|
||||
"detected: " << area);
|
||||
|
||||
|
@ -212,12 +212,11 @@ public :
|
||||
OutputRange& output_range)
|
||||
{
|
||||
// Generate a block along (left or right of) the segment
|
||||
|
||||
double const dx = bg::get<0>(input_p2) - bg::get<0>(input_p1);
|
||||
double const dy = bg::get<1>(input_p2) - bg::get<1>(input_p1);
|
||||
auto const dx = bg::get<0>(input_p2) - bg::get<0>(input_p1);
|
||||
auto const dy = bg::get<1>(input_p2) - bg::get<1>(input_p1);
|
||||
|
||||
// For normalization [0,1] (=dot product d.d, sqrt)
|
||||
double const length = bg::math::sqrt(dx * dx + dy * dy);
|
||||
auto const length = bg::math::sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (bg::math::equals(length, 0))
|
||||
{
|
||||
@ -225,9 +224,9 @@ public :
|
||||
}
|
||||
|
||||
// Generate the perpendicular p, to the left (ccw), and use an adapted distance
|
||||
double const d = 1.1 * distance.apply(input_p1, input_p2, side);
|
||||
double const px = d * -dy / length;
|
||||
double const py = d * dx / length;
|
||||
auto const d = 1.1 * distance.apply(input_p1, input_p2, side);
|
||||
auto const px = d * -dy / length;
|
||||
auto const py = d * dx / length;
|
||||
|
||||
output_range.resize(2);
|
||||
|
||||
@ -835,10 +834,6 @@ void test_mixed()
|
||||
simplex, join_round, end_flat, 47.4831, 1.5);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
#include <ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
BoostGeometryWriteTestConfiguration();
|
||||
@ -867,11 +862,6 @@ int test_main(int, char* [])
|
||||
test_mixed<dpoint, dpoint, false, true, false, true>();
|
||||
test_mixed<dpoint, dpoint, true, false, false, true>();
|
||||
test_mixed<dpoint, dpoint, true, true, false, true>();
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
test_all<bg::model::point<tt, 2, bg::cs::cartesian> >();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
|
@ -74,8 +74,8 @@ void test_with_strategies(std::string const& caseid,
|
||||
<< " detected: " << bg::num_points(result)
|
||||
);
|
||||
|
||||
double const area = bg::area(result);
|
||||
double const difference = area - expected_area;
|
||||
auto const area = bg::area(result);
|
||||
auto const difference = area - expected_area;
|
||||
|
||||
BOOST_CHECK_MESSAGE
|
||||
(
|
||||
|
@ -1,208 +0,0 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
|
||||
// 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)
|
||||
|
||||
#error This unit test is not updated for several years
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4267 )
|
||||
#endif
|
||||
|
||||
//#define GEOMETRY_DEBUG_INTERSECTION
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/numeric_adaptor/numeric_adaptor.hpp>
|
||||
#include <boost/numeric_adaptor/gmp_value_type.hpp>
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/geometry/io/wkt/wkt.hpp>
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_traverse(std::string const& caseid, G1 const& g1, G2 const& g2)
|
||||
{
|
||||
typedef bg::detail::intersection::intersection_point
|
||||
<typename bg::point_type<G2>::type> ip;
|
||||
typedef typename boost::range_const_iterator<std::vector<ip> >::type iterator;
|
||||
typedef std::vector<ip> ip_vector;
|
||||
ip_vector ips;
|
||||
|
||||
typedef typename bg::strategy::side::services::default_strategy
|
||||
<
|
||||
typename bg::cs_tag<G1>::type
|
||||
>::type strategy_type;
|
||||
|
||||
|
||||
typedef bg::detail::overlay::traversal_turn_info
|
||||
<
|
||||
typename bg::point_type<G2>::type
|
||||
> turn_info;
|
||||
typedef typename boost::range_iterator<const std::vector<turn_info> >::type iterator;
|
||||
std::vector<turn_info> ips;
|
||||
|
||||
bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(g1, g2, ips);
|
||||
bg::enrich_intersection_points(ips, g1, g2, strategy_type());
|
||||
|
||||
typedef bg::model::ring<typename bg::point_type<G2>::type> ring_type;
|
||||
typedef std::vector<ring_type> out_vector;
|
||||
out_vector v;
|
||||
|
||||
|
||||
|
||||
bg::traverse
|
||||
<
|
||||
strategy_type,
|
||||
ring_type
|
||||
>
|
||||
(
|
||||
g1, g2, -1, ips, std::back_inserter(v)
|
||||
);
|
||||
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "intersection_" << caseid << ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
// Trick to have this always LongDouble
|
||||
//typedef bg::model::d2::point_xy<long double> P;
|
||||
typedef typename bg::point_type<G1>::type P;
|
||||
//typename bg::replace_point_type<G1, P>::type rg1;
|
||||
//typename bg::replace_point_type<G2, P>::type rg2;
|
||||
|
||||
bg::svg_mapper<P> mapper(svg, 1000, 800);
|
||||
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
// Input shapes in green/blue
|
||||
mapper.map(g1, "opacity:0.8;fill:rgb(0,255,0);"
|
||||
"stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);"
|
||||
"stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
// Traversal rings in red
|
||||
for (typename out_vector::const_iterator it = boost::begin(v);
|
||||
it != boost::end(v);
|
||||
++it)
|
||||
{
|
||||
mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.9;"
|
||||
"fill:rgb(255,0,0);stroke:rgb(255,0,0);stroke-width:5");
|
||||
|
||||
std::cout << bg::wkt(*it) << std::endl;
|
||||
std::cout << bg::area(*it) << std::endl;
|
||||
}
|
||||
|
||||
// IP's in orange
|
||||
for (iterator it = boost::begin(ips); it != boost::end(ips); ++it)
|
||||
{
|
||||
mapper.map(it->point, "fill:rgb(255,128,0);"
|
||||
"stroke:rgb(0,0,100);stroke-width:1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2)
|
||||
{
|
||||
G1 g1;
|
||||
bg::read_wkt(wkt1, g1);
|
||||
|
||||
G2 g2;
|
||||
bg::read_wkt(wkt2, g2);
|
||||
|
||||
bg::correct(g1);
|
||||
bg::correct(g2);
|
||||
std::cout << "area1 " << bg::area(g1) << " " << " area2: " << bg::area(g2) << std::endl;
|
||||
|
||||
test_traverse<OutputType>(caseid, g1, g2);
|
||||
}
|
||||
|
||||
|
||||
#if ! defined(GEOMETRY_TEST_MULTI)
|
||||
|
||||
template <typename P>
|
||||
void test_traverse_gmp(std::string const& caseid)
|
||||
{
|
||||
typedef bg::model::polygon<P> polygon;
|
||||
std::cout << typeid(typename bg::coordinate_type<P>::type).name() << std::endl;
|
||||
std::cout << std::setprecision(30) << std::numeric_limits<float>::epsilon() << std::endl;
|
||||
std::cout << std::setprecision(30) << std::numeric_limits<double>::epsilon() << std::endl;
|
||||
std::cout << std::setprecision(30) << std::numeric_limits<long double>::epsilon() << std::endl;
|
||||
|
||||
static std::string brandon[3] =
|
||||
{
|
||||
//37.43402099609375 1.470055103302002,
|
||||
"POLYGON((37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,50.974888957147442 -30.277285722290763,57.297810222148939 -37.546793343968417,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.523914387974358 -8.5152102535033496,47.585065917176543 -6.1314922196594779,45.389434814453125 -4.5143837928771973,46.296027072709599 -2.4984308554828116,37.29449462890625 1.7902572154998779))",
|
||||
"POLYGON((42.399410247802734 1.4956772327423096,42.721500396728516 2.2342472076416016,42.721500396728516 3.6584999561309814,51.20102152843122 7.1738039562841562,51.370888500897557 7.4163459734570729,37.43402099609375 1.470055103302002,37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,36.954700469970703 1.2597870826721191,26.472516656201325 -3.5380830513658776,27.069889344709196 -4.2926591211028242,30.501169204711914 -2.3718316555023193,32.708126068115234 -2.3611266613006592,32.708126068115234 -2.3611700534820557,32.708168029785156 -2.3611698150634766,32.718830108642578 -4.3281683921813965,29.135100397190627 -8.9262827849488211,29.619997024536133 -9.5368013381958008,30.339155197143555 -8.9838371276855469,30.670633316040039 -8.8180980682373047,30.896280288696289 -9.1206979751586914,30.207040612748258 -10.275926149505661,30.947774887084961 -11.208560943603516,31.669155120849609 -10.653837203979492,32.000633239746094 -10.488097190856934,32.226280212402344 -10.790698051452637,31.682494778186321 -12.133624901803865,32.274600982666016 -12.879127502441406,32.998821258544922 -12.323249816894531,33.339523315429688 -12.147735595703125,33.566280364990234 -12.450697898864746,33.164891643669634 -14.000060288415174,33.598796844482422 -14.546377182006836,34.328716278076172 -13.992490768432617,34.658355712890625 -13.81736946105957,34.886280059814453 -14.120697975158691,34.634240447128811 -15.85007183479255,34.931102752685547 -16.223842620849609,35.656356811523438 -15.66030216217041,35.963497161865234 -15.476018905639648,37.326129913330078 -17.190576553344727,38.823680877685547 -16.296066284179688,39.966808319091797 -17.625011444091797,40.800632476806641 -17.208097457885742,41.821544647216797 -19.211688995361328,41.988733475572282 -19.945838749437218,57.524304765518266 -37.807195733984784,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.559533858616469 -8.435196445683264,47.604561877161387 -6.087697464505224,45.389434814453125 -4.5143837928771973,46.695858001708984 -1.6093428134918213,47.263670054709685 -1.784876824891044,47.830955505371094 -0.69758313894271851,48.43512638981781 -0.81299959072453376,49.071769542946825 0.61489892713413252,43.764598846435547 0.93951499462127686,43.644271850585938 0.96149998903274536,42.399410247802734 1.4956772327423096))",
|
||||
"POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
|
||||
};
|
||||
|
||||
|
||||
// Test the FORWARD case
|
||||
test_one<polygon, polygon, polygon>(caseid, brandon[0], brandon[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int mode = (argc > 1) ? atol(argv[1]) : 1;
|
||||
switch(mode)
|
||||
{
|
||||
case 1 :
|
||||
test_traverse_gmp<bg::model::d2::point_xy<float> >("float");
|
||||
break;
|
||||
case 2 :
|
||||
test_traverse_gmp<bg::model::d2::point_xy<double> >("double");
|
||||
break;
|
||||
case 3 :
|
||||
test_traverse_gmp<bg::model::d2::point_xy<long double> >("long double");
|
||||
break;
|
||||
case 4 :
|
||||
#if defined(HAVE_TTMATH)
|
||||
test_traverse_gmp<bg::model::d2::point_xy<ttmath_big> >("ttmath_big");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -30,11 +30,6 @@
|
||||
#include <algorithms/overlay/multi_overlay_cases.hpp>
|
||||
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
// Convenience macros (points are not checked)
|
||||
#define TEST_DIFFERENCE(caseid, clips1, area1, clips2, area2, clips3) \
|
||||
(test_one<polygon, polygon, polygon>) \
|
||||
@ -428,7 +423,7 @@ void test_all()
|
||||
test_one<polygon, polygon, polygon>("ggl_list_20110627_phillip",
|
||||
ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
|
||||
BG_IF_RESCALED(1, 0), -1,
|
||||
BG_IF_RESCALED(if_typed_tt<ct>(0.0000000000001105367, 0.000125137888971949), 0),
|
||||
BG_IF_RESCALED(0.000125137888971949, 0),
|
||||
1, -1, 3577.40960816756,
|
||||
tolerance(0.01)
|
||||
);
|
||||
@ -640,11 +635,6 @@ int test_main(int, char* [])
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
test_all<bg::model::d2::point_xy<float> >();
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
|
@ -31,10 +31,6 @@
|
||||
#include <algorithms/overlay/multi_overlay_cases.hpp>
|
||||
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
template <typename CoordinateType>
|
||||
void test_ticket_10835(std::string const& wkt_out1, std::string const& wkt_out2)
|
||||
{
|
||||
|
@ -520,12 +520,6 @@ int test_main(int, char* [])
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
test_all<bg::model::d2::point_xy<float> >();
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
//#define HAVE_TTMATH
|
||||
//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
|
||||
//#define BOOST_GEOMETRY_CHECK_WITH_SQLSERVER
|
||||
|
||||
|
@ -109,13 +109,6 @@ int test_main(int, char* [])
|
||||
test_spikes_in_ticket_8364<bg::model::d2::point_xy<int>, false, false>();
|
||||
test_spikes_in_ticket_8365<bg::model::d2::point_xy<int>, true, true >();
|
||||
test_spikes_in_ticket_8365<bg::model::d2::point_xy<int>, false, false >();
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_spikes_in_ticket_8364<bg::model::d2::point_xy<ttmath_big>, true, true>();
|
||||
test_spikes_in_ticket_8365<bg::model::d2::point_xy<ttmath_big>, true, true>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ void test_areal()
|
||||
1, 4, 163292.679042133, ut_settings(0.1));
|
||||
|
||||
{
|
||||
ut_settings settings(if_typed_tt<ct>(0.01, 0.1));
|
||||
ut_settings settings(0.1);
|
||||
settings.set_test_validity(BG_IF_RESCALED(true, false));
|
||||
|
||||
// SQL Server gives: 88.1920416352664
|
||||
@ -234,7 +234,7 @@ void test_areal()
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ggl_list_20110627_phillip",
|
||||
ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
|
||||
1, if_typed_tt<ct>(6, 5), 11151.6618);
|
||||
1, 5, 11151.6618);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ggl_list_20110716_enrico",
|
||||
ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
|
||||
@ -935,12 +935,6 @@ int test_main(int, char* [])
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
test_all<bg::model::d2::point_xy<float> >();
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
|
||||
|
||||
// Commented, because exception is now disabled:
|
||||
// test_exception<bg::model::d2::point_xy<double> >();
|
||||
|
||||
|
@ -503,12 +503,6 @@ int test_main(int, char* [])
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
test_all<bg::model::d2::point_xy<float> >();
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
|
@ -64,7 +64,7 @@ void test_areal()
|
||||
// This sample was selected because of the border case, and ttmath generates one point more.
|
||||
test_one<Polygon, Polygon, Polygon>("star_poly", example_star, example_polygon,
|
||||
1, 1,
|
||||
if_typed_tt<ct>(28, 27), 5.647949);
|
||||
27, 5.647949);
|
||||
|
||||
// Pseudo-box as Polygon
|
||||
// (note, internally, the intersection points is different, so yes,
|
||||
@ -160,7 +160,7 @@ void test_areal()
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("distance_zero",
|
||||
distance_zero[0], distance_zero[1],
|
||||
1, 0, 8, 9.0098387);
|
||||
1, 0, -1, 9.0098387);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("wrapped_a",
|
||||
wrapped[0], wrapped[1],
|
||||
@ -370,7 +370,7 @@ void test_areal()
|
||||
ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1],
|
||||
-1, // Either 1 or 2, depending if the intersection/turn point (eps.region) is missed
|
||||
0,
|
||||
if_typed_tt<ct>(9, 8),
|
||||
8,
|
||||
67.3550722317627);
|
||||
#endif
|
||||
|
||||
@ -508,14 +508,14 @@ void test_areal()
|
||||
1, 0, -1, 19.3995);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_m1", buffer_rt_m1[0], buffer_rt_m1[1],
|
||||
1, 0, 9, 19.4852);
|
||||
1, 0, -1, 19.4852);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_m1_rev", buffer_rt_m1[1], buffer_rt_m1[0],
|
||||
1, 0, 9, 19.4852);
|
||||
1, 0, -1, 19.4852);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_m2", buffer_rt_m2[0], buffer_rt_m2[1],
|
||||
1, 0, -1, 21.4853);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_m2_rev", buffer_rt_m2[1], buffer_rt_m2[0],
|
||||
1, 0, 15, 21.4853);
|
||||
1, 0, -1, 21.4853);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1],
|
||||
1, 0, -1, 18.5710);
|
||||
@ -531,7 +531,7 @@ void test_areal()
|
||||
1, 0, -1, 15.6569);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
|
||||
1, 0, if_typed_tt<ct>(93, 91), 22.815);
|
||||
1, 0, 91, 22.815);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
|
||||
1, -1, 217, 36.752837);
|
||||
@ -618,17 +618,12 @@ void test_all()
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
BoostGeometryWriteTestConfiguration();
|
||||
test_all<bg::model::d2::point_xy<default_test_type> >();
|
||||
test_all<bg::model::d2::point_xy<default_test_type>>();
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
|
||||
test_all<bg::model::d2::point_xy<float> >();
|
||||
test_all<bg::model::d2::point_xy<long double> >();
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
test_all<bg::model::d2::point_xy<float>>();
|
||||
test_all<bg::model::d2::point_xy<long double>>();
|
||||
test_all<bg::model::d2::point_xy<mp_test_type>>();
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
|
@ -43,6 +43,8 @@
|
||||
template <typename Ring, typename Polygon, typename MultiPolygon>
|
||||
void test_areal()
|
||||
{
|
||||
using ct = typename bg::coordinate_type<Ring>::type;
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("simplex_multi",
|
||||
case_multi_simplex[0], case_multi_simplex[1],
|
||||
1, 0, 20, 14.58);
|
||||
@ -364,7 +366,7 @@ void test_areal()
|
||||
TEST_UNION(case_recursive_boxes_79, 1, 2, -1, 14.75);
|
||||
|
||||
// No hole should be generated (but rescaling generates one hole)
|
||||
TEST_UNION(case_recursive_boxes_80, 2, BG_IF_RESCALED(1, 0), -1, 1.5);
|
||||
TEST_UNION(case_recursive_boxes_80, 2, BG_IF_RESCALED(bg_if_mp<ct>(0, 1), 0), -1, 1.5);
|
||||
|
||||
TEST_UNION(case_recursive_boxes_81, 5, 0, -1, 15.5);
|
||||
TEST_UNION(case_recursive_boxes_82, 2, 2, -1, 20.25);
|
||||
@ -384,7 +386,7 @@ void test_areal()
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20140212_sybren",
|
||||
ggl_list_20140212_sybren[0], ggl_list_20140212_sybren[1],
|
||||
2, 0, 16, 0.002471626);
|
||||
2, bg_if_mp<ct>(1, 0), -1, 0.002471626);
|
||||
|
||||
{
|
||||
// Generates either 4 or 3 output polygons
|
||||
@ -393,7 +395,7 @@ void test_areal()
|
||||
settings.set_test_validity(BG_IF_RESCALED(false, true));
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
|
||||
ticket_9081[0], ticket_9081[1],
|
||||
BG_IF_RESCALED(4, 3), 0, 31, 0.2187385,
|
||||
BG_IF_RESCALED(bg_if_mp<ct>(3, 4), 3), 0, -1, 0.2187385,
|
||||
settings);
|
||||
}
|
||||
|
||||
@ -480,16 +482,10 @@ int test_main(int, char* [])
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
|
||||
test_all<bg::model::d2::point_xy<double>, false, false>();
|
||||
test_all<bg::model::d2::point_xy<float>, true, true>();
|
||||
test_all<bg::model::d2::point_xy<mp_test_type>, true, true>();
|
||||
|
||||
test_specific<bg::model::d2::point_xy<int>, false, false>();
|
||||
|
||||
test_all<bg::model::d2::point_xy<float>, true, true>();
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
std::cout << "Testing TTMATH" << std::endl;
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
|
@ -80,22 +80,8 @@
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CLN) || defined(HAVE_GMP)
|
||||
# include <boost/numeric_adaptor/numeric_adaptor.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_GMP)
|
||||
# include <boost/numeric_adaptor/gmp_value_type.hpp>
|
||||
#endif
|
||||
#if defined(HAVE_CLN)
|
||||
# include <boost/numeric_adaptor/cln_value_type.hpp>
|
||||
#endif
|
||||
// For testing high precision numbers
|
||||
#include <boost/multiprecision/cpp_bin_float.hpp>
|
||||
|
||||
// For all tests:
|
||||
// - do NOT use "using namespace boost::geometry" to make clear what is Boost.Geometry
|
||||
@ -108,17 +94,6 @@
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
|
||||
template <typename CoordinateType, typename T1, typename T2>
|
||||
inline T1 if_typed_tt(T1 value_tt, T2 value)
|
||||
{
|
||||
#if defined(HAVE_TTMATH)
|
||||
return boost::is_same<CoordinateType, ttmath_big>::type::value ? value_tt : value;
|
||||
#else
|
||||
boost::ignore_unused(value_tt);
|
||||
return value;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename CoordinateType, typename Specified, typename T>
|
||||
inline T if_typed(T value_typed, T value)
|
||||
{
|
||||
@ -188,8 +163,16 @@ private :
|
||||
};
|
||||
|
||||
|
||||
typedef boost::multiprecision::cpp_bin_float_100 mp_test_type;
|
||||
typedef double default_test_type;
|
||||
|
||||
template <typename CoordinateType, typename T1, typename T2>
|
||||
inline T1 const& bg_if_mp(T1 const& value_mp, T2 const& value)
|
||||
{
|
||||
return boost::is_same<CoordinateType, mp_test_type>::type::value ? value_mp : value;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BOOST_GEOMETRY_USE_RESCALING)
|
||||
#define BG_IF_RESCALED(a, b) a
|
||||
#else
|
||||
|
@ -353,10 +353,6 @@ int main(int argc, char** argv)
|
||||
{
|
||||
test_all<double, true, true>(seed, count, level, settings);
|
||||
}
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
// test_all<ttmath_big, true, true>(seed, count, max, svg, level);
|
||||
#endif
|
||||
}
|
||||
catch(std::exception const& e)
|
||||
{
|
||||
|
@ -23,24 +23,6 @@
|
||||
|
||||
#include <boost/multiprecision/cpp_bin_float.hpp>
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CLN) || defined(HAVE_GMP)
|
||||
# include <boost/numeric_adaptor/numeric_adaptor.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_GMP)
|
||||
# include <boost/numeric_adaptor/gmp_value_type.hpp>
|
||||
#endif
|
||||
#if defined(HAVE_CLN)
|
||||
# include <boost/numeric_adaptor/cln_value_type.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct string_from_type {};
|
||||
|
||||
@ -80,26 +62,9 @@ template <> struct string_from_type<boost::int128_type>
|
||||
{ static std::string name() { return "n"; } };
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
template <> struct string_from_type<ttmath_big>
|
||||
{ static std::string name() { return "t"; } };
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RATIONAL_HPP)
|
||||
template <typename T> struct string_from_type<boost::rational<T> >
|
||||
{ static std::string name() { return "r"; } };
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_GMP)
|
||||
template <> struct string_from_type<boost::numeric_adaptor::gmp_value_type>
|
||||
{ static std::string name() { return "g"; } };
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
template <> struct string_from_type<boost::numeric_adaptor::cln_value_type>
|
||||
{ static std::string name() { return "c"; } };
|
||||
#endif
|
||||
|
||||
|
||||
#endif // GEOMETRY_TEST_STRING_FROM_TYPE_HPP
|
||||
|
Loading…
x
Reference in New Issue
Block a user