Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76860 - in trunk/libs/geometry/test: algorithms strategies
From: barend.gehrels_at_[hidden]
Date: 2012-02-03 16:18:18


Author: barendgehrels
Date: 2012-02-03 16:18:17 EST (Fri, 03 Feb 2012)
New Revision: 76860
URL: http://svn.boost.org/trac/boost/changeset/76860

Log:
Added tests for disjoint (for fixes in previous commit)
Text files modified:
   trunk/libs/geometry/test/algorithms/disjoint.cpp | 51 ++++++++++++++++++++++++++++++++++++++++
   trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp | 5 ---
   2 files changed, 51 insertions(+), 5 deletions(-)

Modified: trunk/libs/geometry/test/algorithms/disjoint.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/disjoint.cpp (original)
+++ trunk/libs/geometry/test/algorithms/disjoint.cpp 2012-02-03 16:18:17 EST (Fri, 03 Feb 2012)
@@ -112,6 +112,57 @@
     test_disjoint<ls, ls>("ls/ls 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
     test_disjoint<segment, segment>("s/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
     test_disjoint<segment, segment>("s/s 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
+
+ // Degenerate linestrings
+ {
+ // Submitted by Zachary on the Boost.Geometry Mailing List, on 2012-01-29
+ std::string const a = "linestring(100 10, 0 10)";
+ std::string const b = "linestring(50 10, 50 10)"; // one point only, with same y-coordinate
+ std::string const c = "linestring(100 10, 100 10)"; // idem, at left side
+ test_disjoint<ls, ls>("dls/dls 1", a, b, false);
+ test_disjoint<ls, ls>("dls/dls 2", b, a, false);
+ test_disjoint<segment, segment>("ds/ds 1", a, b, false);
+ test_disjoint<segment, segment>("ds/ds 2", b, a, false);
+ test_disjoint<ls, ls>("dls/dls 1", a, c, false);
+ }
+
+ // Linestrings making angles normally ignored
+ {
+ // These (non-disjoint) cases
+ // correspond to the test "segment_intersection_collinear"
+
+ // Collinear ('a')
+ // a1---------->a2
+ // b1--->b2
+ test_disjoint<ls, ls>("n1", "linestring(2 0,0 6)", "linestring(0 0,2 0)", false);
+
+ // a1---------->a2
+ // b1--->b2
+ test_disjoint<ls, ls>("n7", "linestring(2 0,6 0)", "linestring(6 0,8 0)", false);
+
+ // Collinear - opposite ('f')
+ // a1---------->a2
+ // b2<---b1
+ test_disjoint<ls, ls>("o1", "linestring(2 0,6 0)", "linestring(2 0,0 0)", false);
+ }
+
+ {
+ // Starting in the middle ('s')
+ // b2
+ // ^
+ // |
+ // |
+ // a1--------b1----->a2
+ test_disjoint<ls, ls>("case_s", "linestring(0 0,4 0)", "linestring(2 0,2 2)", false);
+
+ // Collinear, but disjoint
+ test_disjoint<ls, ls>("c-d", "linestring(2 0,6 0)", "linestring(7 0,8 0)", true);
+
+ // Parallel, disjoint
+ test_disjoint<ls, ls>("c-d", "linestring(2 0,6 0)", "linestring(2 1,6 1)", true);
+
+ }
+
     // TODO test_disjoint<segment, ls>("s/ls 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
     // TODO test_disjoint<segment, ls>("s/ls 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
     // TODO test_disjoint<ls, segment>("ls/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);

Modified: trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp
==============================================================================
--- trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp (original)
+++ trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp 2012-02-03 16:18:17 EST (Fri, 03 Feb 2012)
@@ -58,11 +58,6 @@
                 int expected_x2 = -99, int expected_y2 = -99)
 
 {
-
-//#ifdef REPORT
- std::cout << "Case: " << case_id << std::endl;
-//#endif
-
     typedef typename bg::coordinate_type<P>::type coordinate_type;
     typedef bg::model::referring_segment<const P> segment_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