Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67414 - in sandbox/geometry/libs/geometry/test: algorithms algorithms/overlay/robustness multi/algorithms
From: barend.gehrels_at_[hidden]
Date: 2010-12-22 12:45:15


Author: barendgehrels
Date: 2010-12-22 12:45:14 EST (Wed, 22 Dec 2010)
New Revision: 67414
URL: http://svn.boost.org/trac/boost/changeset/67414

Log:
Updated more tests to "open-ness"
Text files modified:
   sandbox/geometry/libs/geometry/test/algorithms/envelope.cpp | 8 ++++++++
   sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp | 11 ++++++++++-
   sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp | 6 +++---
   sandbox/geometry/libs/geometry/test/algorithms/union.cpp | 3 +++
   sandbox/geometry/libs/geometry/test/multi/algorithms/multi_intersection.cpp | 11 +++++++----
   5 files changed, 31 insertions(+), 8 deletions(-)

Modified: sandbox/geometry/libs/geometry/test/algorithms/envelope.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/envelope.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/envelope.cpp 2010-12-22 12:45:14 EST (Wed, 22 Dec 2010)
@@ -26,6 +26,14 @@
     test_envelope<bg::model::linear_ring<P> >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3);
     test_envelope<bg::model::box<P> >("BOX(1 1,3 3)", 1, 3, 1, 3);
 
+ // Triangle, closed and open, and CCW.
+ // Note that for the envelope algorithm,
+ // these combinations should theoretically not differ
+ test_envelope<bg::model::linear_ring<P> >("POLYGON((4 1,0 7,7 9,4 1))", 0, 7, 1, 9);
+ test_envelope<bg::model::linear_ring<P, true, false> >("POLYGON((4 1,0 7,7 9))", 0, 7, 1, 9);
+ test_envelope<bg::model::linear_ring<P, false> >("POLYGON((4 1,7 9,0 7,4 1))", 0, 7, 1, 9);
+ test_envelope<bg::model::linear_ring<P, false, false> >("POLYGON((4 1,7 9,0 7))", 0, 7, 1, 9);
+
     typedef std::pair<P, P> segment_type;
     test_envelope<segment_type>("SEGMENT(1 1,3 3)", 1, 3, 1, 3);
 }

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/intersection_pies.cpp 2010-12-22 12:45:14 EST (Wed, 22 Dec 2010)
@@ -247,13 +247,22 @@
         bool svg = argc > 1 && std::string(argv[1]) == std::string("svg");
         bool multi = argc > 2 && std::string(argv[2]) == std::string("multi");
         bool ccw = argc > 3 && std::string(argv[3]) == std::string("ccw");
+ bool open = argc > 4 && std::string(argv[4]) == std::string("open");
         bool single_selftangent = false; // keep false, true does not work!
 
         // template par's are: CoordinateType, Clockwise, Closed
- if (ccw)
+ if (ccw && open)
+ {
+ test_all<double, false, false>(multi, single_selftangent, svg);
+ }
+ else if (ccw)
         {
             test_all<double, false, true>(multi, single_selftangent, svg);
         }
+ else if (open)
+ {
+ test_all<double, true, false>(multi, single_selftangent, svg);
+ }
         else
         {
             test_all<double, true, true>(multi, single_selftangent, svg);

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/robustness/recursive_polygons.cpp 2010-12-22 12:45:14 EST (Wed, 22 Dec 2010)
@@ -118,7 +118,7 @@
 }
 
 
-template <typename T, bool Clockwise>
+template <typename T, bool Clockwise, bool Closed>
 void test_all(int seed, int count, bool svg, int level)
 {
     boost::timer t;
@@ -133,7 +133,7 @@
 
     typedef bg::model::polygon
         <
- bg::model::d2::point_xy<T>, Clockwise
+ bg::model::d2::point_xy<T>, Clockwise, Closed
             //, true, false
> polygon;
     typedef bg::model::multi_polygon<polygon> mp;
@@ -166,7 +166,7 @@
             ? boost::lexical_cast<int>(argv[4]): 3;
 
         //test_all<float>(seed, count, svg, 1e-3);
- test_all<double, false>(seed, count, svg, level);
+ test_all<double, false, false>(seed, count, svg, level);
 
 #if defined(HAVE_TTMATH)
    // test_recursive_boxes<ttmath_big>(selection, "t");

Modified: sandbox/geometry/libs/geometry/test/algorithms/union.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/union.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/union.cpp 2010-12-22 12:45:14 EST (Wed, 22 Dec 2010)
@@ -234,6 +234,9 @@
     // Counter clockwise
     test_areal<bg::model::linear_ring<P, false>, bg::model::polygon<P, false> >();
 
+ // Counter clockwise and open
+ test_areal<bg::model::linear_ring<P, false, false>, bg::model::polygon<P, false, false> >();
+
     test_one<polygon, box, polygon>("box_ring", example_box, example_ring,
         1, 1, 15, 6.38875);
 

Modified: sandbox/geometry/libs/geometry/test/multi/algorithms/multi_intersection.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/multi/algorithms/multi_intersection.cpp (original)
+++ sandbox/geometry/libs/geometry/test/multi/algorithms/multi_intersection.cpp 2010-12-22 12:45:14 EST (Wed, 22 Dec 2010)
@@ -144,15 +144,18 @@
     typedef bg::model::linear_ring<P, false> ring_ccw;
     typedef bg::model::polygon<P, false> polygon_ccw;
     typedef bg::model::multi_polygon<polygon_ccw> multi_polygon_ccw;
-
     test_areal<ring_ccw, polygon_ccw, multi_polygon_ccw>();
 
     typedef bg::model::linear_ring<P, true, false> ring_open;
     typedef bg::model::polygon<P, true, false> polygon_open;
     typedef bg::model::multi_polygon<polygon_open> multi_polygon_open;
- // TODO: fix next combination (bug somewhere in probably assemble, with open polygon)
- //test_areal<ring_open, polygon_open, multi_polygon_open>();
-
+ test_areal<ring_open, polygon_open, multi_polygon_open>();
+
+ typedef bg::model::linear_ring<P, false, false> ring_open_ccw;
+ typedef bg::model::polygon<P, false, false> polygon_open_ccw;
+ typedef bg::model::multi_polygon<polygon_open_ccw> multi_polygon_open_ccw;
+ test_areal<ring_open_ccw, polygon_open_ccw, multi_polygon_open_ccw>();
+
     test_areal_clip<polygon, multi_polygon, box>();
     test_areal_clip<polygon_ccw, multi_polygon_ccw, box>();
 


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