Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69860 - trunk/libs/geometry/test/algorithms/overlay/robustness
From: barend.gehrels_at_[hidden]
Date: 2011-03-11 17:15:18


Author: barendgehrels
Date: 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
New Revision: 69860
URL: http://svn.boost.org/trac/boost/changeset/69860

Log:
Added old tests, now updated, to robustness suite to check if performance stays satisfactory
Added:
   trunk/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp (contents, props changed)
   trunk/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj (contents, props changed)
   trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp (contents, props changed)
   trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp (contents, props changed)
   trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj (contents, props changed)
Text files modified:
   trunk/libs/geometry/test/algorithms/overlay/robustness/robustness.sln | 12 ++++++++++++
   1 files changed, 12 insertions(+), 0 deletions(-)

Added: trunk/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.cpp 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,167 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2009, 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)
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+#define BOOST_GEOMETRY_TIME_OVERLAY
+
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+#include <test_overlay_p_q.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/multi/multi.hpp>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
+
+
+template <typename Polygon>
+inline void make_polygon(Polygon& polygon, int count_x, int count_y, int index)
+{
+ typedef typename bg::point_type<Polygon>::type point_type;
+ bg::exterior_ring(polygon).push_back(point_type(0, 0));
+ bg::exterior_ring(polygon).push_back(point_type(0, count_y * 10));
+ bg::exterior_ring(polygon).push_back(point_type(count_x * 10, count_y * 10));
+ bg::exterior_ring(polygon).push_back(point_type(count_x * 10, 0));
+ bg::exterior_ring(polygon).push_back(point_type(0, 0));
+
+ for(int j = 0; j < count_x; ++j)
+ {
+ for(int k = 0; k < count_y; ++k)
+ {
+ polygon.inners().push_back(Polygon::inner_container_type::value_type());
+ polygon.inners().back().push_back(point_type(j * 10 + 1, k * 10 + 1));
+ polygon.inners().back().push_back(point_type(j * 10 + 7, k * 10 + 5 + index));
+ polygon.inners().back().push_back(point_type(j * 10 + 5 + index, k * 10 + 7));
+ polygon.inners().back().push_back(point_type(j * 10 + 1, k * 10 + 1));
+ }
+ }
+ bg::correct(polygon);
+}
+
+
+
+template <typename Polygon>
+void test_star_comb(int count_x, int count_y, p_q_settings const& settings)
+{
+ Polygon p, q;
+
+ make_polygon(p, count_x, count_y, 0);
+ make_polygon(q, count_x, count_y, 1);
+
+ std::ostringstream out;
+ out << "interior_triangles";
+ test_overlay_p_q
+ <
+ Polygon,
+ typename bg::coordinate_type<Polygon>::type
+ >(out.str(), p, q, settings);
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int count, int count_x, int count_y, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ test_star_comb<polygon>(count_x, count_y, settings);
+ }
+ std::cout
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== interior_triangles ===\nAllowed options");
+
+ int count = 1;
+ int count_x = 10;
+ int count_y = 10;
+ bool ccw = false;
+ bool open = false;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("count", po::value<int>(&count)->default_value(1), "Number of tests")
+ ("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")
+ ("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")
+ ("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<double, false, false>(count, count_x, count_y, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(count, count_x, count_y, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(count, count_x, count_y, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(count, count_x, count_y, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}

Added: trunk/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/interior_triangles.vcproj 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="interior_triangles"
+ ProjectGUID="{7583C2E3-AD74-4C34-8E94-9162F641B215}"
+ RootNamespace="interior_triangles"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\interior_triangles"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\interior_triangles"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <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=".\interior_triangles.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: trunk/libs/geometry/test/algorithms/overlay/robustness/robustness.sln
==============================================================================
--- trunk/libs/geometry/test/algorithms/overlay/robustness/robustness.sln (original)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/robustness.sln 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
@@ -8,6 +8,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recursive_polygons", "recursive_polygons.vcproj", "{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "star_comb", "star_comb.vcproj", "{6D8C81C1-23CD-469E-8094-E0C01B51E944}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interior_triangles", "interior_triangles.vcproj", "{7583C2E3-AD74-4C34-8E94-9162F641B215}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -30,6 +34,14 @@
                 {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Debug|Win32.Build.0 = Debug|Win32
                 {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Release|Win32.ActiveCfg = Release|Win32
                 {E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Release|Win32.Build.0 = Release|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Debug|Win32.Build.0 = Debug|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Release|Win32.ActiveCfg = Release|Win32
+ {6D8C81C1-23CD-469E-8094-E0C01B51E944}.Release|Win32.Build.0 = Release|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Debug|Win32.Build.0 = Debug|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Release|Win32.ActiveCfg = Release|Win32
+ {7583C2E3-AD74-4C34-8E94-9162F641B215}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Added: trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.cpp 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,154 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2009, 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)
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+
+#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
+#define BOOST_GEOMETRY_NO_BOOST_TEST
+#define BOOST_GEOMETRY_TIME_OVERLAY
+
+
+#include <boost/program_options.hpp>
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/timer.hpp>
+
+#include <star_comb.hpp>
+#include <test_overlay_p_q.hpp>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/multi/multi.hpp>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
+
+
+template <typename Polygon>
+void add(Polygon& polygon, double x, double y, int)
+{
+ typedef typename boost::geometry::point_type<Polygon>::type p;
+ boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<p>(x, y));
+}
+
+
+template <typename Polygon>
+void test_star_comb(int star_point_count, int comb_comb_count, double factor1, double factor2, bool do_union, p_q_settings const& settings)
+{
+ Polygon star, comb;
+ make_star(star, add<Polygon>, star_point_count, factor1, factor2);
+ make_comb(comb, add<Polygon>, comb_comb_count);
+
+ std::ostringstream out;
+ out << "star_comb";
+ test_overlay_p_q
+ <
+ Polygon,
+ typename bg::coordinate_type<Polygon>::type
+ >(out.str(), star, comb, settings);
+}
+
+
+template <typename T, bool Clockwise, bool Closed>
+void test_all(int count, int star_point_count, int comb_comb_count, double factor1, double factor2, bool do_union, p_q_settings const& settings)
+{
+ boost::timer t;
+
+ typedef bg::model::polygon
+ <
+ bg::model::d2::point_xy<T>, Clockwise, Closed
+ > polygon;
+
+
+ int index = 0;
+ for(int i = 0; i < count; i++)
+ {
+ test_star_comb<polygon>(star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ std::cout
+ << " type: " << string_from_type<T>::name()
+ << " time: " << t.elapsed() << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ namespace po = boost::program_options;
+ po::options_description description("=== star_comb ===\nAllowed options");
+
+ int count = 1;
+ bool do_union = false;
+ bool ccw = false;
+ bool open = false;
+ double factor1 = 1.1;
+ double factor2 = 0.2;
+ int point_count = 50;
+ p_q_settings settings;
+
+ description.add_options()
+ ("help", "Help message")
+ ("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")
+ ("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")
+ ("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;
+ }
+
+ int star_point_count = point_count * 2 + 1;
+ int comb_comb_count = point_count;
+
+
+ if (ccw && open)
+ {
+ test_all<double, false, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ else if (ccw)
+ {
+ test_all<double, false, true>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ else if (open)
+ {
+ test_all<double, true, false>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+ else
+ {
+ test_all<double, true, true>(count, star_point_count, comb_comb_count, factor1, factor2, do_union, settings);
+ }
+
+#if defined(HAVE_TTMATH)
+ // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
+#endif
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception " << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cout << "Other exception" << std::endl;
+ }
+
+ return 0;
+}

Added: trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.hpp 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,127 @@
+#include <test_overlay_p_q.hpp>
+//
+// Copyright Barend Gehrels, 2009, 2011, Geodan Holding B.V. 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)
+
+#ifndef BOOST_GEOMETRY_STAR_COMB_HPP
+#define BOOST_GEOMETRY_STAR_COMB_HPP
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <boost/timer.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/math/constants/constants.hpp>
+
+
+template <typename Polygon, typename AddFunctor>
+inline void make_star(Polygon& polygon, AddFunctor functor,
+ int count, double factor1, double factor2,
+ double offset = 0.0,
+ bool close = true,
+ double orientation = 1.0)
+{
+ // Create star
+ double cx = 25.0;
+ double cy = 25.0;
+
+ double dx = 50.0;
+ double dy = 50.0;
+
+ double a1 = factor1 * 0.5 * dx;
+ double b1 = factor1 * 0.5 * dy;
+ double a2 = factor2 * 0.5 * dx;
+ double b2 = factor2 * 0.5 * dy;
+
+ double delta = orientation * boost::math::constants::pi<double>() * 2.0 / (count - 1);
+ double angle = offset * delta;
+ double x0, y0;
+ bool first = true;
+ for (int i = 0; i < count - 1; i++, angle += delta)
+ {
+ bool even = i % 2 == 0;
+ double x = cx + (even ? a1 : a2) * sin(angle);
+ double y = cy + (even ? b1 : b2) * cos(angle);
+ functor(polygon, x, y, i);
+ if (first)
+ {
+ x0 = x;
+ y0 = y;
+ first = false;
+ }
+
+ }
+ if (close)
+ {
+ functor(polygon, x0, y0, count);
+ }
+}
+
+template <typename Vector>
+void ccw_pushback(Vector& vector, double x, double y, int)
+{
+ vector.push_back(boost::make_tuple<double, double>(x, y));
+}
+
+template <typename Polygon, typename AddFunctor>
+inline void make_comb(Polygon& polygon, AddFunctor functor,
+ int count,
+ bool close = true,
+ bool clockwise = true)
+{
+ int n = 0;
+
+ if (! clockwise)
+ {
+ typedef boost::tuple<double, double> tup;
+ typedef std::vector<tup> vector_type;
+ vector_type vec;
+
+ // Create in clockwise order
+ make_comb(vec, ccw_pushback<vector_type>, count, close, true);
+
+ // Add in reverse
+ // (For GCC 3.4 have it const)
+ vector_type const& v = vec;
+ for (vector_type::const_reverse_iterator
+ it = v.rbegin(); it != v.rend(); ++it)
+ {
+ functor(polygon, it->get<0>(), it->get<1>(), n++);
+ }
+ return;
+ }
+
+ // Create comb
+ functor(polygon, 25.0, 0.0, n++);
+ functor(polygon, 0.0, 25.0, n++);
+ functor(polygon, 25.0, 50.0, n++);
+
+ // Function parameters
+ double diff = (25.0 / (count - 0.5)) / 2.0;
+
+ double b1 = -25.0;
+ double b2 = 25.0 - diff * 2.0;
+
+ double x1 = 50.0, x2 = 25.0;
+
+ for (int i = 0; i < count - 1; i++)
+ {
+ functor(polygon, x1, (x1 + b1), n++); x1 -= diff;
+ functor(polygon, x1, (x1 + b1), n++); x1 -= diff;
+ functor(polygon, x2, (x2 + b2), n++); x2 -= diff;
+ functor(polygon, x2, (x2 + b2), n++); x2 -= diff;
+ }
+ functor(polygon, x1, (x1 + b1), n++);
+
+ if (close)
+ {
+ functor(polygon, 25.0, 0.0, 4);
+ }
+}
+
+
+#endif // BOOST_GEOMETRY_STAR_COMB_HPP
+

Added: trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/algorithms/overlay/robustness/star_comb.vcproj 2011-03-11 17:15:16 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="star_comb"
+ ProjectGUID="{6D8C81C1-23CD-469E-8094-E0C01B51E944}"
+ RootNamespace="star_comb"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\star_comb"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG;BOOST_ALL_NO_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalLibraryDirectories=""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\star_comb"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BOOST_ALL_NO_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <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=".\star_comb.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>


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