Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69603 - trunk/libs/geometry/test/algorithms/overlay/robustness
From: barend.gehrels_at_[hidden]
Date: 2011-03-06 08:15:13


Author: barendgehrels
Date: 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
New Revision: 69603
URL: http://svn.boost.org/trac/boost/changeset/69603

Log:
Added program_options to both intersection_pies.cpp and random_ellipses_stars.cpp now
Changed difference-test into a setting instead of a define

Text files modified:
   trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp | 28 +++++----
   trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj | 4
   trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp | 98 +++++++++++++++++++++++++++-------
   trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj | 48 ++++++++++++++++
   trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp | 31 ++++++-----
   trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj | 4
   trunk/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp | 112 +++++++++++++++++++++++----------------
   7 files changed, 227 insertions(+), 98 deletions(-)

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -135,7 +135,7 @@
 
 template <typename T, bool Clockwise, bool Closed>
 void test_pie(int total_segment_count, T factor_p, T factor_q,
- bool multi, bool single_selftangent, bool svg)
+ bool multi, bool single_selftangent, p_q_settings const& settings)
 {
     boost::timer t;
     typedef bg::model::d2::point_xy<T> point_type;
@@ -168,7 +168,7 @@
 
                         std::ostringstream out;
                         out << "pie_" << a << "_" << b << "_" << offset << "_" << y;
- if (test_overlay_p_q<polygon, T>(out.str(), p, q, svg, 0.01))
+ if (test_overlay_p_q<polygon, T>(out.str(), p, q, settings))
                         {
                             good_count++;
                         }
@@ -202,7 +202,7 @@
                                     q1.outer().push_back(q2.outer()[i]);
                                 }
                                 //holify(q1);
- good = test_overlay_p_q<polygon, T>(out.str(), p, q1, svg, 0.01);
+ good = test_overlay_p_q<polygon, T>(out.str(), p, q1, settings);
                             }
                             else
                             {
@@ -210,7 +210,7 @@
                                 mq.push_back(q);
                                 mq.push_back(q2);
                                 //holify_multi(mq);
- good = test_overlay_p_q<polygon, T>(out.str(), p, mq, svg, 0.01);
+ good = test_overlay_p_q<polygon, T>(out.str(), p, mq, settings);
                             }
 
                             if (good)
@@ -235,9 +235,9 @@
 
 
 template <typename T, bool Clockwise, bool Closed>
-void test_all(bool multi, bool single_selftangent, bool svg)
+void test_all(bool multi, bool single_selftangent, p_q_settings const& settings)
 {
- test_pie<T, Clockwise, Closed>(24, 0.55, 0.45, multi, single_selftangent, svg);
+ test_pie<T, Clockwise, Closed>(24, 0.55, 0.45, multi, single_selftangent, settings);
 }
 
 int main(int argc, char** argv)
@@ -245,9 +245,9 @@
     try
     {
         namespace po = boost::program_options;
- po::options_description description("=== recursive_polygons ===\nAllowed options");
+ po::options_description description("=== intersection_pies ===\nAllowed options");
 
- bool svg = false;
+ p_q_settings settings;
         bool multi = false;
         bool ccw = false;
         bool open = false;
@@ -256,9 +256,11 @@
         description.add_options()
             ("help", "Help message")
             ("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")
             ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
             ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
- ("svg", po::value<bool>(&svg)->default_value(false), "Create an SVG filename 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")
         ;
 
         po::variables_map varmap;
@@ -274,19 +276,19 @@
         // template par's are: CoordinateType, Clockwise, Closed
         if (ccw && open)
         {
- test_all<double, false, false>(multi, single_selftangent, svg);
+ test_all<double, false, false>(multi, single_selftangent, settings);
         }
         else if (ccw)
         {
- test_all<double, false, true>(multi, single_selftangent, svg);
+ test_all<double, false, true>(multi, single_selftangent, settings);
         }
         else if (open)
         {
- test_all<double, true, false>(multi, single_selftangent, svg);
+ test_all<double, true, false>(multi, single_selftangent, settings);
         }
         else
         {
- test_all<double, true, true>(multi, single_selftangent, svg);
+ test_all<double, true, true>(multi, single_selftangent, settings);
         }
         //test_all<long double>();
     }

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.vcproj 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="&quot;c:\gmp\gmp-dynamic&quot;;c:\svn\numeric_adaptor;.;../../../../../..;../../.."
+ AdditionalIncludeDirectories="../../../../../..;."
                                 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG;BOOST_ALL_NO_LIB"
                                 BasicRuntimeChecks="3"
                                 RuntimeLibrary="1"
@@ -117,7 +117,7 @@
                         />
                         <Tool
                                 Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;c:\gmp\gmp-dynamic&quot;;c:\svn\numeric_adaptor;.;../../../../../..;../../.."
+ AdditionalIncludeDirectories="../../../../../..;."
                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
                                 UsePrecompiledHeader="0"
                                 WarningLevel="3"

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.cpp 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -15,8 +15,8 @@
 #define BOOST_GEOMETRY_NO_BOOST_TEST
 
 
+#include <boost/program_options.hpp>
 #include <boost/timer.hpp>
-#include <boost/lexical_cast.hpp>
 #include <boost/random/linear_congruential.hpp>
 #include <boost/random/uniform_int.hpp>
 #include <boost/random/uniform_real.hpp>
@@ -87,15 +87,16 @@
 
     }
     bg::exterior_ring(polygon).push_back(bg::exterior_ring(polygon).front());
+ bg::correct(polygon);
 }
 
 
-template <typename T>
+template <typename T, bool Clockwise, bool Closed>
 void test_star_ellipse(int seed, int index, star_params const& par_p,
- star_params const& par_q, bool svg, double tolerance)
+ star_params const& par_q, p_q_settings const& settings)
 {
     typedef bg::model::d2::point_xy<T> point_type;
- typedef bg::model::polygon<point_type> polygon;
+ typedef bg::model::polygon<point_type, Clockwise, Closed> polygon;
 
     polygon p, q;
     make_star(p, par_p);
@@ -103,11 +104,11 @@
 
     std::ostringstream out;
     out << "rse_" << seed << "_" << index;
- test_overlay_p_q<polygon, T>(out.str(), p, q, svg, tolerance);
+ test_overlay_p_q<polygon, T>(out.str(), p, q, settings);
 }
 
-template <typename T>
-void test_all(int seed, int count, bool svg, double tolerance)
+template <typename T, bool Clockwise, bool Closed>
+void test_type(int seed, int count, p_q_settings const& settings)
 {
     boost::timer t;
 
@@ -157,36 +158,93 @@
 
     for(int i = 0; i < count; i++)
     {
- test_star_ellipse<T>(seed, i + 1,
+ test_star_ellipse<T, Clockwise, Closed>(seed, i + 1,
             star_params(int_generator() * 2 + 1,
                     factor_generator(), factor_generator(),
                     location_generator(), location_generator(), rotation_generator()),
             star_params(int_generator() * 2 + 1,
                     factor_generator(), factor_generator(),
                     location_generator(), location_generator(), rotation_generator()),
- svg, tolerance);
+ settings);
     }
     std::cout
         << "type: " << string_from_type<T>::name()
         << " time: " << t.elapsed() << std::endl;
 }
 
+template <bool Clockwise, bool Closed>
+void test_all(std::string const& type, int seed, int count, p_q_settings settings)
+{
+ if (type == "float")
+ {
+ settings.tolerance = 1.0e-3;
+ test_type<float, Clockwise, Closed>(seed, count, settings);
+ }
+ else if (type == "double")
+ {
+ test_type<double, Clockwise, Closed>(seed, count, settings);
+ }
+#if defined(HAVE_TTMATH)
+ else if (type == "ttmath")
+ {
+ test_type<ttmath_big, Clockwise, Closed>(seed, count, settings);
+ }
+#endif
+}
+
+
 int main(int argc, char** argv)
 {
     try
     {
- int count = argc > 1 ? boost::lexical_cast<int>(argv[1]) : 10;
- int seed = (argc > 2 && std::string(argv[2]) != std::string("#"))
- ? boost::lexical_cast<int>(argv[2])
- : static_cast<unsigned int>(std::time(0));
- bool svg = argc > 3 && std::string(argv[3]) == std::string("svg");
+ namespace po = boost::program_options;
+ po::options_description description("=== random_ellipses_stars ===\nAllowed options");
 
- test_all<float>(seed, count, svg, 1e-3);
- //test_all<double>(seed, count, svg, 1e-6);
-
-#if defined(HAVE_TTMATH)
- // test_star_ellipse<ttmath_big>(selection, "t");
-#endif
+ int count = 1;
+ int seed = static_cast<unsigned int>(std::time(0));
+ std::string type = "float";
+ bool ccw = false;
+ bool open = false;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("seed", po::value<int>(&seed), "Initialization seed for random generator")
+ ("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")
+ ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
+ ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
+ ("type", po::value<std::string>(&type)->default_value("float"), "Type (float,double)")
+ ("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")
+ ;
+
+ po::variables_map varmap;
+ po::store(po::parse_command_line(argc, argv, description), varmap);
+ po::notify(varmap);
+
+ if (varmap.count("help"))
+ {
+ std::cout << description << std::endl;
+ return 1;
+ }
+
+ if (ccw && open)
+ {
+ test_all<false, false>(type, seed, count, settings);
+ }
+ else if (ccw)
+ {
+ test_all<false, true>(type, seed, count, settings);
+ }
+ else if (open)
+ {
+ test_all<true, false>(type, seed, count, settings);
+ }
+ else
+ {
+ test_all<true, true>(type, seed, count, settings);
+ }
     }
     catch(std::exception const& e)
     {

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/random_ellipses_stars.vcproj 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -42,7 +42,7 @@
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
                                 AdditionalIncludeDirectories="../../../../../..;../../..;."
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
                                 BasicRuntimeChecks="3"
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
@@ -118,7 +118,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 AdditionalIncludeDirectories="../../../../../..;../../..;."
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
                                 RuntimeLibrary="0"
                                 UsePrecompiledHeader="0"
                                 WarningLevel="3"
@@ -169,6 +169,50 @@
         <References>
         </References>
         <Files>
+ <Filter
+ Name="program options"
+ >
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\config_file.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\convert.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\options_description.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\parsers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\positional_options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\split.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\utf8_codecvt_facet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\value_semantic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\program_options\src\variables_map.cpp"
+ >
+ </File>
+ </Filter>
                 <File
                         RelativePath=".\random_ellipses_stars.cpp"
>

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -66,7 +66,7 @@
 template <typename MultiPolygon, typename Generator>
 bool test_recursive_boxes(MultiPolygon& result, int& index,
             Generator& generator,
- bool svg, int level, bool triangular)
+ int level, bool triangular, p_q_settings const& settings)
 {
     MultiPolygon p, q;
 
@@ -84,8 +84,8 @@
     {
         bg::correct(p);
         bg::correct(q);
- if (! test_recursive_boxes(p, index, generator, svg, level - 1, triangular)
- || ! test_recursive_boxes(q, index, generator, svg, level - 1, triangular))
+ if (! test_recursive_boxes(p, index, generator, level - 1, triangular, settings)
+ || ! test_recursive_boxes(q, index, generator, level - 1, triangular, settings))
         {
             return false;
         }
@@ -99,7 +99,7 @@
         <
             polygon,
             typename bg::coordinate_type<MultiPolygon>::type
- >(out.str(), p, q, svg, 0.001))
+ >(out.str(), p, q, settings))
     {
         return false;
     }
@@ -118,7 +118,7 @@
 
 
 template <typename T, bool Clockwise, bool Closed>
-void test_all(int seed, int count, int field_size, bool svg, int level, bool triangular)
+void test_all(int seed, int count, int field_size, int level, bool triangular, p_q_settings const& settings)
 {
     boost::timer t;
 
@@ -141,10 +141,10 @@
     for(int i = 0; i < count; i++)
     {
         mp p;
- test_recursive_boxes<mp>(p, index, coordinate_generator, svg, level, triangular);
+ test_recursive_boxes<mp>(p, index, coordinate_generator, level, triangular, settings);
     }
     std::cout
- << "boxes " << index
+ << "polygons: " << index
         << " type: " << string_from_type<T>::name()
         << " time: " << t.elapsed() << std::endl;
 }
@@ -162,26 +162,29 @@
         int field_size = 10;
         bool ccw = false;
         bool open = false;
- bool svg = false;
+ p_q_settings settings;
         std::string form = "box";
 
         description.add_options()
             ("help", "Help message")
             ("seed", po::value<int>(&seed), "Initialization seed for random generator")
             ("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")
             ("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")
             ("form", po::value<std::string>(&form)->default_value("box"), "Form of the polygons (box, triangle)")
             ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
             ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
- ("svg", po::value<bool>(&svg)->default_value(false), "Create an SVG filename 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")
         ;
 
         po::variables_map varmap;
         po::store(po::parse_command_line(argc, argv, description), varmap);
         po::notify(varmap);
 
- if (varmap.count("help"))
+ if (varmap.count("help")
+ || (form != "box" && form != "triangle"))
         {
             std::cout << description << std::endl;
             return 1;
@@ -192,19 +195,19 @@
 
         if (ccw && open)
         {
- test_all<double, false, false>(seed, count, field_size, svg, level, triangular);
+ test_all<double, false, false>(seed, count, field_size, level, triangular, settings);
         }
         else if (ccw)
         {
- test_all<double, false, true>(seed, count, field_size, svg, level, triangular);
+ test_all<double, false, true>(seed, count, field_size, level, triangular, settings);
         }
         else if (open)
         {
- test_all<double, true, false>(seed, count, field_size, svg, level, triangular);
+ test_all<double, true, false>(seed, count, field_size, level, triangular, settings);
         }
         else
         {
- test_all<double, true, true>(seed, count, field_size, svg, level, triangular);
+ test_all<double, true, true>(seed, count, field_size, level, triangular, settings);
         }
 
 #if defined(HAVE_TTMATH)

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.vcproj 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="../../../../../..;../../..;."
+ AdditionalIncludeDirectories="../../../../../..;."
                                 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG;BOOST_ALL_NO_LIB"
                                 BasicRuntimeChecks="3"
                                 RuntimeLibrary="1"
@@ -117,7 +117,7 @@
                         />
                         <Tool
                                 Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../../..;../../..;."
+ AdditionalIncludeDirectories="../../../../../..;."
                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
                                 RuntimeLibrary="0"
                                 UsePrecompiledHeader="0"

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/test_overlay_p_q.hpp 2011-03-06 08:15:08 EST (Sun, 06 Mar 2011)
@@ -32,20 +32,36 @@
 #include <geometry_test_common.hpp>
 
 
+struct p_q_settings
+{
+ bool svg;
+ bool also_difference;
+ bool wkt;
+ double tolerance;
+
+ p_q_settings()
+ : svg(false)
+ , also_difference(false)
+ , wkt(false)
+ , tolerance(1.0e-6)
+ {}
+};
+
 template <typename OutputType, typename CalculationType, typename G1, typename G2>
 static bool test_overlay_p_q(std::string const& caseid,
             G1 const& p, G2 const& q,
- bool svg, double tolerance, bool force_output = false)
+ p_q_settings const& settings)
 {
     bool result = true;
 
     typedef typename bg::coordinate_type<G1>::type coordinate_type;
     typedef typename bg::point_type<G1>::type point_type;
 
- bg::model::multi_polygon<OutputType> out_i, out_u, out_d;
+ bg::model::multi_polygon<OutputType> out_i, out_u, out_d, out_d2;
 
     CalculationType area_p = bg::area(p);
     CalculationType area_q = bg::area(q);
+ CalculationType area_d1 = 0, area_d2 = 0;
 
     bg::intersection(p, q, out_i);
     CalculationType area_i = bg::area(out_i);
@@ -55,22 +71,28 @@
 
     double sum = (area_p + area_q) - area_u - area_i;
 
- bool wrong = std::abs(sum) > tolerance;
+ bool wrong = std::abs(sum) > settings.tolerance;
 
-#ifdef BOOST_GEOMETRY_ROBUSTNESS_USE_DIFFERENCE
- bg::difference(p, q, out_d);
- CalculationType area_d = bg::area(out_d);
- double sum_d = (area_u - area_q) - area_d;
- bool wrong_d = std::abs(sum_d) > tolerance;
-
- if (wrong_d)
+ if (settings.also_difference)
     {
- wrong = true;
+ bg::difference(p, q, out_d);
+ bg::difference(q, p, out_d2);
+ area_d1 = bg::area(out_d);
+ area_d2 = bg::area(out_d2);
+ double sum_d1 = (area_u - area_q) - area_d1;
+ double sum_d2 = (area_u - area_p) - area_d2;
+ bool wrong_d1 = std::abs(sum_d1) > settings.tolerance;
+ bool wrong_d2 = std::abs(sum_d2) > settings.tolerance;
+
+ if (wrong_d1 || wrong_d2)
+ {
+ wrong = true;
+ }
     }
-#endif
 
+ bool svg = settings.svg;
 
- if (wrong || force_output)
+ if (wrong || settings.wkt)
     {
         if (wrong)
         {
@@ -87,13 +109,17 @@
             << " area u: " << area_u
             << " area p: " << area_p
             << " area q: " << area_q
- << " sum: " << sum
-#ifdef BOOST_GEOMETRY_ROBUSTNESS_USE_DIFFERENCE
- << " area d: " << area_d
- << " sum d: " << sum_d
-#endif
+ << " sum: " << sum;
+
+ if (settings.also_difference)
+ {
+ std::cout
+ << " area d1: " << area_d1
+ << " area d2: " << area_d2;
+ }
+ std::cout
             << std::endl
- << std::setprecision(20)
+ << std::setprecision(9)
             << " p: " << bg::wkt(p) << std::endl
             << " q: " << bg::wkt(q) << std::endl
             << " i: " << bg::wkt(out_i) << std::endl
@@ -102,15 +128,6 @@
 
     }
 
- // For POSTGIS output
- /***
- std::cout
- << "union select " << area_i << " as bg,ST_area(ST_Intersection(ST_GeomFromText('" << bg::wkt(p) << "'), ST_GeomFromText('" << bg::wkt(q) << "'))) as pg" << std::endl
- << "union select " << area_u << " as bg,ST_area(ST_Union(ST_GeomFromText('" << bg::wkt(p) << "'), ST_GeomFromText('" << bg::wkt(q) << "'))) as pg" << std::endl
- << std::endl;
- ***/
-
-
     if(svg)
     {
         std::ostringstream filename;
@@ -126,33 +143,38 @@
         mapper.add(p);
         mapper.add(q);
 
- //mapper.add(point_type(0,0));
- //mapper.add(point_type(3,3));
-
         // Input shapes in green/blue
         mapper.map(p, "fill-opacity:0.5;fill:rgb(153,204,0);"
                 "stroke:rgb(153,204,0);stroke-width:3");
         mapper.map(q, "fill-opacity:0.3;fill:rgb(51,51,153);"
                 "stroke:rgb(51,51,153);stroke-width:3");
 
-#ifdef BOOST_GEOMETRY_ROBUSTNESS_USE_DIFFERENCE
- for (BOOST_AUTO(it, out_d.begin()); it != out_d.end(); ++it)
- {
- mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,255,0);"
- "stroke:rgb(255,255,0);stroke-width:4");
- }
-#else
- for (BOOST_AUTO(it, out_i.begin()); it != out_i.end(); ++it)
+ if (settings.also_difference)
         {
- mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
- "stroke:rgb(255,0,0);stroke-width:4");
+ for (BOOST_AUTO(it, out_d.begin()); it != out_d.end(); ++it)
+ {
+ mapper.map(*it,
+ "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ }
+ for (BOOST_AUTO(it, out_d2.begin()); it != out_d2.end(); ++it)
+ {
+ mapper.map(*it,
+ "opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ }
         }
- for (BOOST_AUTO(it, out_u.begin()); it != out_u.end(); ++it)
+ else
         {
- mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
- "stroke:rgb(255,0,255);stroke-width:4");
+ for (BOOST_AUTO(it, out_i.begin()); it != out_i.end(); ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,0);stroke-width:4");
+ }
+ for (BOOST_AUTO(it, out_u.begin()); it != out_u.end(); ++it)
+ {
+ mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
+ "stroke:rgb(255,0,255);stroke-width:4");
+ }
         }
-#endif
     }
     return result;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk