|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69584 - in trunk/boost/geometry: algorithms algorithms/detail/overlay geometries/adapted/boost_polygon
From: barend.gehrels_at_[hidden]
Date: 2011-03-05 17:23:31
Author: barendgehrels
Date: 2011-03-05 17:23:29 EST (Sat, 05 Mar 2011)
New Revision: 69584
URL: http://svn.boost.org/trac/boost/changeset/69584
Log:
Fixed TODO item from list for better reversal of ccw polygons
Text files modified:
trunk/boost/geometry/algorithms/detail/overlay/get_turns.hpp | 2 +-
trunk/boost/geometry/algorithms/detail/overlay/overlay.hpp | 19 +++++--------------
trunk/boost/geometry/algorithms/intersection.hpp | 2 +-
trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp | 1 +
4 files changed, 8 insertions(+), 16 deletions(-)
Modified: trunk/boost/geometry/algorithms/detail/overlay/get_turns.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/overlay/get_turns.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/overlay/get_turns.hpp 2011-03-05 17:23:29 EST (Sat, 05 Mar 2011)
@@ -447,7 +447,7 @@
// Divide the complete box in two (alternating) halves
Box lower = box, upper = box;
- typename geometry::coordinate_type<Box>::type two = 2.0;
+ typename geometry::coordinate_type<Box>::type two = 2;
typename geometry::coordinate_type<Box>::type mid
= (geometry::get<min_corner, Dimension>(box)
+ geometry::get<max_corner, Dimension>(box)) / two;
Modified: trunk/boost/geometry/algorithms/detail/overlay/overlay.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/overlay/overlay.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/overlay/overlay.hpp 2011-03-05 17:23:29 EST (Sat, 05 Mar 2011)
@@ -194,6 +194,9 @@
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
std::cout << "traverse" << std::endl;
#endif
+ // Traverse through intersection/turn points and create rings of them.
+ // Note that these rings are always in clockwise order, even in CCW polygons,
+ // and are marked as "to be reversed" below
ring_container_type rings;
geometry::traverse<Reverse1, Reverse2>(geometry1, geometry2,
Direction == overlay_union
@@ -201,19 +204,6 @@
: boost::geometry::detail::overlay::operation_intersection,
turn_points, rings);
- // TEMP condition, reversal should be done in traverse by calling "push_front"
- if (ReverseOut)
- {
- for (typename boost::range_iterator<ring_container_type>::type
- it = boost::begin(rings);
- it != boost::end(rings);
- ++it)
- {
- geometry::reverse(*it);
- }
- }
-
-
std::map<ring_identifier, int> map;
map_turns(map, turn_points);
@@ -222,7 +212,7 @@
std::map<ring_identifier, properties> selected;
select_rings<Direction>(geometry1, geometry2, map, selected);
- // Add rings from intersection container
+ // Add rings created during traversal
{
ring_identifier id(2, 0, -1);
for (typename boost::range_iterator<ring_container_type>::type
@@ -231,6 +221,7 @@
++it)
{
selected[id] = properties(*it);
+ selected[id].reversed = ReverseOut;
id.multi_index++;
}
}
Modified: trunk/boost/geometry/algorithms/intersection.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/intersection.hpp (original)
+++ trunk/boost/geometry/algorithms/intersection.hpp 2011-03-05 17:23:29 EST (Sat, 05 Mar 2011)
@@ -111,7 +111,7 @@
Geometry1, Geometry2,
detail::overlay::do_reverse<geometry::point_order<Geometry1>::value, false>::value,
detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, false>::value,
- false,
+ detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
output_iterator, OneOut,
overlay_intersection,
Strategy
Modified: trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp
==============================================================================
--- trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp (original)
+++ trunk/boost/geometry/geometries/adapted/boost_polygon/ring.hpp 2011-03-05 17:23:29 EST (Sat, 05 Mar 2011)
@@ -18,6 +18,7 @@
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/core/tags.hpp>
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