Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76741 - trunk/boost/geometry/algorithms
From: barend.gehrels_at_[hidden]
Date: 2012-01-28 09:39:48


Author: barendgehrels
Date: 2012-01-28 09:39:47 EST (Sat, 28 Jan 2012)
New Revision: 76741
URL: http://svn.boost.org/trac/boost/changeset/76741

Log:
Fixed subtle bug causing polygons with large integers to be reversed because of the wrongly typed predicate
Text files modified:
   trunk/boost/geometry/algorithms/correct.hpp | 7 ++++---
   1 files changed, 4 insertions(+), 3 deletions(-)

Modified: trunk/boost/geometry/algorithms/correct.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/correct.hpp (original)
+++ trunk/boost/geometry/algorithms/correct.hpp 2012-01-28 09:39:47 EST (Sat, 28 Jan 2012)
@@ -147,7 +147,8 @@
         }
         // Check area
         Predicate predicate;
- coordinate_type const zero = 0;
+ typedef typename default_area_result<Ring>::type area_result_type;
+ area_result_type const zero = area_result_type();
         if (predicate(ring_area_type::apply(r, strategy_type()), zero))
         {
             std::reverse(boost::begin(r), boost::end(r));
@@ -168,7 +169,7 @@
         correct_ring
             <
                 ring_type,
- std::less<coordinate_type>
+ std::less<typename default_area_result<Polygon>::type>
>::apply(exterior_ring(poly));
 
         typename interior_return_type<Polygon>::type rings
@@ -223,7 +224,7 @@
     : detail::correct::correct_ring
         <
             Ring,
- std::less<typename coordinate_type<Ring>::type>
+ std::less<typename default_area_result<Ring>::type>
>
 {};
 


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