Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76916 - in trunk: boost/geometry/algorithms boost/geometry/algorithms/detail libs/geometry/test/algorithms
From: barend.gehrels_at_[hidden]
Date: 2012-02-06 15:50:13


Author: barendgehrels
Date: 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
New Revision: 76916
URL: http://svn.boost.org/trac/boost/changeset/76916

Log:
Commented throw_on_empty_input for area, length, perimeter (but not for distance), see comments in throw_on_empty_input.hpp
Text files modified:
   trunk/boost/geometry/algorithms/area.hpp | 4 ++--
   trunk/boost/geometry/algorithms/detail/throw_on_empty_input.hpp | 10 ++++++++++
   trunk/boost/geometry/algorithms/length.hpp | 4 ++--
   trunk/boost/geometry/algorithms/perimeter.hpp | 4 ++--
   trunk/libs/geometry/test/algorithms/area.cpp | 2 +-
   trunk/libs/geometry/test/algorithms/length.cpp | 2 +-
   trunk/libs/geometry/test/algorithms/perimeter.cpp | 2 +-
   7 files changed, 19 insertions(+), 9 deletions(-)

Modified: trunk/boost/geometry/algorithms/area.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/area.hpp (original)
+++ trunk/boost/geometry/algorithms/area.hpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -29,7 +29,7 @@
 
 #include <boost/geometry/algorithms/detail/calculate_null.hpp>
 #include <boost/geometry/algorithms/detail/calculate_sum.hpp>
-#include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
+// #include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
 
 #include <boost/geometry/strategies/area.hpp>
 #include <boost/geometry/strategies/default_area_result.hpp>
@@ -241,7 +241,7 @@
             point_type
>::type strategy_type;
 
- detail::throw_on_empty_input(geometry);
+ // detail::throw_on_empty_input(geometry);
         
     return dispatch::area
         <

Modified: trunk/boost/geometry/algorithms/detail/throw_on_empty_input.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/throw_on_empty_input.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/throw_on_empty_input.hpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -14,6 +14,16 @@
 #include <boost/geometry/core/exception.hpp>
 #include <boost/geometry/algorithms/num_points.hpp>
 
+// BSG 2012-02-06: we use this currently only for distance.
+// For other scalar results area,length,perimeter it is commented on purpose.
+// Reason is that for distance there is no other choice. distance of two
+// empty geometries (or one empty) should NOT return any value.
+// But for area it is no problem to be 0.
+// Suppose: area(intersection(a,b)). We (probably) don't want a throw there...
+
+// So decided that at least for Boost 1.49 this is commented for
+// scalar results, except distance.
+
 namespace boost { namespace geometry
 {
 

Modified: trunk/boost/geometry/algorithms/length.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/length.hpp (original)
+++ trunk/boost/geometry/algorithms/length.hpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -28,7 +28,7 @@
 
 #include <boost/geometry/algorithms/assign.hpp>
 #include <boost/geometry/algorithms/detail/calculate_null.hpp>
-#include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
+// #include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
 #include <boost/geometry/views/closeable_view.hpp>
 #include <boost/geometry/strategies/distance.hpp>
 #include <boost/geometry/strategies/default_length_result.hpp>
@@ -152,7 +152,7 @@
 {
     concept::check<Geometry const>();
 
- detail::throw_on_empty_input(geometry);
+ // detail::throw_on_empty_input(geometry);
 
     typedef typename strategy::distance::services::default_strategy
         <

Modified: trunk/boost/geometry/algorithms/perimeter.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/perimeter.hpp (original)
+++ trunk/boost/geometry/algorithms/perimeter.hpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -22,7 +22,7 @@
 #include <boost/geometry/algorithms/length.hpp>
 #include <boost/geometry/algorithms/detail/calculate_null.hpp>
 #include <boost/geometry/algorithms/detail/calculate_sum.hpp>
-#include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
+// #include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
 
 
 namespace boost { namespace geometry
@@ -98,7 +98,7 @@
             point_tag, point_type
>::type strategy_type;
 
- detail::throw_on_empty_input(geometry);
+ // detail::throw_on_empty_input(geometry);
         
     return dispatch::perimeter
         <

Modified: trunk/libs/geometry/test/algorithms/area.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/area.cpp (original)
+++ trunk/libs/geometry/test/algorithms/area.cpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -242,7 +242,7 @@
 
     test_large_integers();
 
- test_empty_input<bg::model::d2::point_xy<int> >();
+ // test_empty_input<bg::model::d2::point_xy<int> >();
 
     return 0;
 }

Modified: trunk/libs/geometry/test/algorithms/length.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/length.cpp (original)
+++ trunk/libs/geometry/test/algorithms/length.cpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -49,7 +49,7 @@
     test_all<bg::model::d2::point_xy<ttmath_big> >();
 #endif
 
- test_empty_input<bg::model::d2::point_xy<int> >();
+ // test_empty_input<bg::model::d2::point_xy<int> >();
 
     return 0;
 }

Modified: trunk/libs/geometry/test/algorithms/perimeter.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/perimeter.cpp (original)
+++ trunk/libs/geometry/test/algorithms/perimeter.cpp 2012-02-06 15:50:12 EST (Mon, 06 Feb 2012)
@@ -57,7 +57,7 @@
     test_all<bg::model::d2::point_xy<ttmath_big> >();
 #endif
 
- test_empty_input<bg::model::d2::point_xy<int> >();
+ // test_empty_input<bg::model::d2::point_xy<int> >();
 
     return 0;
 }


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