summaryrefslogtreecommitdiff
path: root/libs/geometry/test/algorithms/detail
diff options
context:
space:
mode:
Diffstat (limited to 'libs/geometry/test/algorithms/detail')
-rw-r--r--libs/geometry/test/algorithms/detail/Jamfile.v216
-rw-r--r--libs/geometry/test/algorithms/detail/detail.sln19
-rw-r--r--libs/geometry/test/algorithms/detail/partition.cpp476
-rw-r--r--libs/geometry/test/algorithms/detail/partition.vcproj174
-rw-r--r--libs/geometry/test/algorithms/detail/sections/Jamfile.v215
-rw-r--r--libs/geometry/test/algorithms/detail/sections/range_by_section.cpp102
-rw-r--r--libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj174
-rw-r--r--libs/geometry/test/algorithms/detail/sections/sectionalize.cpp341
-rw-r--r--libs/geometry/test/algorithms/detail/sections/sectionalize.sln25
-rw-r--r--libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj174
10 files changed, 1516 insertions, 0 deletions
diff --git a/libs/geometry/test/algorithms/detail/Jamfile.v2 b/libs/geometry/test/algorithms/detail/Jamfile.v2
new file mode 100644
index 000000000..015e2be6a
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/Jamfile.v2
@@ -0,0 +1,16 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# 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.
+#
+# Use, modification and distribution is subject to the Boost Software License,
+# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+test-suite boost-geometry-algorithms-detail
+ :
+ [ run partition.cpp ]
+ ;
+
+build-project sections ;
diff --git a/libs/geometry/test/algorithms/detail/detail.sln b/libs/geometry/test/algorithms/detail/detail.sln
new file mode 100644
index 000000000..394921ecc
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/detail.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "partition", "partition.vcproj", "{5EF21715-DB87-41AB-9D0A-59ED04F316A1}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Debug|Win32.Build.0 = Debug|Win32
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Release|Win32.ActiveCfg = Release|Win32
+ {5EF21715-DB87-41AB-9D0A-59ED04F316A1}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/detail/partition.cpp b/libs/geometry/test/algorithms/detail/partition.cpp
new file mode 100644
index 000000000..4bf75529b
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/partition.cpp
@@ -0,0 +1,476 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (c) 2007-2012 Barend Gehrels, 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 <geometry_test_common.hpp>
+
+#include <algorithms/test_overlay.hpp>
+
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/multi/geometries/multi_point.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/geometries/register/point.hpp>
+
+#include <boost/geometry/algorithms/detail/partition.hpp>
+
+#include <boost/geometry/io/wkt/wkt.hpp>
+#include <boost/geometry/multi/io/wkt/wkt.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+#endif
+
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+
+
+template <typename Box>
+struct box_item
+{
+ int id;
+ Box box;
+ box_item(int i = 0, std::string const& wkt = "")
+ : id(i)
+ {
+ if (! wkt.empty())
+ {
+ bg::read_wkt(wkt, box);
+ }
+ }
+};
+
+
+struct get_box
+{
+ template <typename Box, typename InputItem>
+ static inline void apply(Box& total, InputItem const& item)
+ {
+ bg::expand(total, item.box);
+ }
+};
+
+struct ovelaps_box
+{
+ template <typename Box, typename InputItem>
+ static inline bool apply(Box const& box, InputItem const& item)
+ {
+ return ! bg::detail::disjoint::disjoint_box_box(box, item.box);
+ }
+};
+
+
+template <typename Box>
+struct box_visitor
+{
+ int count;
+ typename bg::default_area_result<Box>::type area;
+
+ box_visitor()
+ : count(0)
+ , area(0)
+ {}
+
+ template <typename Item>
+ inline void apply(Item const& item1, Item const& item2)
+ {
+ if (bg::intersects(item1.box, item2.box))
+ {
+ Box b;
+ bg::intersection(item1.box, item2.box, b);
+ area += bg::area(b);
+ count++;
+ }
+ }
+};
+
+
+
+template <typename Box>
+void test_boxes(std::string const& wkt_box_list, double expected_area, int expected_count)
+{
+ std::vector<std::string> wkt_boxes;
+
+ boost::split(wkt_boxes, wkt_box_list, boost::is_any_of(";"), boost::token_compress_on);
+
+ typedef box_item<Box> sample;
+ std::vector<sample> boxes;
+
+ int index = 1;
+ BOOST_FOREACH(std::string const& wkt, wkt_boxes)
+ {
+ boxes.push_back(sample(index++, wkt));
+ }
+
+ box_visitor<Box> visitor;
+ bg::partition
+ <
+ Box, get_box, ovelaps_box
+ >::apply(boxes, visitor, 1);
+
+ BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+}
+
+
+
+struct point_item
+{
+ point_item()
+ : id(0)
+ {}
+
+ int id;
+ double x;
+ double y;
+};
+
+BOOST_GEOMETRY_REGISTER_POINT_2D(point_item, double, cs::cartesian, x, y)
+
+
+struct get_point
+{
+ template <typename Box, typename InputItem>
+ static inline void apply(Box& total, InputItem const& item)
+ {
+ bg::expand(total, item);
+ }
+};
+
+struct ovelaps_point
+{
+ template <typename Box, typename InputItem>
+ static inline bool apply(Box const& box, InputItem const& item)
+ {
+ return ! bg::disjoint(item, box);
+ }
+};
+
+
+struct point_visitor
+{
+ int count;
+
+ point_visitor()
+ : count(0)
+ {}
+
+ template <typename Item>
+ inline void apply(Item const& item1, Item const& item2)
+ {
+ if (bg::equals(item1, item2))
+ {
+ count++;
+ }
+ }
+};
+
+
+
+void test_points(std::string const& wkt1, std::string const& wkt2, int expected_count)
+{
+ bg::model::multi_point<point_item> mp1, mp2;
+ bg::read_wkt(wkt1, mp1);
+ bg::read_wkt(wkt2, mp2);
+
+ int id = 1;
+ BOOST_FOREACH(point_item& p, mp1)
+ { p.id = id++; }
+ id = 1;
+ BOOST_FOREACH(point_item& p, mp2)
+ { p.id = id++; }
+
+ point_visitor visitor;
+ bg::partition
+ <
+ bg::model::box<point_item>, get_point, ovelaps_point
+ >::apply(mp1, mp2, visitor, 1);
+
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+}
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::box<P> box;
+
+ test_boxes<box>(
+ // 1 2 3 4 5 6 7
+ "box(0 0,1 1); box(0 0,2 2); box(9 9,10 10); box(8 8,9 9); box(4 4,6 6); box(2 4,6 8); box(7 1,8 2)",
+ 5, // Area(Intersection(1,2)) + A(I(5,6))
+ 3);
+
+ test_boxes<box>(
+ "box(0 0,10 10); box(4 4,6 6); box(3 3,7 7)",
+ 4 + 16 + 4, // A(I(1,2)) + A(I(1,3)) + A(I(2,3))
+ 3);
+
+ test_boxes<box>(
+ "box(0 2,10 3); box(3 1,4 5); box(7 1,8 5)",
+ 1 + 1, // A(I(1,2)) + A(I(1,3))
+ 2);
+
+ test_points("multipoint((1 1))", "multipoint((1 1))", 1);
+ test_points("multipoint((0 0),(1 1),(7 3),(10 10))", "multipoint((1 1),(2 2),(7 3))", 2);
+
+}
+
+//------------------- higher volumes
+
+template <typename SvgMapper>
+struct svg_visitor
+{
+ SvgMapper& m_mapper;
+
+ svg_visitor(SvgMapper& mapper)
+ : m_mapper(mapper)
+ {}
+
+ template <typename Box>
+ inline void apply(Box const& box, int level)
+ {
+ /*
+ std::string color("rgb(64,64,64)");
+ switch(level)
+ {
+ case 0 : color = "rgb(255,0,0)"; break;
+ case 1 : color = "rgb(0,255,0)"; break;
+ case 2 : color = "rgb(0,0,255)"; break;
+ case 3 : color = "rgb(255,255,0)"; break;
+ case 4 : color = "rgb(255,0,255)"; break;
+ case 5 : color = "rgb(0,255,255)"; break;
+ case 6 : color = "rgb(255,128,0)"; break;
+ case 7 : color = "rgb(0,128,255)"; break;
+ }
+ std::ostringstream style;
+ style << "fill:none;stroke-width:" << (5.0 - level / 2.0) << ";stroke:" << color << ";";
+ m_mapper.map(box, style.str());
+ */
+ m_mapper.map(box, "fill:none;stroke-width:2;stroke:rgb(0,0,0);");
+
+ }
+};
+
+
+
+
+template <typename Collection>
+void fill_points(Collection& collection, int seed, int size, int count)
+{
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, size - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ std::set<std::pair<int, int> > included;
+
+ int n = 0;
+ for (int i = 0; n < count && i < count*count; i++)
+ {
+ int x = coordinate_generator();
+ int y = coordinate_generator();
+ std::pair<int, int> pair = std::make_pair(x, y);
+ if (included.find(pair) == included.end())
+ {
+ included.insert(pair);
+ typename boost::range_value<Collection>::type item;
+ item.x = x;
+ item.y = y;
+ collection.push_back(item);
+ n++;
+ }
+ }
+}
+
+void test_many_points(int seed, int size, int count)
+{
+ bg::model::multi_point<point_item> mp1, mp2;
+
+ fill_points(mp1, seed, size, count);
+ fill_points(mp2, seed * 2, size, count);
+
+ // Test equality in quadratic loop
+ int expected_count = 0;
+ BOOST_FOREACH(point_item const& item1, mp1)
+ {
+ BOOST_FOREACH(point_item const& item2, mp2)
+ {
+ if (bg::equals(item1, item2))
+ {
+ expected_count++;
+ }
+ }
+ }
+
+#if defined(TEST_WITH_SVG)
+ std::ostringstream filename;
+ filename << "partition" << seed << ".svg";
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_item> mapper(svg, 800, 800);
+
+ {
+ point_item p;
+ p.x = -1; p.y = -1; mapper.add(p);
+ p.x = size + 1; p.y = size + 1; mapper.add(p);
+ }
+
+ typedef svg_visitor<bg::svg_mapper<point_item> > box_visitor_type;
+ box_visitor_type box_visitor(mapper);
+#else
+ typedef bg::visit_no_policy box_visitor_type;
+ box_visitor_type box_visitor;
+#endif
+
+ point_visitor visitor;
+ bg::partition
+ <
+ bg::model::box<point_item>, get_point, ovelaps_point,
+ box_visitor_type
+ >::apply(mp1, mp2, visitor, 2, box_visitor);
+
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+
+#if defined(TEST_WITH_SVG)
+ BOOST_FOREACH(point_item const& item, mp1)
+ {
+ mapper.map(item, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8);
+ }
+ BOOST_FOREACH(point_item const& item, mp2)
+ {
+ mapper.map(item, "fill:rgb(0,128,255);stroke:rgb(0,0,100);stroke-width:1", 4);
+ }
+#endif
+}
+
+template <typename Collection>
+void fill_boxes(Collection& collection, int seed, int size, int count)
+{
+ typedef boost::minstd_rand base_generator_type;
+
+ base_generator_type generator(seed);
+
+ boost::uniform_int<> random_coordinate(0, size * 10 - 1);
+ boost::variate_generator<base_generator_type&, boost::uniform_int<> >
+ coordinate_generator(generator, random_coordinate);
+
+ int n = 0;
+ for (int i = 0; n < count && i < count*count; i++)
+ {
+ int w = coordinate_generator() % 30;
+ int h = coordinate_generator() % 30;
+ if (w > 0 && h > 0)
+ {
+ int x = coordinate_generator();
+ int y = coordinate_generator();
+ if (x + w < size * 10 && y + h < size * 10)
+ {
+ typename boost::range_value<Collection>::type item(n+1);
+ bg::assign_values(item.box, x / 10.0, y / 10.0, (x + w) / 10.0, (y + h) / 10.0);
+ collection.push_back(item);
+ n++;
+ }
+ }
+ }
+}
+
+
+
+void test_many_boxes(int seed, int size, int count)
+{
+ typedef bg::model::box<point_item> box_type;
+ std::vector<box_item<box_type> > boxes;
+
+ fill_boxes(boxes, seed, size, count);
+
+ // Test equality in quadratic loop
+ int expected_count = 0;
+ double expected_area = 0.0;
+ BOOST_FOREACH(box_item<box_type> const& item1, boxes)
+ {
+ BOOST_FOREACH(box_item<box_type> const& item2, boxes)
+ {
+ if (item1.id < item2.id)
+ {
+ if (bg::intersects(item1.box, item2.box))
+ {
+ box_type b;
+ bg::intersection(item1.box, item2.box, b);
+ expected_area += bg::area(b);
+ expected_count++;
+ }
+ }
+ }
+ }
+
+
+#if defined(TEST_WITH_SVG)
+ std::ostringstream filename;
+ filename << "partition_box_" << seed << ".svg";
+ std::ofstream svg(filename.str().c_str());
+
+ bg::svg_mapper<point_item> mapper(svg, 800, 800);
+
+ {
+ point_item p;
+ p.x = -1; p.y = -1; mapper.add(p);
+ p.x = size + 1; p.y = size + 1; mapper.add(p);
+ }
+
+ BOOST_FOREACH(box_item<box_type> const& item, boxes)
+ {
+ mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1");
+ }
+
+ typedef svg_visitor<bg::svg_mapper<point_item> > partition_visitor_type;
+ partition_visitor_type partition_visitor(mapper);
+
+
+ box_visitor<box_type> visitor;
+ bg::partition
+ <
+ box_type, get_box, ovelaps_box,
+ partition_visitor_type
+ >::apply(boxes, visitor, 2, partition_visitor);
+
+ BOOST_CHECK_EQUAL(visitor.count, expected_count);
+ BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
+
+#endif
+}
+
+
+
+
+
+int test_main( int , char* [] )
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ test_many_points(12345, 20, 40);
+ test_many_points(54321, 20, 60);
+ test_many_points(67890, 20, 80);
+ test_many_points(98765, 20, 100);
+ for (int i = 1; i < 10; i++)
+ {
+ test_many_points(i, 30, i * 20);
+ }
+
+ test_many_boxes(12345, 20, 40);
+ for (int i = 1; i < 10; i++)
+ {
+ test_many_boxes(i, 20, i * 10);
+ }
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/detail/partition.vcproj b/libs/geometry/test/algorithms/detail/partition.vcproj
new file mode 100644
index 000000000..66e26a973
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/partition.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="partition"
+ ProjectGUID="{5EF21715-DB87-41AB-9D0A-59ED04F316A1}"
+ RootNamespace="partition"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\partition"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ 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)\partition"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <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>
+ <File
+ RelativePath=".\partition.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/detail/sections/Jamfile.v2 b/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
new file mode 100644
index 000000000..973ed75f6
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/Jamfile.v2
@@ -0,0 +1,15 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# 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.
+#
+# Use, modification and distribution is subject to the Boost Software License,
+# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+test-suite boost-geometry-algorithms-detail-sections
+ :
+ [ run sectionalize.cpp ]
+ [ run range_by_section.cpp ]
+ ;
diff --git a/libs/geometry/test/algorithms/detail/sections/range_by_section.cpp b/libs/geometry/test/algorithms/detail/sections/range_by_section.cpp
new file mode 100644
index 000000000..e1d1bca1d
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/range_by_section.cpp
@@ -0,0 +1,102 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2010-2012 Barend Gehrels, 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 <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
+#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
+#include <boost/geometry/views/detail/range_type.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/io/wkt/wkt.hpp>
+
+
+
+template <int DimensionCount, bool Reverse, typename Geometry>
+void test_sectionalize(std::string const caseid, Geometry const& geometry, std::size_t section_count)
+{
+ typedef typename bg::point_type<Geometry>::type point;
+ typedef bg::model::box<point> box;
+ typedef bg::sections<box, DimensionCount> sections;
+
+ sections s;
+ bg::sectionalize<Reverse>(geometry, s);
+
+ BOOST_CHECK_EQUAL(s.size(), section_count);
+
+ typedef typename bg::closeable_view
+ <
+ typename bg::detail::range_type<Geometry>::type const,
+ bg::closure<Geometry>::value
+ >::type cview_type;
+ typedef typename bg::reversible_view
+ <
+ cview_type const,
+ Reverse ? bg::iterate_reverse : bg::iterate_forward
+ >::type view_type;
+ typedef typename boost::range_iterator
+ <
+ view_type const
+ >::type range_iterator;
+
+ BOOST_FOREACH(typename sections::value_type const& sec, s)
+ {
+ cview_type cview(bg::range_by_section(geometry, sec));
+ view_type view(cview);
+ range_iterator it1 = boost::begin(view) + sec.begin_index;
+ range_iterator it2 = boost::begin(view) + sec.end_index;
+ int count = 0;
+ for (range_iterator it = it1; it != it2; ++it)
+ {
+ count++;
+ }
+ BOOST_CHECK_EQUAL(int(sec.count), count);
+ }
+}
+
+template <typename Geometry, bool Reverse>
+void test_sectionalize(std::string const& caseid, std::string const& wkt,
+ std::size_t count1)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ if (bg::closure<Geometry>::value == bg::open)
+ {
+ geometry.outer().resize(geometry.outer().size() - 1);
+ }
+ //bg::correct(geometry);
+ test_sectionalize<1, Reverse>(caseid + "_d1", geometry, count1);
+}
+
+template <typename P>
+void test_all()
+{
+ std::string const first = "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))";
+ test_sectionalize<bg::model::polygon<P>, false>("first", first, 4);
+
+ test_sectionalize<bg::model::polygon<P, false>, true>("first_reverse",
+ first, 4);
+
+ test_sectionalize<bg::model::polygon<P, false, true>, false>("first_open",
+ first, 4);
+
+ test_sectionalize<bg::model::polygon<P, true, false>, true>("first_open_reverse",
+ first, 4);
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj b/libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj
new file mode 100644
index 000000000..0d7ffb6cf
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/range_by_section.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="range_by_section"
+ ProjectGUID="{A91434CB-CB32-48AE-8C74-81B6A1EB342F}"
+ RootNamespace="range_by_section"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\range_by_section"
+ 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;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ 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)\range_by_section"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <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>
+ <File
+ RelativePath=".\range_by_section.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp b/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp
new file mode 100644
index 000000000..762190704
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/sectionalize.cpp
@@ -0,0 +1,341 @@
+// 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)
+
+#include <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/io/wkt/write.hpp>
+
+
+#include <test_common/test_point.hpp>
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/io/svg/svg_mapper.hpp>
+# include <boost/geometry/algorithms/buffer.hpp>
+# include <boost/geometry/algorithms/centroid.hpp>
+#endif
+
+
+
+template <int DimensionCount, typename Geometry>
+void test_sectionalize_part()
+{
+ typedef typename bg::point_type<Geometry>::type point_type;
+ typedef bg::model::box<point_type> box_type;
+
+ typedef bg::sections<box_type, DimensionCount> sections_type;
+ typedef typename boost::range_value<sections_type>::type section_type;
+
+ typedef bg::detail::sectionalize::sectionalize_part
+ <
+ Geometry, point_type, sections_type, 1, 10
+ > sectionalize_part;
+
+ sections_type sections;
+ section_type section;
+
+
+ Geometry geometry;
+ geometry.push_back(bg::make<point_type>(1, 1));
+
+ bg::ring_identifier ring_id;
+ int index = 0;
+ int ndi = 0;
+ sectionalize_part::apply(sections, section, index, ndi, geometry, ring_id);
+ // There should not yet be anything generated, because it is only ONE point
+
+ geometry.push_back(bg::make<point_type>(2, 2));
+ sectionalize_part::apply(sections, section, index, ndi, geometry, ring_id);
+
+}
+
+
+template <int DimensionCount, bool Reverse, typename G>
+void test_sectionalize(std::string const caseid, G const& g, std::size_t section_count,
+ std::string const& index_check, std::string const& dir_check)
+{
+ typedef typename bg::point_type<G>::type point;
+ typedef bg::model::box<point> box;
+ typedef bg::sections<box, DimensionCount> sections;
+
+ sections s;
+ bg::sectionalize<Reverse>(g, s);
+
+ BOOST_CHECK_EQUAL(s.size(), section_count);
+
+ // Check if sections are consecutive and consistent
+ int previous_index = -1;
+ BOOST_FOREACH(typename sections::value_type const& sec, s)
+ {
+ if (sec.begin_index > 0)
+ {
+ BOOST_CHECK_EQUAL(previous_index, sec.begin_index);
+ }
+ BOOST_CHECK_EQUAL(int(sec.count), int(sec.end_index - sec.begin_index));
+ previous_index = sec.end_index;
+ }
+
+ // Output streams for sections, boxes, other
+ std::ostringstream out_sections;
+ std::ostringstream out_boxes;
+ std::ostringstream out_dirs;
+
+
+ for (typename sections::size_type i = 0; i < s.size(); i++)
+ {
+ box const& b = s[i].bounding_box;
+
+ if (i > 0)
+ {
+ out_sections << "|";
+ out_dirs << "|";
+ out_boxes << "|";
+ }
+
+ out_sections << s[i].begin_index << ".." << s[i].end_index;
+ out_boxes << bg::get<0,0>(b) << " " << bg::get<0,1>(b)
+ << ".." << bg::get<1,0>(b) << " " << bg::get<1,1>(b);
+ for (int d = 0; d < DimensionCount; d++)
+ {
+ out_dirs << (d == 0 ? "" : " ");
+ switch(s[i].directions[d])
+ {
+ case -99: out_dirs << "DUP"; break;
+ case -1 : out_dirs << "-"; break;
+ case 0 : out_dirs << "."; break;
+ case +1 : out_dirs << "+"; break;
+ }
+ }
+ }
+
+ if (! index_check.empty())
+ {
+ BOOST_CHECK_EQUAL(out_sections.str(), index_check);
+ }
+ if (! dir_check.empty())
+ {
+ BOOST_CHECK_EQUAL(out_dirs.str(), dir_check);
+ }
+ else
+ {
+ if (out_sections.str().length() < 80)
+ {
+ std::cout << std::endl << bg::wkt(g) << std::endl;
+ std::cout << out_sections.str() << std::endl;
+ //std::cout << out_boxes.str() << std::endl;
+ }
+ std::cout << out_dirs.str() << std::endl;
+ }
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "sectionalize_"
+ << caseid << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ typedef typename bg::point_type<G>::type point_type;
+ bg::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(g);
+
+ static const bool is_line = bg::geometry_id<G>::type::value == 2;
+ mapper.map(g, is_line
+ ? "opacity:0.6;stroke:rgb(0,0,255);stroke-width:5"
+ : "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:0.5");
+
+
+ for (typename sections::size_type i = 0; i < s.size(); i++)
+ {
+ box b = s[i].bounding_box;
+ bg::buffer(b, b, 0.01);
+ mapper.map(b, s[i].duplicate
+ ? "fill-opacity:0.4;stroke-opacity:0.6;fill:rgb(0,128,0);stroke:rgb(0,255,0);stroke-width:2.0"
+ : "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);stroke:rgb(255,0,0);stroke-width:0.5");
+
+ std::ostringstream out;
+
+ for (int d = 0; d < DimensionCount; d++)
+ {
+ out << (d == 0 ? "[" : " ");
+ switch(s[i].directions[d])
+ {
+ case -99: out << "DUP"; break;
+ case -1 : out << "-"; break;
+ case 0 : out << "."; break;
+ case +1 : out << "+"; break;
+ }
+ }
+ out << "] " << s[i].begin_index << ".." << s[i].end_index;
+
+
+ point_type p;
+ bg::centroid(b, p);
+ mapper.text(p, out.str(), "");
+ }
+ }
+#endif
+
+}
+
+template <typename G, bool Reverse>
+void test_sectionalize(std::string const& caseid, std::string const& wkt,
+ std::size_t count2, std::string const& s2, std::string const d2,
+ std::size_t count1, std::string const& s1, std::string const d1)
+{
+ G g;
+ bg::read_wkt(wkt, g);
+ test_sectionalize<2, Reverse>(caseid + "_d2", g, count2, s2, d2);
+ test_sectionalize<1, Reverse>(caseid + "_d1", g, count1, s1, d1);
+}
+
+template <typename P>
+void test_all()
+{
+ test_sectionalize_part<1, bg::model::linestring<P> >();
+
+ test_sectionalize<bg::model::linestring<P>, false>("ls",
+ "LINESTRING(1 1,2 2,3 0,5 0,5 8)",
+ 4, "0..1|1..2|2..3|3..4", "+ +|+ -|+ .|. +",
+ 2, "0..3|3..4", "+|.");
+
+ // These strings mean:
+ // 0..1|1..2 -> first section: [0, 1] | second section [1, 2], etc
+ // + +|+ - -> X increases, Y increases | X increases, Y decreases
+ // +|. -> (only X considered) X increases | X constant
+
+ test_sectionalize<bg::model::polygon<P>, false>("simplex",
+ "POLYGON((0 0,0 7,4 2,2 0,0 0))",
+ 4, "0..1|1..2|2..3|3..4", ". +|+ -|- -|- .",
+ // . + - - -> 3 sections
+ 3, "0..1|1..2|2..4", ".|+|-");
+
+ // CCW polygon - orientation is not (always) relevant for sections,
+ // they are just generated in the order they come.
+ test_sectionalize<bg::model::polygon<P, false>, false>("simplex_ccw",
+ "POLYGON((0 0,2 0,4 2,0 7,0 0))",
+ 4, "0..1|1..2|2..3|3..4", "+ .|+ +|- +|. -",
+ // . + - - -> 3 sections
+ 3, "0..2|2..3|3..4", "+|-|.");
+
+ // Open polygon - closeness IS relevant for sections, the
+ // last section which is not explicit here should be included.
+ // So results are the same as the pre-previous one.
+ test_sectionalize<bg::model::polygon<P, true, false>, false>("simplex_open",
+ "POLYGON((0 0,0 7,4 2,2 0))",
+ 4, "0..1|1..2|2..3|3..4", ". +|+ -|- -|- .",
+ // . + - - -> 3 sections
+ 3, "0..1|1..2|2..4", ".|+|-");
+
+ test_sectionalize<bg::model::polygon<P>, false>("first",
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 8, "0..2|2..3|3..4|4..5|5..6|6..8|8..10|10..11", "+ +|+ -|+ +|- +|+ +|+ -|- -|- +",
+ 4, "0..4|4..5|5..8|8..11", "+|-|+|-");
+
+ test_sectionalize<bg::model::polygon<P, false>, true>("first_reverse",
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 8, "0..1|1..3|3..5|5..6|6..7|7..8|8..9|9..11", "+ -|+ +|- +|- -|+ -|- -|- +|- -",
+ 4, "0..3|3..6|6..7|7..11", "+|-|+|-");
+
+ test_sectionalize<bg::model::polygon<P>, false>("second",
+ "POLYGON((3 1,2 2,1 3,2 4,3 5,4 4,5 3,4 2,3 1))",
+ 4, "0..2|2..4|4..6|6..8", "- +|+ +|+ -|- -",
+ // - - - + + + + - - -> 3 sections
+ 3, "0..2|2..6|6..8", "-|+|-");
+
+ // With holes
+ test_sectionalize<bg::model::polygon<P>, false>("with_holes",
+ "POLYGON((3 1,2 2,1 3,2 4,3 5,4 4,5 3,4 2,3 1), (3 2,2 2,3 4,3 2))",
+ 7, "0..2|2..4|4..6|6..8|0..1|1..2|2..3", "- +|+ +|+ -|- -|- .|+ +|. -",
+ // - - - + + + + - - - + . -> 6 sections
+ 6, "0..2|2..6|6..8|0..1|1..2|2..3", "-|+|-|-|+|.");
+
+ // With duplicates
+ test_sectionalize<bg::model::linestring<P>, false>("with_dups",
+ "LINESTRING(1 1,2 2,3 0,3 0,5 0,5 8)",
+ 5, "0..1|1..2|2..3|3..4|4..5", "+ +|+ -|DUP DUP|+ .|. +",
+ 4, "0..2|2..3|3..4|4..5", "+|DUP|+|.");
+ // With two subsequent duplicate segments
+ test_sectionalize<bg::model::linestring<P>, false>("with_subseq_dups",
+ "LINESTRING(1 1,2 2,3 0,3 0,3 0,5 0,5 0,5 0,5 0,5 8)",
+ 6, "0..1|1..2|2..4|4..5|5..8|8..9", "+ +|+ -|DUP DUP|+ .|DUP DUP|. +",
+ 5, "0..2|2..4|4..5|5..8|8..9", "+|DUP|+|DUP|.");
+
+
+ typedef bg::model::box<P> B;
+ test_sectionalize<2, false, B>("box2", bg::make<B>(0,0,4,4),
+ 4, "0..1|1..2|2..3|3..4", ". +|+ .|. -|- .");
+ test_sectionalize<1, false, B>("box1", bg::make<B>(0,0,4,4),
+ 4, "0..1|1..2|2..3|3..4", ".|+|.|-");
+
+ return;
+ // Buffer-case
+ test_sectionalize<bg::model::polygon<P>, false>("buffer",
+ "POLYGON((-1.1713 0.937043,2.8287 5.93704,2.90334 6.02339,2.98433 6.10382,2.98433 6.10382,3.07121 6.17786,3.16346 6.24507,3.16346 6.24507,3.16346 6.24507,3.26056 6.30508,3.36193 6.35752,3.36193 6.35752,3.46701 6.40211,3.57517 6.43858,3.57517 6.43858,3.57517 6.43858,3.57517 6.43858,3.68579 6.46672,3.79822 6.48637,3.79822 6.48637,3.91183 6.49741,4.02595 6.49978,4.02595 6.49978,4.02595 6.49978,4.13991 6.49346,4.25307 6.4785,4.25307 6.4785,4.36476 6.45497,4.47434 6.42302,4.47434 6.42302,4.47434 6.42302,4.47434 6.42302,7.47434 5.42302,6.84189 3.52566,4.39043 4.68765,0.390434 -0.312348,-1.1713 0.937043))",
+ 8, "0..2|2..3|3..4|4..5|5..6|6..8|8..10|10..11", "+ +|+ -|+ +|- +|+ +|+ -|- -|- +",
+ 4, "0..4|4..5|5..8|8..11", "+|-|+|-");
+}
+
+void test_large_integers()
+{
+ typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+
+ std::string const polygon_li = "POLYGON((1872000 528000,1872000 192000,1536119 192000,1536000 528000,1200000 528000,1200000 863880,1536000 863880,1872000 863880,1872000 528000))";
+ bg::model::polygon<int_point_type> int_poly;
+ bg::model::polygon<double_point_type> double_poly;
+ bg::read_wkt(polygon_li, int_poly);
+ bg::read_wkt(polygon_li, double_poly);
+
+ bg::sections<bg::model::box<int_point_type>, 1> int_sections;
+ bg::sections<bg::model::box<double_point_type>, 1> double_sections;
+
+ bg::sectionalize<false>(int_poly, int_sections);
+ bg::sectionalize<false>(double_poly, double_sections);
+
+ bool equally_sized = int_sections.size() == double_sections.size();
+ BOOST_CHECK(equally_sized);
+ if (! equally_sized)
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < int_sections.size(); i++)
+ {
+ BOOST_CHECK(int_sections[i].begin_index == double_sections[i].begin_index);
+ BOOST_CHECK(int_sections[i].count == double_sections[i].count);
+ }
+
+}
+
+
+int test_main(int, char* [])
+{
+ test_large_integers();
+
+ //test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+ return 0;
+}
diff --git a/libs/geometry/test/algorithms/detail/sections/sectionalize.sln b/libs/geometry/test/algorithms/detail/sections/sectionalize.sln
new file mode 100644
index 000000000..5b2ae402b
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/sectionalize.sln
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sectionalize", "sectionalize.vcproj", "{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "range_by_section", "range_by_section.vcproj", "{A91434CB-CB32-48AE-8C74-81B6A1EB342F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Debug|Win32.Build.0 = Debug|Win32
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Release|Win32.ActiveCfg = Release|Win32
+ {50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Release|Win32.Build.0 = Release|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Debug|Win32.Build.0 = Debug|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Release|Win32.ActiveCfg = Release|Win32
+ {A91434CB-CB32-48AE-8C74-81B6A1EB342F}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj b/libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj
new file mode 100644
index 000000000..7c7ee5ac8
--- /dev/null
+++ b/libs/geometry/test/algorithms/detail/sections/sectionalize.vcproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sectionalize"
+ ProjectGUID="{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
+ RootNamespace="sectionalize"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\sectionalize"
+ 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;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ 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)\sectionalize"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <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>
+ <File
+ RelativePath=".\sectionalize.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>