Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64936 - in sandbox/SOC/2010/sweepline: boost/sweepline boost/sweepline/detail libs/sweepline/test libs/sweepline/test/voronoi_point libs/sweepline/test/voronoi_segment
From: sydorchuk.andriy_at_[hidden]
Date: 2010-08-20 08:44:13


Author: asydorchuk
Date: 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
New Revision: 64936
URL: http://svn.boost.org/trac/boost/changeset/64936

Log:
Fixed point-segment predicate.
Added segment-segment predicate.
Added point-segment and segment-segment predicates tests.
Added orientation tests for the hole integer range.
Added:
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_predicates_test.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp | 170 +++++++++--
   sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp | 5
   sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_sweepline.hpp | 1
   sandbox/SOC/2010/sweepline/libs/sweepline/test/Jamfile.v2 | 1
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_queue_test.cpp | 132 ++++----
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_types_test.cpp | 238 ++++++++--------
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/node_comparer_test.cpp | 510 +++++++++++++++++-----------------
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_benchmark_test.cpp | 118 +++---
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_clipping_test.cpp | 592 ++++++++++++++++++++--------------------
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp | 2
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp | 59 ++-
   sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp | 41 +-
   12 files changed, 1000 insertions(+), 869 deletions(-)

Modified: sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp
==============================================================================
--- sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp (original)
+++ sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -55,12 +55,18 @@
         return (dif <= maxUlps) && (dif >= -maxUlps);
     }
 
+ enum kOrientation {
+ RIGHT_ORIENTATION = -1,
+ COLINEAR = 0,
+ LEFT_ORIENTATION = 1,
+ };
+
     // TODO(asydorchuk): Make templates specification for integer coordinate type,
     // as it is actually working with integer input.
     template <typename T>
- bool right_orientation_test(const point_2d<T> &point1,
- const point_2d<T> &point2,
- const point_2d<T> &point3) {
+ kOrientation orientation_test(const point_2d<T> &point1,
+ const point_2d<T> &point2,
+ const point_2d<T> &point3) {
         typedef long long ll;
         typedef unsigned long long ull;
         ull dif_x1, dif_x2, dif_y1, dif_y2;
@@ -87,16 +93,19 @@
         if (expr_r == 0)
             expr_r_plus = true;
         
+ if ((expr_l_plus == expr_r_plus) && (expr_l == expr_r))
+ return COLINEAR;
+
         if (!expr_l_plus) {
             if (expr_r_plus)
- return true;
+ return RIGHT_ORIENTATION;
             else
- return expr_l > expr_r;
+ return (expr_l > expr_r) ? RIGHT_ORIENTATION : LEFT_ORIENTATION;
         } else {
             if (!expr_r_plus)
- return false;
+ return LEFT_ORIENTATION;
             else
- return expr_l < expr_r;
+ return (expr_l < expr_r) ? RIGHT_ORIENTATION : LEFT_ORIENTATION;
         }
     }
 
@@ -202,12 +211,10 @@
                                           bool reverse_order) {
         typedef long long ll;
         typedef unsigned long long ull;
- bool is_right_oriented1 = right_orientation_test(segment_start,
- segment_end,
- site_point);
- bool is_right_oriented2 = right_orientation_test(segment_start,
- segment_end,
- new_point);
+ bool is_right_oriented1 =
+ orientation_test(segment_start, segment_end, site_point) != LEFT_ORIENTATION;
+ bool is_right_oriented2 =
+ orientation_test(segment_start, segment_end, new_point) != LEFT_ORIENTATION;
         if (is_right_oriented1 != is_right_oriented2) {
             return (is_right_oriented1) ? LESS : MORE;
         }
@@ -226,7 +233,8 @@
         } else {
             point_2d<T> point3 = make_point_2d(segment_end.x() + static_cast<T>(dif_x),
                                                segment_end.y() + static_cast<T>(dif_y));
- bool right_oriented = right_orientation_test(segment_start, segment_end, point3);
+ bool right_oriented =
+ orientation_test(segment_start, segment_end, point3) != LEFT_ORIENTATION;
             if (is_right_oriented1 ^ right_oriented) {
                 if (is_right_oriented1)
                     return reverse_order ? LESS : UNDEFINED;
@@ -267,24 +275,35 @@
         if ((b_sign != dif_y_sign) && right_expr_div)
             comparison_result = true;
         else {
- if (b_sign != dif_y_sign)
+ if (b_sign != dif_y_sign && right_expr_mod)
                 right_expr_mod = right_expr_denom - right_expr_mod;
             else
- right_expr_div++;
- if (left_expr_div & 1) {
- comparison_result = ((left_expr_div >> 1) >= right_expr_div);
+ right_expr_div++;
+ bool left_expr_odd = (left_expr_div % 2 == 1);
+ left_expr_div >>= 1;
+ if (left_expr_div != right_expr_div) {
+ comparison_result = (left_expr_div >= right_expr_div);
             } else {
- left_expr_div >>= 1;
- if (left_expr_div != right_expr_div) {
+ ull temp_right = right_expr_denom - right_expr_mod;
+ if (temp_right > right_expr_mod) {
+ if (left_expr_odd)
+ comparison_result = true;
+ else
+ right_expr_mod <<= 1;
+ } else {
+ if (!left_expr_odd)
+ comparison_result = false;
+ else
+ right_expr_mod = right_expr_mod - temp_right;
+ }
+ left_expr_div = left_expr_mod / dif_x_rob;
+ right_expr_div = right_expr_mod / a_rob;
+ if (left_expr_div != right_expr_div)
                     comparison_result = (left_expr_div >= right_expr_div);
- } else {
- left_expr_div = left_expr_mod / dif_x_rob;
- right_expr_div = right_expr_mod / a_rob;
- if (left_expr_div != right_expr_div)
- comparison_result = (left_expr_div >= right_expr_div);
+ else {
                     left_expr_mod = left_expr_mod % dif_x_rob;
                     right_expr_mod = right_expr_mod % a_rob;
- comparison_result = (right_expr_mod * a_rob >= left_expr_mod * dif_x_rob);
+ comparison_result = (left_expr_mod * a_rob >= right_expr_mod * dif_x_rob);
                 }
             }
         }
@@ -378,9 +397,91 @@
     template <typename T>
     bool less_predicate(point_2d<T> segment1_start, point_2d<T> segment1_end,
                         point_2d<T> segment2_start, point_2d<T> segment2_end,
- point_2d<T> new_point) {
+ point_2d<T> new_point, bool reverse_order) {
+ typedef unsigned long long ull;
+ kOrientation orientation1 = orientation_test(segment1_start, segment1_end, segment2_start);
+ kOrientation orientation2 = orientation_test(segment1_start, segment1_end, segment2_end);
+ assert(static_cast<int>(orientation1) || static_cast<int>(orientation2));
+ if (static_cast<int>(orientation1) * static_cast<int>(orientation2) == -1) {
+ assert(!reverse_order);
+ return less_predicate(segment2_start, segment2_end,
+ segment1_start, segment1_end,
+ new_point, true);
+ }
+
+ double intersection_x1 = 0.0;
+ double intersection_x2 = 0.0;
+ double a1 = static_cast<double>(segment1_start.x()) -
+ static_cast<double>(segment1_end.x());
+ if (a1 == 0.0) {
+ // Avoid cancellation.
+ intersection_x2 += static_cast<double>(new_point.x()) -
+ static_cast<double>(segment1_end.x());
+ } else {
+ double b1 = static_cast<double>(segment1_start.y()) -
+ static_cast<double>(segment1_end.y());
+ double c1 = b1 * (static_cast<double>(new_point.x()) -
+ static_cast<double>(segment1_end.x())) +
+ a1 * segment1_end.y();
+ double mul1 = sqrt(a1 * a1 + b1 * b1);
+ if ((orientation1 == LEFT_ORIENTATION) || (orientation2 == LEFT_ORIENTATION)) {
+ if (b1 >= 0.0) {
+ mul1 = 1.0 / (b1 + mul1);
+ } else {
+ mul1 = (-b1 + mul1) / (a1 * a1);
+ }
+ } else {
+ if (b1 >= 0.0) {
+ mul1 = (-b1 - mul1) / (a1 * a1);
+ } else {
+ mul1 = 1.0 / (b1 - mul1);
+ }
+ }
+ INT_PREDICATE_AVOID_CANCELLATION(a1 * mul1 * static_cast<double>(new_point.y()),
+ intersection_x1, intersection_x2);
+ INT_PREDICATE_AVOID_CANCELLATION(-c1 * mul1, intersection_x1, intersection_x2);
+ }
+
+ double a2 = static_cast<double>(segment2_start.x()) -
+ static_cast<double>(segment2_end.x());
+ if (a2 == 0.0) {
+ // Avoid cancellation.
+ intersection_x1 += static_cast<double>(new_point.x()) -
+ static_cast<double>(segment2_end.x());
+ } else {
+ double b2 = static_cast<double>(segment2_start.y()) -
+ static_cast<double>(segment2_end.y());
+ double c2 = b2 * (static_cast<double>(new_point.x()) -
+ static_cast<double>(segment2_end.x())) +
+ a2 * segment2_end.y();
+ double mul2 = sqrt(a2 * a2 + b2 * b2);
+ if (((orientation1 == LEFT_ORIENTATION) || (orientation2 == LEFT_ORIENTATION)) ^
+ !reverse_order) {
+ if (b2 >= 0.0) {
+ mul2 = 1.0 / (b2 + mul2);
+ } else {
+ mul2 = (-b2 + mul2) / (a2 * a2);
+ }
+ } else {
+ if (b2 >= 0.0) {
+ mul2 = (-b2 - mul2) / (a2 * a2);
+ } else {
+ mul2 = 1.0 / (b2 - mul2);
+ }
+ }
+ INT_PREDICATE_AVOID_CANCELLATION(a2 * static_cast<double>(new_point.y()) * mul2,
+ intersection_x2, intersection_x1);
+ INT_PREDICATE_AVOID_CANCELLATION(-c2 * mul2, intersection_x2, intersection_x1);
+ }
+
+ if (!almost_equal(intersection_x1, intersection_x2, 20)) {
+ return ((orientation1 == LEFT_ORIENTATION) || (orientation2 == LEFT_ORIENTATION)) ^
+ reverse_order ^ (intersection_x1 > intersection_x2);
+ }
         
- return true;
+ // TODO(asydorchuk): Add mpl support there.
+ return ((orientation1 == LEFT_ORIENTATION) || (orientation2 == LEFT_ORIENTATION)) ^
+ reverse_order ^ (intersection_x1 > intersection_x2);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -457,8 +558,9 @@
                 if (this->point0_.y() != s_event.point0_.y())
                     return this->point0_.y() < s_event.point0_.y();
 
- // TODO(asydorchuk): Compare segments by angle if required.
- return this->point1_.y() < s_event.point1_.y();
+ // Sort by angle.
+ return orientation_test(this->point1_, this->point0_, s_event.point1_) ==
+ RIGHT_ORIENTATION;
             }
         }
 
@@ -568,7 +670,6 @@
 
         bool operator==(const circle_event &c_event) const {
             return (center_.y() == c_event.y()) &&
- (center_.x() == c_event.x()) &&
                    (lower_x_ == c_event.lower_x_);
         }
 
@@ -820,7 +921,8 @@
 
         bool less_ss(const Point2D &new_site) const {
             return less_predicate(left_site_.get_point0(), left_site_.get_point1(),
- right_site_.get_point0(), right_site_.get_point1(), new_site);
+ right_site_.get_point0(), right_site_.get_point1(),
+ new_site, false);
         }
 
     private:
@@ -1676,4 +1778,8 @@
 } // boost
 } // detail
 
+#undef INT_PREDICATE_COMPUTE_DIFFERENCE
+#undef INT_PREDICATE_CONVERT_65_BIT
+#undef INT_PREDICATE_AVOID_CANCELLATION
+
 #endif

Modified: sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp
==============================================================================
--- sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp (original)
+++ sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -396,9 +396,8 @@
             //return true;
 
             // Check if bisectors intersect.
- if (!detail::right_orientation_test(site1.get_point0(),
- site2.get_point0(),
- site3.get_point0()))
+ if (detail::orientation_test(site1.get_point0(),site2.get_point0(),
+ site3.get_point0()) != detail::RIGHT_ORIENTATION)
                 return false;
 
             coordinate_type a = ((site1.x() - site2.x()) * (site2.y() - site3.y()) -

Modified: sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_sweepline.hpp
==============================================================================
--- sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_sweepline.hpp (original)
+++ sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_sweepline.hpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -11,6 +11,7 @@
 #define BOOST_SWEEPLINE_VORONOI_SEGMENT_SWEEPLINE
 
 #include <algorithm>
+#include <assert.h>
 #include <cmath>
 #include <cstring>
 #include <list>

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/Jamfile.v2 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -30,6 +30,7 @@
         [ run voronoi_segment/segment_event_queue_test.cpp ]
         [ run voronoi_segment/segment_event_types_test.cpp ]
         [ run voronoi_segment/segment_node_comparer_test.cpp ]
+ [ run voronoi_segment/segment_predicates_test.cpp ]
         [ run voronoi_segment/segment_voronoi_builder_test.cpp ]
         [ run voronoi_segment/segment_voronoi_clipping_test.cpp ]
     ;
\ No newline at end of file

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_queue_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_queue_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_queue_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -1,66 +1,66 @@
-// Boost sweepline library event_queue_test.cpp file
-
-// Copyright Andrii Sydorchuk 2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#include <cmath>
-
-#include "../test_type_list.hpp"
-#include "boost/sweepline/voronoi_sweepline.hpp"
-using namespace boost::sweepline;
-
-#define BOOST_TEST_MODULE event_queue_test
-#include <boost/test/test_case_template.hpp>
-
-#define CHECK_TOP_ELEMENT_EQUALITY(TOP, X, Y) \
- BOOST_CHECK_EQUAL(TOP.get_lower_x() == static_cast<T>(X) && \
- TOP.y() == static_cast<T>(Y), true)
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test1, T, test_types) {
- detail::circle_events_queue<T> event_q;
- BOOST_CHECK_EQUAL(event_q.empty(), true);
-
- event_q.reset();
-
- for (int i = 0; i < 10; i++) {
- T x = static_cast<T>(-i);
- T y = static_cast<T>(10-i);
- event_q.push(detail::make_circle_event<T>(x, y, x + static_cast<T>(10)));
- }
-
- for (int i = 0; i < 10; i++) {
- CHECK_TOP_ELEMENT_EQUALITY(event_q.top(), 1 + i, 1 + i);
- event_q.pop();
- }
-
- BOOST_CHECK_EQUAL(event_q.empty(), true);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test2, T, test_types) {
- typedef detail::circle_event<T> circle_event_type;
-
- detail::circle_events_queue<T> event_q;
- detail::site_event<T> temp_site =
- detail::make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0);
-
- for (int i = 0; i < 10; i++) {
- T x = static_cast<T>(10-i);
- T y = static_cast<T>(10-i);
- circle_event_type c = detail::make_circle_event<T>(x, y, x);
- if (i&1)
- event_q.push(c)->deactivate();
- else
- event_q.push(c);
- }
-
- for (int i = 0; i < 5; i++) {
- CHECK_TOP_ELEMENT_EQUALITY(event_q.top(), 2 + 2*i, 2 + 2*i);
- event_q.pop();
- }
-
- BOOST_CHECK_EQUAL(event_q.empty(), true);
-}
+//// Boost sweepline library event_queue_test.cpp file
+//
+//// Copyright Andrii Sydorchuk 2010.
+//// Distributed under the Boost Software License, Version 1.0.
+//// (See accompanying file LICENSE_1_0.txt or copy at
+//// http://www.boost.org/LICENSE_1_0.txt)
+//
+//// See http://www.boost.org for updates, documentation, and revision history.
+//
+//#include <cmath>
+//
+//#include "../test_type_list.hpp"
+//#include "boost/sweepline/voronoi_sweepline.hpp"
+//using namespace boost::sweepline;
+//
+//#define BOOST_TEST_MODULE event_queue_test
+//#include <boost/test/test_case_template.hpp>
+//
+//#define CHECK_TOP_ELEMENT_EQUALITY(TOP, X, Y) \
+// BOOST_CHECK_EQUAL(TOP.get_lower_x() == static_cast<T>(X) && \
+// TOP.y() == static_cast<T>(Y), true)
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test1, T, test_types) {
+// detail::circle_events_queue<T> event_q;
+// BOOST_CHECK_EQUAL(event_q.empty(), true);
+//
+// event_q.reset();
+//
+// for (int i = 0; i < 10; i++) {
+// T x = static_cast<T>(-i);
+// T y = static_cast<T>(10-i);
+// event_q.push(detail::make_circle_event<T>(x, y, x + static_cast<T>(10)));
+// }
+//
+// for (int i = 0; i < 10; i++) {
+// CHECK_TOP_ELEMENT_EQUALITY(event_q.top(), 1 + i, 1 + i);
+// event_q.pop();
+// }
+//
+// BOOST_CHECK_EQUAL(event_q.empty(), true);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test2, T, test_types) {
+// typedef detail::circle_event<T> circle_event_type;
+//
+// detail::circle_events_queue<T> event_q;
+// detail::site_event<T> temp_site =
+// detail::make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0);
+//
+// for (int i = 0; i < 10; i++) {
+// T x = static_cast<T>(10-i);
+// T y = static_cast<T>(10-i);
+// circle_event_type c = detail::make_circle_event<T>(x, y, x);
+// if (i&1)
+// event_q.push(c)->deactivate();
+// else
+// event_q.push(c);
+// }
+//
+// for (int i = 0; i < 5; i++) {
+// CHECK_TOP_ELEMENT_EQUALITY(event_q.top(), 2 + 2*i, 2 + 2*i);
+// event_q.pop();
+// }
+//
+// BOOST_CHECK_EQUAL(event_q.empty(), true);
+//}

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_types_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_types_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/event_types_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -1,119 +1,119 @@
-// Boost sweepline library event_types_test.cpp file
-
-// Copyright Andrii Sydorchuk 2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#include "../test_type_list.hpp"
-#include "boost/sweepline/voronoi_sweepline.hpp"
-using namespace boost::sweepline;
-using namespace boost::sweepline::detail;
-
-#define BOOST_TEST_MODULE event_types_test
-#include <boost/test/test_case_template.hpp>
-
-#define EVENT_TYPES_CHECK_COMPARISON(A, B, ARR) \
- BOOST_CHECK_EQUAL((A)<(B), (ARR)[0]); \
- BOOST_CHECK_EQUAL((A)>(B), (ARR)[1]); \
- BOOST_CHECK_EQUAL((A)<=(B), (ARR)[2]); \
- BOOST_CHECK_EQUAL((A)>=(B), (ARR)[3]); \
- BOOST_CHECK_EQUAL((A)==(B), (ARR)[4]); \
- BOOST_CHECK_EQUAL((A)!=(B), (ARR)[5])
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(point_2d_test1, T, test_types) {
- point_2d<T> point1 = make_point_2d(static_cast<T>(1), static_cast<T>(1.05));
- point_2d<T> point2;
-
- BOOST_CHECK_EQUAL(point1.x(), static_cast<T>(1));
- BOOST_CHECK_EQUAL(point1.y(), static_cast<T>(1.05));
-
- point2 = make_point_2d(static_cast<T>(0.999999), static_cast<T>(1));
- bool arr1[] = { false, true, false, true, false, true };
- EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr1);
-
- point2 = make_point_2d(static_cast<T>(1), static_cast<T>(1.1));
- bool arr2[] = { true, false, true, false, false, true };
- EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr2);
-
- point2 = make_point_2d(static_cast<T>(1), static_cast<T>(1.05));
- bool arr3[] = { false, false, true, true, true, false };
- EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr3);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(site_event_test1, T, test_types) {
- site_event<T> site1 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.05), 0);
- site_event<T> site2;
-
- BOOST_CHECK_EQUAL(site1.x(), static_cast<T>(1));
- BOOST_CHECK_EQUAL(site1.y(), static_cast<T>(1.05));
- BOOST_CHECK_EQUAL(site1.get_site_index(), 0);
-
- site2 = make_site_event<T>(static_cast<T>(0.999999), static_cast<T>(1), 1);
- bool arr1[] = { false, true, false, true, false, true };
- EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr1);
-
- site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.1), 1);
- bool arr2[] = { true, false, true, false, false, true };
- EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr2);
-
- site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.05), 1);
- bool arr3[] = { false, false, true, true, true, false };
- EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr3);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(circle_event_test1, T, test_types) {
- circle_event<T> circle1 = make_circle_event<T>(static_cast<T>(1),
- static_cast<T>(2),
- static_cast<T>(3));
- site_event<T> temp_site = make_site_event<T>(static_cast<T>(0), static_cast<T>(0),0);
- circle_event<T> circle2;
-
- BOOST_CHECK_EQUAL(circle1.x(), static_cast<T>(1));
- BOOST_CHECK_EQUAL(circle1.y(), static_cast<T>(2));
- BOOST_CHECK_EQUAL(circle1.get_lower_x(), static_cast<T>(3));
-
- circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(2), static_cast<T>(3));
- bool arr1[] = { false, false, true, true, true, false };
- EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr1);
-
- circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(3), static_cast<T>(3));
- bool arr2[] = { true, false, true, false, false, true };
- EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr2);
-
- circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(2), static_cast<T>(5));
- bool arr3[] = { true, false, true, false, false, true };
- EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr3);
-
- circle2 = make_circle_event<T>(static_cast<T>(0), static_cast<T>(2), static_cast<T>(2));
- bool arr4[] = { false, true, false, true, false, true };
- EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr4);
-
- circle2 = make_circle_event<T>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(10));
- bool arr5[] = { true, false, true, false, false, true };
- EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr5);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(circle_event_test2, T, test_types) {
- circle_event<T> circle = make_circle_event<T>(static_cast<T>(1),
- static_cast<T>(2),
- static_cast<T>(3));
- site_event<T> site;
-
- site = make_site_event<T>(static_cast<T>(0), static_cast<T>(100), 0);
- BOOST_CHECK_EQUAL(circle.compare(site), 1);
-
- site = make_site_event<T>(static_cast<T>(3), static_cast<T>(0), 0);
- BOOST_CHECK_EQUAL(circle.compare(site), 1);
-
- site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
- BOOST_CHECK_EQUAL(circle.compare(site), 0);
-
- site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
- BOOST_CHECK_EQUAL(circle.compare(site), 0);
-
- site = make_site_event<T>(static_cast<T>(4), static_cast<T>(2), 0);
- BOOST_CHECK_EQUAL(circle.compare(site), -1);
-}
+//// Boost sweepline library event_types_test.cpp file
+//
+//// Copyright Andrii Sydorchuk 2010.
+//// Distributed under the Boost Software License, Version 1.0.
+//// (See accompanying file LICENSE_1_0.txt or copy at
+//// http://www.boost.org/LICENSE_1_0.txt)
+//
+//// See http://www.boost.org for updates, documentation, and revision history.
+//
+//#include "../test_type_list.hpp"
+//#include "boost/sweepline/voronoi_sweepline.hpp"
+//using namespace boost::sweepline;
+//using namespace boost::sweepline::detail;
+//
+//#define BOOST_TEST_MODULE event_types_test
+//#include <boost/test/test_case_template.hpp>
+//
+//#define EVENT_TYPES_CHECK_COMPARISON(A, B, ARR) \
+// BOOST_CHECK_EQUAL((A)<(B), (ARR)[0]); \
+// BOOST_CHECK_EQUAL((A)>(B), (ARR)[1]); \
+// BOOST_CHECK_EQUAL((A)<=(B), (ARR)[2]); \
+// BOOST_CHECK_EQUAL((A)>=(B), (ARR)[3]); \
+// BOOST_CHECK_EQUAL((A)==(B), (ARR)[4]); \
+// BOOST_CHECK_EQUAL((A)!=(B), (ARR)[5])
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(point_2d_test1, T, test_types) {
+// point_2d<T> point1 = make_point_2d(static_cast<T>(1), static_cast<T>(1.05));
+// point_2d<T> point2;
+//
+// BOOST_CHECK_EQUAL(point1.x(), static_cast<T>(1));
+// BOOST_CHECK_EQUAL(point1.y(), static_cast<T>(1.05));
+//
+// point2 = make_point_2d(static_cast<T>(0.999999), static_cast<T>(1));
+// bool arr1[] = { false, true, false, true, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr1);
+//
+// point2 = make_point_2d(static_cast<T>(1), static_cast<T>(1.1));
+// bool arr2[] = { true, false, true, false, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr2);
+//
+// point2 = make_point_2d(static_cast<T>(1), static_cast<T>(1.05));
+// bool arr3[] = { false, false, true, true, true, false };
+// EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr3);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(site_event_test1, T, test_types) {
+// site_event<T> site1 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.05), 0);
+// site_event<T> site2;
+//
+// BOOST_CHECK_EQUAL(site1.x(), static_cast<T>(1));
+// BOOST_CHECK_EQUAL(site1.y(), static_cast<T>(1.05));
+// BOOST_CHECK_EQUAL(site1.get_site_index(), 0);
+//
+// site2 = make_site_event<T>(static_cast<T>(0.999999), static_cast<T>(1), 1);
+// bool arr1[] = { false, true, false, true, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr1);
+//
+// site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.1), 1);
+// bool arr2[] = { true, false, true, false, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr2);
+//
+// site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.05), 1);
+// bool arr3[] = { false, false, true, true, true, false };
+// EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr3);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(circle_event_test1, T, test_types) {
+// circle_event<T> circle1 = make_circle_event<T>(static_cast<T>(1),
+// static_cast<T>(2),
+// static_cast<T>(3));
+// site_event<T> temp_site = make_site_event<T>(static_cast<T>(0), static_cast<T>(0),0);
+// circle_event<T> circle2;
+//
+// BOOST_CHECK_EQUAL(circle1.x(), static_cast<T>(1));
+// BOOST_CHECK_EQUAL(circle1.y(), static_cast<T>(2));
+// BOOST_CHECK_EQUAL(circle1.get_lower_x(), static_cast<T>(3));
+//
+// circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(2), static_cast<T>(3));
+// bool arr1[] = { false, false, true, true, true, false };
+// EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr1);
+//
+// circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(3), static_cast<T>(3));
+// bool arr2[] = { true, false, true, false, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr2);
+//
+// circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(2), static_cast<T>(5));
+// bool arr3[] = { true, false, true, false, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr3);
+//
+// circle2 = make_circle_event<T>(static_cast<T>(0), static_cast<T>(2), static_cast<T>(2));
+// bool arr4[] = { false, true, false, true, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr4);
+//
+// circle2 = make_circle_event<T>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(10));
+// bool arr5[] = { true, false, true, false, false, true };
+// EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr5);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(circle_event_test2, T, test_types) {
+// circle_event<T> circle = make_circle_event<T>(static_cast<T>(1),
+// static_cast<T>(2),
+// static_cast<T>(3));
+// site_event<T> site;
+//
+// site = make_site_event<T>(static_cast<T>(0), static_cast<T>(100), 0);
+// BOOST_CHECK_EQUAL(circle.compare(site), 1);
+//
+// site = make_site_event<T>(static_cast<T>(3), static_cast<T>(0), 0);
+// BOOST_CHECK_EQUAL(circle.compare(site), 1);
+//
+// site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
+// BOOST_CHECK_EQUAL(circle.compare(site), 0);
+//
+// site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
+// BOOST_CHECK_EQUAL(circle.compare(site), 0);
+//
+// site = make_site_event<T>(static_cast<T>(4), static_cast<T>(2), 0);
+// BOOST_CHECK_EQUAL(circle.compare(site), -1);
+//}

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/node_comparer_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/node_comparer_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/node_comparer_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -1,255 +1,255 @@
-// Boost sweepline library node_comparer_test.cpp file
-
-// Copyright Andrii Sydorchuk 2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#include "../test_type_list.hpp"
-#include "boost/sweepline/voronoi_sweepline.hpp"
-using namespace boost::sweepline;
-using namespace boost::sweepline::detail;
-
-#define BOOST_TEST_MODULE node_comparer_test
-#include <boost/test/test_case_template.hpp>
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test1, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef site_event<T> site_event_type;
- typedef beach_line_node<T> bline_node;
- typedef typename std::map< bline_node, int,
- node_comparer<bline_node> >::const_iterator bline_it;
-
- std::map< bline_node, int, node_comparer<bline_node> > test_beach_line;
-
- site_event_type site1 = make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0);
- site_event_type site2 = make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1);
- bline_node initial_node(site1, site2);
- test_beach_line[initial_node] = 2;
-
- site_event_type site3 = make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2);
- bline_node node1(site1, site3);
- bline_node node2(site3, site1);
- test_beach_line.insert(std::pair< bline_node, int>(node1, 0));
- test_beach_line.insert(std::pair< bline_node, int>(node2, 1));
-
- int cur_value = 0;
- for (bline_it it = test_beach_line.begin();
- it != test_beach_line.end();
- it++, cur_value++)
- BOOST_CHECK_EQUAL(it->second, cur_value);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test2, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef site_event<T> site_event_type;
- typedef beach_line_node<T> bline_node;
- typedef typename std::map< bline_node, int,
- node_comparer<bline_node> >::const_iterator bline_it;
-
- std::map< bline_node, int, node_comparer<bline_node> > test_beach_line;
-
- site_event_type site1 = make_site_event<T>(static_cast<T>(0), static_cast<T>(1), 0);
- site_event_type site2 = make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 1);
- site_event_type site3 = make_site_event<T>(static_cast<T>(2), static_cast<T>(4), 2);
- bline_node initial_node1(site1, site2);
- bline_node initial_node2(site2, site1);
- test_beach_line[initial_node1] = 0;
- test_beach_line[initial_node2] = 1;
-
- bline_node new_node1(site1, site3);
- bline_node new_node2(site3, site1);
- test_beach_line[new_node1] = 2;
- test_beach_line[new_node2] = 3;
-
- int cur_value = 0;
- for (bline_it it = test_beach_line.begin();
- it != test_beach_line.end();
- it++, cur_value++)
- BOOST_CHECK_EQUAL(it->second, cur_value);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test3, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef beach_line_node<T> bline_node;
- node_comparer<bline_node> node_comparer_test;
-
- bline_node initial_node(
- make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 0),
- make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1));
-
- bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-10), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 3));
- bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
- bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
- bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(2), 4));
- bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
-
-
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
-
-
- BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test4, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef beach_line_node<T> bline_node;
- node_comparer<bline_node> node_comparer_test;
-
- bline_node initial_node(
- make_site_event<T>(static_cast<T>(0), static_cast<T>(1), 0),
- make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 1));
-
- bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 3));
- bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 4));
- bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
- bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
- bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
- bline_node new_node7(make_site_event<T>(static_cast<T>(2), static_cast<T>(10), 4));
-
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node7), true);
-
- BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node7, initial_node), false);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test5, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef beach_line_node<T> bline_node;
- node_comparer<bline_node> node_comparer_test;
-
- bline_node initial_node(
- make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
- make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 1));
-
- bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-10), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 3));
- bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
- bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(2), 4));
- bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(5), 4));
- bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(20), 4));
-
-
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
-
-
- BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test6, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef beach_line_node<T> bline_node;
- node_comparer<bline_node> node_comparer_test;
-
- bline_node initial_node(
- make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 0),
- make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 1));
-
- bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 3));
- bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
- bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
- bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(2), 4));
- bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
- bline_node new_node7(make_site_event<T>(static_cast<T>(2), static_cast<T>(5), 4));
-
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node7), true);
-
- BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node7, initial_node), false);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test7, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef beach_line_node<T> bline_node;
- node_comparer<bline_node> node_comparer_test;
-
- bline_node initial_node(
- make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
- make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1));
-
- bline_node new_node1(make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 3));
- bline_node new_node3(make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 4));
-
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
-
- BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test8, T, test_types) {
- typedef point_2d<T> Point2D;
- typedef beach_line_node<T> bline_node;
- node_comparer<bline_node> node_comparer_test;
-
- bline_node initial_node(
- make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
- make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1));
-
- bline_node new_node1(make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1));
- bline_node new_node3(make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 3));
- bline_node new_node4(
- make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1),
- make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0));
-
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
-
- BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
-}
+//// Boost sweepline library node_comparer_test.cpp file
+//
+//// Copyright Andrii Sydorchuk 2010.
+//// Distributed under the Boost Software License, Version 1.0.
+//// (See accompanying file LICENSE_1_0.txt or copy at
+//// http://www.boost.org/LICENSE_1_0.txt)
+//
+//// See http://www.boost.org for updates, documentation, and revision history.
+//
+//#include "../test_type_list.hpp"
+//#include "boost/sweepline/voronoi_sweepline.hpp"
+//using namespace boost::sweepline;
+//using namespace boost::sweepline::detail;
+//
+//#define BOOST_TEST_MODULE node_comparer_test
+//#include <boost/test/test_case_template.hpp>
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test1, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef site_event<T> site_event_type;
+// typedef beach_line_node<T> bline_node;
+// typedef typename std::map< bline_node, int,
+// node_comparer<bline_node> >::const_iterator bline_it;
+//
+// std::map< bline_node, int, node_comparer<bline_node> > test_beach_line;
+//
+// site_event_type site1 = make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0);
+// site_event_type site2 = make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1);
+// bline_node initial_node(site1, site2);
+// test_beach_line[initial_node] = 2;
+//
+// site_event_type site3 = make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2);
+// bline_node node1(site1, site3);
+// bline_node node2(site3, site1);
+// test_beach_line.insert(std::pair< bline_node, int>(node1, 0));
+// test_beach_line.insert(std::pair< bline_node, int>(node2, 1));
+//
+// int cur_value = 0;
+// for (bline_it it = test_beach_line.begin();
+// it != test_beach_line.end();
+// it++, cur_value++)
+// BOOST_CHECK_EQUAL(it->second, cur_value);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test2, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef site_event<T> site_event_type;
+// typedef beach_line_node<T> bline_node;
+// typedef typename std::map< bline_node, int,
+// node_comparer<bline_node> >::const_iterator bline_it;
+//
+// std::map< bline_node, int, node_comparer<bline_node> > test_beach_line;
+//
+// site_event_type site1 = make_site_event<T>(static_cast<T>(0), static_cast<T>(1), 0);
+// site_event_type site2 = make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 1);
+// site_event_type site3 = make_site_event<T>(static_cast<T>(2), static_cast<T>(4), 2);
+// bline_node initial_node1(site1, site2);
+// bline_node initial_node2(site2, site1);
+// test_beach_line[initial_node1] = 0;
+// test_beach_line[initial_node2] = 1;
+//
+// bline_node new_node1(site1, site3);
+// bline_node new_node2(site3, site1);
+// test_beach_line[new_node1] = 2;
+// test_beach_line[new_node2] = 3;
+//
+// int cur_value = 0;
+// for (bline_it it = test_beach_line.begin();
+// it != test_beach_line.end();
+// it++, cur_value++)
+// BOOST_CHECK_EQUAL(it->second, cur_value);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test3, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef beach_line_node<T> bline_node;
+// node_comparer<bline_node> node_comparer_test;
+//
+// bline_node initial_node(
+// make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 0),
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1));
+//
+// bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-10), 2));
+// bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 3));
+// bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
+// bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
+// bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(2), 4));
+// bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
+//
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
+//
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test4, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef beach_line_node<T> bline_node;
+// node_comparer<bline_node> node_comparer_test;
+//
+// bline_node initial_node(
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(1), 0),
+// make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 1));
+//
+// bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
+// bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 3));
+// bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 4));
+// bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
+// bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
+// bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
+// bline_node new_node7(make_site_event<T>(static_cast<T>(2), static_cast<T>(10), 4));
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node7), true);
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node7, initial_node), false);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test5, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef beach_line_node<T> bline_node;
+// node_comparer<bline_node> node_comparer_test;
+//
+// bline_node initial_node(
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
+// make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 1));
+//
+// bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-10), 2));
+// bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 3));
+// bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
+// bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(2), 4));
+// bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(5), 4));
+// bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(20), 4));
+//
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
+//
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test6, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef beach_line_node<T> bline_node;
+// node_comparer<bline_node> node_comparer_test;
+//
+// bline_node initial_node(
+// make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 0),
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 1));
+//
+// bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
+// bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 3));
+// bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
+// bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
+// bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(2), 4));
+// bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
+// bline_node new_node7(make_site_event<T>(static_cast<T>(2), static_cast<T>(5), 4));
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node7), true);
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node7, initial_node), false);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test7, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef beach_line_node<T> bline_node;
+// node_comparer<bline_node> node_comparer_test;
+//
+// bline_node initial_node(
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1));
+//
+// bline_node new_node1(make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2));
+// bline_node new_node2(make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 3));
+// bline_node new_node3(make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 4));
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test8, T, test_types) {
+// typedef point_2d<T> Point2D;
+// typedef beach_line_node<T> bline_node;
+// node_comparer<bline_node> node_comparer_test;
+//
+// bline_node initial_node(
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
+// make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1));
+//
+// bline_node new_node1(make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2));
+// bline_node new_node2(make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1));
+// bline_node new_node3(make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 3));
+// bline_node new_node4(
+// make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1),
+// make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0));
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
+//
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
+// BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
+//}

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_benchmark_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_benchmark_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_benchmark_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -1,59 +1,59 @@
-// Boost sweepline library voronoi_benchmark_test.cpp file
-
-// Copyright Andrii Sydorchuk 2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#include <iostream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include "../test_type_list.hpp"
-#include "boost/sweepline/voronoi_sweepline.hpp"
-using namespace boost::sweepline;
-
-#define BOOST_TEST_MODULE voronoi_benchmark_test
-#include <boost/test/test_case_template.hpp>
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(benchmark_test1, T, test_types) {
- typedef T coordinate_type;
- srand(static_cast<unsigned int>(time(NULL)));
-
- voronoi_builder<coordinate_type> test_builder;
- voronoi_output_clipped<coordinate_type> test_output;
-
- FILE *bench_file = fopen("benchmark.txt", "a");
- fprintf(bench_file, "Voronoi Sweepline Benchmark Test (time in seconds):\n");
-
- for (int num_points = 10; num_points <= 1000000; num_points *= 10) {
- std::vector< point_2d<coordinate_type> > points;
- points.reserve(num_points);
-
- time_t start_time = time(NULL);
- int num_times = 1000000 / num_points;
- for (int cur = 0; cur < num_times; cur++) {
- for (int cur_point = 0; cur_point < num_points; cur_point++) {
- points.push_back(make_point_2d<coordinate_type>(
- static_cast<coordinate_type>(rand() % 5000 - 10000),
- static_cast<coordinate_type>(rand() % 5000 - 10000)));
- }
- test_builder.init(points);
- test_builder.run_sweepline();
- test_builder.clip(test_output);
- test_builder.reset();
- test_output.reset();
- points.clear();
- }
- time_t end_time = time(NULL);
- double running_time = static_cast<double>(end_time - start_time) / num_times;
-
- fprintf(bench_file,
- "Number of points = %8d; Overall time = %2d; Time per one input = %9.6f.\n",
- num_points, static_cast<int>(end_time - start_time), running_time);
- }
- fclose(bench_file);
-}
+//// Boost sweepline library voronoi_benchmark_test.cpp file
+//
+//// Copyright Andrii Sydorchuk 2010.
+//// Distributed under the Boost Software License, Version 1.0.
+//// (See accompanying file LICENSE_1_0.txt or copy at
+//// http://www.boost.org/LICENSE_1_0.txt)
+//
+//// See http://www.boost.org for updates, documentation, and revision history.
+//
+//#include <iostream>
+//#include <stdio.h>
+//#include <stdlib.h>
+//#include <time.h>
+//
+//#include "../test_type_list.hpp"
+//#include "boost/sweepline/voronoi_sweepline.hpp"
+//using namespace boost::sweepline;
+//
+//#define BOOST_TEST_MODULE voronoi_benchmark_test
+//#include <boost/test/test_case_template.hpp>
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(benchmark_test1, T, test_types) {
+// typedef T coordinate_type;
+// srand(static_cast<unsigned int>(time(NULL)));
+//
+// voronoi_builder<coordinate_type> test_builder;
+// voronoi_output_clipped<coordinate_type> test_output;
+//
+// FILE *bench_file = fopen("benchmark.txt", "a");
+// fprintf(bench_file, "Voronoi Sweepline Benchmark Test (time in seconds):\n");
+//
+// for (int num_points = 10; num_points <= 1000000; num_points *= 10) {
+// std::vector< point_2d<coordinate_type> > points;
+// points.reserve(num_points);
+//
+// time_t start_time = time(NULL);
+// int num_times = 1000000 / num_points;
+// for (int cur = 0; cur < num_times; cur++) {
+// for (int cur_point = 0; cur_point < num_points; cur_point++) {
+// points.push_back(make_point_2d<coordinate_type>(
+// static_cast<coordinate_type>(rand() % 5000 - 10000),
+// static_cast<coordinate_type>(rand() % 5000 - 10000)));
+// }
+// test_builder.init(points);
+// test_builder.run_sweepline();
+// test_builder.clip(test_output);
+// test_builder.reset();
+// test_output.reset();
+// points.clear();
+// }
+// time_t end_time = time(NULL);
+// double running_time = static_cast<double>(end_time - start_time) / num_times;
+//
+// fprintf(bench_file,
+// "Number of points = %8d; Overall time = %2d; Time per one input = %9.6f.\n",
+// num_points, static_cast<int>(end_time - start_time), running_time);
+// }
+// fclose(bench_file);
+//}

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_clipping_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_clipping_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_point/voronoi_clipping_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -1,296 +1,296 @@
-// Boost sweepline library voronoi_clipping_test.cpp file
-
-// Copyright Andrii Sydorchuk 2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for updates, documentation, and revision history.
-
-#include <stdlib.h>
-#include <time.h>
-
-#include "../test_type_list.hpp"
-#include "boost/sweepline/voronoi_sweepline.hpp"
-using namespace boost::sweepline;
-
-#define BOOST_TEST_MODULE voronoi_clipping_test
-#include <boost/test/test_case_template.hpp>
-
-// Test segment clipping.
-BOOST_AUTO_TEST_CASE_TEMPLATE(segment_clipping_test1, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(2.0));
- detail::voronoi_output<T> test_output;
- point_2d<T> test_origin(static_cast<T>(-1), static_cast<T>(3));
- point_2d<T> test_direction1_1(static_cast<T>(8), static_cast<T>(-8));
- point_2d<T> test_direction1_2(static_cast<T>(2), static_cast<T>(-2));
- point_2d<T> test_direction1_3(static_cast<T>(0.5), static_cast<T>(-0.5));
- point_2d<T> test_direction2(static_cast<T>(2), static_cast<T>(-4));
- point_2d<T> test_direction3(static_cast<T>(2), static_cast<T>(-1));
- point_2d<T> test_direction4(static_cast<T>(1), static_cast<T>(-4));
- point_2d<T> test_direction5(static_cast<T>(5), static_cast<T>(-1));
-
- std::vector< point_2d<T> > intersections;
- test_output.find_intersections(test_origin, test_direction1_1,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(2), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(3) &&
- intersections[1].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction1_2,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(2), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction1_3,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(intersections.empty(), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction2,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(1), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(1) &&
- intersections[1].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction3,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(1) &&
- intersections[0].y() == static_cast<T>(2), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction4,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction5,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
- intersections[0].y() == static_cast<T>(2), true);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(segment_clipping_test2, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(3.0));
- detail::voronoi_output<T> test_output;
- std::vector< point_2d<T> > intersections;
- srand(static_cast<unsigned int>(time(NULL)));
- point_2d<T> test_origin(2, 1);
-
- for (int i = -50; i <= 50; i++)
- for (int j = -50; j <= 50; j++) {
- intersections.clear();
- point_2d<T> test_direction(static_cast<T>(i), static_cast<T>(j));
- test_output.find_intersections(test_origin, test_direction,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- if (abs(i) >= 2 || abs(j) >= 2)
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- else
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 0);
- }
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(segment_clipping_test3, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(3.0));
- detail::voronoi_output<T> test_output;
- std::vector< point_2d<T> > intersections;
- srand(static_cast<unsigned int>(time(NULL)));
- point_2d<T> test_origin(2, 1);
-
- for (int i = -50; i <= 50; i++)
- for (int j = -50; j <= 50; j++) {
- intersections.clear();
- T x = static_cast<T>(i) / static_cast<T>(26);
- T y = static_cast<T>(j) / static_cast<T>(26);
- point_2d<T> test_direction(x, y);
- test_output.find_intersections(test_origin, test_direction,
- detail::voronoi_output<T>::SEGMENT,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 0);
- }
-}
-
-// Test ray clipping.
-BOOST_AUTO_TEST_CASE_TEMPLATE(ray_clipping_test1, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(2.0));
- detail::voronoi_output<T> test_output;
- point_2d<T> test_origin(static_cast<T>(-1), static_cast<T>(3));
- point_2d<T> test_direction1(static_cast<T>(2), static_cast<T>(-2));
- point_2d<T> test_direction2(static_cast<T>(2), static_cast<T>(-4));
- point_2d<T> test_direction3(static_cast<T>(2), static_cast<T>(-1));
- point_2d<T> test_direction4(static_cast<T>(1), static_cast<T>(-4));
- point_2d<T> test_direction5(static_cast<T>(5), static_cast<T>(-1));
-
- std::vector< point_2d<T> > intersections;
- test_output.find_intersections(test_origin, test_direction1,
- detail::voronoi_output<T>::RAY,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(2), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(3) &&
- intersections[1].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction2,
- detail::voronoi_output<T>::RAY,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(1), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(1) &&
- intersections[1].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction3,
- detail::voronoi_output<T>::RAY,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(1) &&
- intersections[0].y() == static_cast<T>(2), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(4) &&
- intersections[1].y() == static_cast<T>(0.5), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction4,
- detail::voronoi_output<T>::RAY,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction5,
- detail::voronoi_output<T>::RAY,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
- intersections[0].y() == static_cast<T>(2), true);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(ray_clipping_test2, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(3.0));
- detail::voronoi_output<T> test_output;
- std::vector< point_2d<T> > intersections;
- srand(static_cast<unsigned int>(time(NULL)));
- point_2d<T> test_origin(2, 1);
-
- for (int i = -50; i <= 50; i++)
- for (int j = -50; j <= 50; j++) {
- intersections.clear();
- T x = static_cast<T>(i) / static_cast<T>(26);
- T y = static_cast<T>(j) / static_cast<T>(26);
- point_2d<T> test_direction(x, y);
- test_output.find_intersections(test_origin, test_direction,
- detail::voronoi_output<T>::RAY,
- test_rect, intersections);
- if (i && j)
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- }
-}
-
-// Test line clipping.
-BOOST_AUTO_TEST_CASE_TEMPLATE(line_clipping_test1, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(2.0));
- detail::voronoi_output<T> test_output;
- point_2d<T> test_origin(static_cast<T>(-1), static_cast<T>(3));
- point_2d<T> test_direction1(static_cast<T>(-1), static_cast<T>(1));
- point_2d<T> test_direction2(static_cast<T>(-1), static_cast<T>(2));
- point_2d<T> test_direction3(static_cast<T>(-2), static_cast<T>(1));
- point_2d<T> test_direction4(static_cast<T>(-1), static_cast<T>(4));
- point_2d<T> test_direction5(static_cast<T>(-5), static_cast<T>(1));
-
- std::vector< point_2d<T> > intersections;
- test_output.find_intersections(test_origin, test_direction1,
- detail::voronoi_output<T>::LINE,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(3) &&
- intersections[0].y() == static_cast<T>(-1), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(0) &&
- intersections[1].y() == static_cast<T>(2), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction2,
- detail::voronoi_output<T>::LINE,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(1) &&
- intersections[0].y() == static_cast<T>(-1), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(0) &&
- intersections[1].y() == static_cast<T>(1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction3,
- detail::voronoi_output<T>::LINE,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
- intersections[0].y() == static_cast<T>(0.5), true);
- BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(1) &&
- intersections[1].y() == static_cast<T>(2), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction4,
- detail::voronoi_output<T>::LINE,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
- intersections[0].y() == static_cast<T>(-1), true);
-
- intersections.clear();
- test_output.find_intersections(test_origin, test_direction5,
- detail::voronoi_output<T>::LINE,
- test_rect, intersections);
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
- BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
- intersections[0].y() == static_cast<T>(2), true);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(line_clipping_test2, T, test_types) {
- BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
- static_cast<T>(4.0), static_cast<T>(3.0));
- detail::voronoi_output<T> test_output;
- std::vector< point_2d<T> > intersections;
- srand(static_cast<unsigned int>(time(NULL)));
- point_2d<T> test_origin(2, 1);
-
- for (int i = -50; i <= 50; i++)
- for (int j = -50; j <= 50; j++) {
- intersections.clear();
- T x = static_cast<T>(i) / static_cast<T>(26);
- T y = static_cast<T>(j) / static_cast<T>(26);
- point_2d<T> test_direction(x, y);
- test_output.find_intersections(test_origin, test_direction,
- detail::voronoi_output<T>::LINE,
- test_rect, intersections);
- if (i && j)
- BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
- }
-}
\ No newline at end of file
+//// Boost sweepline library voronoi_clipping_test.cpp file
+//
+//// Copyright Andrii Sydorchuk 2010.
+//// Distributed under the Boost Software License, Version 1.0.
+//// (See accompanying file LICENSE_1_0.txt or copy at
+//// http://www.boost.org/LICENSE_1_0.txt)
+//
+//// See http://www.boost.org for updates, documentation, and revision history.
+//
+//#include <stdlib.h>
+//#include <time.h>
+//
+//#include "../test_type_list.hpp"
+//#include "boost/sweepline/voronoi_sweepline.hpp"
+//using namespace boost::sweepline;
+//
+//#define BOOST_TEST_MODULE voronoi_clipping_test
+//#include <boost/test/test_case_template.hpp>
+//
+//// Test segment clipping.
+//BOOST_AUTO_TEST_CASE_TEMPLATE(segment_clipping_test1, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(2.0));
+// detail::voronoi_output<T> test_output;
+// point_2d<T> test_origin(static_cast<T>(-1), static_cast<T>(3));
+// point_2d<T> test_direction1_1(static_cast<T>(8), static_cast<T>(-8));
+// point_2d<T> test_direction1_2(static_cast<T>(2), static_cast<T>(-2));
+// point_2d<T> test_direction1_3(static_cast<T>(0.5), static_cast<T>(-0.5));
+// point_2d<T> test_direction2(static_cast<T>(2), static_cast<T>(-4));
+// point_2d<T> test_direction3(static_cast<T>(2), static_cast<T>(-1));
+// point_2d<T> test_direction4(static_cast<T>(1), static_cast<T>(-4));
+// point_2d<T> test_direction5(static_cast<T>(5), static_cast<T>(-1));
+//
+// std::vector< point_2d<T> > intersections;
+// test_output.find_intersections(test_origin, test_direction1_1,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(2), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(3) &&
+// intersections[1].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction1_2,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(2), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction1_3,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(intersections.empty(), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction2,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(1), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(1) &&
+// intersections[1].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction3,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(1) &&
+// intersections[0].y() == static_cast<T>(2), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction4,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction5,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
+// intersections[0].y() == static_cast<T>(2), true);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(segment_clipping_test2, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(3.0));
+// detail::voronoi_output<T> test_output;
+// std::vector< point_2d<T> > intersections;
+// srand(static_cast<unsigned int>(time(NULL)));
+// point_2d<T> test_origin(2, 1);
+//
+// for (int i = -50; i <= 50; i++)
+// for (int j = -50; j <= 50; j++) {
+// intersections.clear();
+// point_2d<T> test_direction(static_cast<T>(i), static_cast<T>(j));
+// test_output.find_intersections(test_origin, test_direction,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// if (abs(i) >= 2 || abs(j) >= 2)
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// else
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 0);
+// }
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(segment_clipping_test3, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(3.0));
+// detail::voronoi_output<T> test_output;
+// std::vector< point_2d<T> > intersections;
+// srand(static_cast<unsigned int>(time(NULL)));
+// point_2d<T> test_origin(2, 1);
+//
+// for (int i = -50; i <= 50; i++)
+// for (int j = -50; j <= 50; j++) {
+// intersections.clear();
+// T x = static_cast<T>(i) / static_cast<T>(26);
+// T y = static_cast<T>(j) / static_cast<T>(26);
+// point_2d<T> test_direction(x, y);
+// test_output.find_intersections(test_origin, test_direction,
+// detail::voronoi_output<T>::SEGMENT,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 0);
+// }
+//}
+//
+//// Test ray clipping.
+//BOOST_AUTO_TEST_CASE_TEMPLATE(ray_clipping_test1, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(2.0));
+// detail::voronoi_output<T> test_output;
+// point_2d<T> test_origin(static_cast<T>(-1), static_cast<T>(3));
+// point_2d<T> test_direction1(static_cast<T>(2), static_cast<T>(-2));
+// point_2d<T> test_direction2(static_cast<T>(2), static_cast<T>(-4));
+// point_2d<T> test_direction3(static_cast<T>(2), static_cast<T>(-1));
+// point_2d<T> test_direction4(static_cast<T>(1), static_cast<T>(-4));
+// point_2d<T> test_direction5(static_cast<T>(5), static_cast<T>(-1));
+//
+// std::vector< point_2d<T> > intersections;
+// test_output.find_intersections(test_origin, test_direction1,
+// detail::voronoi_output<T>::RAY,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(2), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(3) &&
+// intersections[1].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction2,
+// detail::voronoi_output<T>::RAY,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(1), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(1) &&
+// intersections[1].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction3,
+// detail::voronoi_output<T>::RAY,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(1) &&
+// intersections[0].y() == static_cast<T>(2), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(4) &&
+// intersections[1].y() == static_cast<T>(0.5), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction4,
+// detail::voronoi_output<T>::RAY,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction5,
+// detail::voronoi_output<T>::RAY,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
+// intersections[0].y() == static_cast<T>(2), true);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(ray_clipping_test2, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(3.0));
+// detail::voronoi_output<T> test_output;
+// std::vector< point_2d<T> > intersections;
+// srand(static_cast<unsigned int>(time(NULL)));
+// point_2d<T> test_origin(2, 1);
+//
+// for (int i = -50; i <= 50; i++)
+// for (int j = -50; j <= 50; j++) {
+// intersections.clear();
+// T x = static_cast<T>(i) / static_cast<T>(26);
+// T y = static_cast<T>(j) / static_cast<T>(26);
+// point_2d<T> test_direction(x, y);
+// test_output.find_intersections(test_origin, test_direction,
+// detail::voronoi_output<T>::RAY,
+// test_rect, intersections);
+// if (i && j)
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// }
+//}
+//
+//// Test line clipping.
+//BOOST_AUTO_TEST_CASE_TEMPLATE(line_clipping_test1, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(2.0));
+// detail::voronoi_output<T> test_output;
+// point_2d<T> test_origin(static_cast<T>(-1), static_cast<T>(3));
+// point_2d<T> test_direction1(static_cast<T>(-1), static_cast<T>(1));
+// point_2d<T> test_direction2(static_cast<T>(-1), static_cast<T>(2));
+// point_2d<T> test_direction3(static_cast<T>(-2), static_cast<T>(1));
+// point_2d<T> test_direction4(static_cast<T>(-1), static_cast<T>(4));
+// point_2d<T> test_direction5(static_cast<T>(-5), static_cast<T>(1));
+//
+// std::vector< point_2d<T> > intersections;
+// test_output.find_intersections(test_origin, test_direction1,
+// detail::voronoi_output<T>::LINE,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(3) &&
+// intersections[0].y() == static_cast<T>(-1), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(0) &&
+// intersections[1].y() == static_cast<T>(2), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction2,
+// detail::voronoi_output<T>::LINE,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(1) &&
+// intersections[0].y() == static_cast<T>(-1), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(0) &&
+// intersections[1].y() == static_cast<T>(1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction3,
+// detail::voronoi_output<T>::LINE,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
+// intersections[0].y() == static_cast<T>(0.5), true);
+// BOOST_CHECK_EQUAL(intersections[1].x() == static_cast<T>(1) &&
+// intersections[1].y() == static_cast<T>(2), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction4,
+// detail::voronoi_output<T>::LINE,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(0) &&
+// intersections[0].y() == static_cast<T>(-1), true);
+//
+// intersections.clear();
+// test_output.find_intersections(test_origin, test_direction5,
+// detail::voronoi_output<T>::LINE,
+// test_rect, intersections);
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 1);
+// BOOST_CHECK_EQUAL(intersections[0].x() == static_cast<T>(4) &&
+// intersections[0].y() == static_cast<T>(2), true);
+//}
+//
+//BOOST_AUTO_TEST_CASE_TEMPLATE(line_clipping_test2, T, test_types) {
+// BRect<T> test_rect(static_cast<T>(0.0), static_cast<T>(-1.0),
+// static_cast<T>(4.0), static_cast<T>(3.0));
+// detail::voronoi_output<T> test_output;
+// std::vector< point_2d<T> > intersections;
+// srand(static_cast<unsigned int>(time(NULL)));
+// point_2d<T> test_origin(2, 1);
+//
+// for (int i = -50; i <= 50; i++)
+// for (int j = -50; j <= 50; j++) {
+// intersections.clear();
+// T x = static_cast<T>(i) / static_cast<T>(26);
+// T y = static_cast<T>(j) / static_cast<T>(26);
+// point_2d<T> test_direction(x, y);
+// test_output.find_intersections(test_origin, test_direction,
+// detail::voronoi_output<T>::LINE,
+// test_rect, intersections);
+// if (i && j)
+// BOOST_CHECK_EQUAL(static_cast<int>(intersections.size()), 2);
+// }
+//}
\ No newline at end of file

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -25,7 +25,6 @@
     BOOST_CHECK_EQUAL(event_q.empty(), true);
     
     event_q.reset();
-
     for (int i = 0; i < 10; i++) {
         T x = static_cast<T>(-i);
         T y = static_cast<T>(10-i);
@@ -42,7 +41,6 @@
 
 BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test2, T, test_types) {
     typedef detail::circle_event<T> circle_event_type;
-
     detail::circle_events_queue<T> event_q;
     detail::site_event<T> temp_site =
         detail::make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0);

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -24,42 +24,42 @@
             BOOST_CHECK_EQUAL((A)!=(B), (ARR)[5])
 
 BOOST_AUTO_TEST_CASE_TEMPLATE(point_2d_test1, T, test_types) {
- point_2d<T> point1 = make_point_2d(static_cast<T>(1), static_cast<T>(1.05));
+ point_2d<T> point1 = make_point_2d(static_cast<T>(1), static_cast<T>(2));
     point_2d<T> point2;
 
     BOOST_CHECK_EQUAL(point1.x(), static_cast<T>(1));
- BOOST_CHECK_EQUAL(point1.y(), static_cast<T>(1.05));
+ BOOST_CHECK_EQUAL(point1.y(), static_cast<T>(2));
 
- point2 = make_point_2d(static_cast<T>(0.999999), static_cast<T>(1));
+ point2 = make_point_2d(static_cast<T>(0), static_cast<T>(2));
     bool arr1[] = { false, true, false, true, false, true };
     EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr1);
 
- point2 = make_point_2d(static_cast<T>(1), static_cast<T>(1.1));
+ point2 = make_point_2d(static_cast<T>(1), static_cast<T>(3));
     bool arr2[] = { true, false, true, false, false, true };
     EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr2);
 
- point2 = make_point_2d(static_cast<T>(1), static_cast<T>(1.05));
+ point2 = make_point_2d(static_cast<T>(1), static_cast<T>(2));
     bool arr3[] = { false, false, true, true, true, false };
     EVENT_TYPES_CHECK_COMPARISON(point1, point2, arr3);
 }
 
 BOOST_AUTO_TEST_CASE_TEMPLATE(site_event_test1, T, test_types) {
- site_event<T> site1 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.05), 0);
+ site_event<T> site1 = make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 0);
     site_event<T> site2;
 
     BOOST_CHECK_EQUAL(site1.x(), static_cast<T>(1));
- BOOST_CHECK_EQUAL(site1.y(), static_cast<T>(1.05));
+ BOOST_CHECK_EQUAL(site1.y(), static_cast<T>(2));
     BOOST_CHECK_EQUAL(site1.get_site_index(), 0);
 
- site2 = make_site_event<T>(static_cast<T>(0.999999), static_cast<T>(1), 1);
+ site2 = make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1);
     bool arr1[] = { false, true, false, true, false, true };
     EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr1);
 
- site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.1), 1);
+ site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(3), 1);
     bool arr2[] = { true, false, true, false, false, true };
     EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr2);
 
- site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(1.05), 1);
+ site2 = make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 1);
     bool arr3[] = { false, false, true, true, true, false };
     EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr3);
 }
@@ -83,7 +83,7 @@
     bool arr2[] = { true, false, true, false, false, true };
     EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr2);
 
- circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(2), static_cast<T>(5));
+ circle2 = make_circle_event<T>(static_cast<T>(1), static_cast<T>(2), static_cast<T>(4));
     bool arr3[] = { true, false, true, false, false, true };
     EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr3);
 
@@ -91,8 +91,8 @@
     bool arr4[] = { false, true, false, true, false, true };
     EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr4);
 
- circle2 = make_circle_event<T>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(10));
- bool arr5[] = { true, false, true, false, false, true };
+ circle2 = make_circle_event<T>(static_cast<T>(-1), static_cast<T>(2), static_cast<T>(3));
+ bool arr5[] = { false, false, true, true, true, false };
     EVENT_TYPES_CHECK_COMPARISON(circle1, circle2, arr5);
 }
 
@@ -111,9 +111,38 @@
     site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
     BOOST_CHECK_EQUAL(circle.compare(site), 0);
     
- site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
- BOOST_CHECK_EQUAL(circle.compare(site), 0);
+ site = make_site_event<T>(static_cast<T>(3), static_cast<T>(3), 0);
+ BOOST_CHECK_EQUAL(circle.compare(site), -1);
 
     site = make_site_event<T>(static_cast<T>(4), static_cast<T>(2), 0);
     BOOST_CHECK_EQUAL(circle.compare(site), -1);
 }
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(segment_site_event_test1, T, test_types) {
+ point_2d<T> point1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(2));
+ point_2d<T> point2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(0));
+ site_event<T> segment = make_site_event<T>(point1, point2, 0);
+
+ BOOST_CHECK_EQUAL(point1 == segment.get_point1(), true);
+ BOOST_CHECK_EQUAL(point2 == segment.get_point0(), true);
+ BOOST_CHECK_EQUAL(segment.is_segment(), true);
+ BOOST_CHECK_EQUAL(segment.is_vertical(), true);
+
+ site_event<T> point = make_site_event<T>(point1, 0);
+ BOOST_CHECK_EQUAL(point.is_segment(), false);
+ BOOST_CHECK_EQUAL(point.is_vertical(), true);
+
+ //bool arr1[] = {
+
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(segment_site_event_test2, T, test_types) {
+ point_2d<T> point1 = make_point_2d<T>(static_cast<T>(1), static_cast<T>(1));
+ point_2d<T> point2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(0));
+ site_event<T> segment = make_site_event<T>(point1, point2, 0);
+
+ BOOST_CHECK_EQUAL(point1 == segment.get_point1(), true);
+ BOOST_CHECK_EQUAL(point2 == segment.get_point0(), true);
+ BOOST_CHECK_EQUAL(segment.is_segment(), true);
+ BOOST_CHECK_EQUAL(segment.is_vertical(), false);
+}

Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -15,7 +15,7 @@
 #define BOOST_TEST_MODULE node_comparer_test
 #include <boost/test/test_case_template.hpp>
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test1, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp1, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef site_event<T> site_event_type;
     typedef beach_line_node<T> bline_node;
@@ -32,8 +32,8 @@
     site_event_type site3 = make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2);
     bline_node node1(site1, site3);
     bline_node node2(site3, site1);
- test_beach_line.insert(std::pair< bline_node, int>(node1, 0));
- test_beach_line.insert(std::pair< bline_node, int>(node2, 1));
+ test_beach_line.insert(std::pair<bline_node, int>(node1, 0));
+ test_beach_line.insert(std::pair<bline_node, int>(node2, 1));
     
     int cur_value = 0;
     for (bline_it it = test_beach_line.begin();
@@ -42,7 +42,7 @@
         BOOST_CHECK_EQUAL(it->second, cur_value);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test2, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp2, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef site_event<T> site_event_type;
     typedef beach_line_node<T> bline_node;
@@ -56,13 +56,13 @@
     site_event_type site3 = make_site_event<T>(static_cast<T>(2), static_cast<T>(4), 2);
     bline_node initial_node1(site1, site2);
     bline_node initial_node2(site2, site1);
- test_beach_line[initial_node1] = 0;
- test_beach_line[initial_node2] = 1;
+ test_beach_line.insert(std::pair<bline_node, int>(initial_node1, 0));
+ test_beach_line.insert(std::pair<bline_node, int>(initial_node2, 1));
 
     bline_node new_node1(site1, site3);
     bline_node new_node2(site3, site1);
- test_beach_line[new_node1] = 2;
- test_beach_line[new_node2] = 3;
+ test_beach_line.insert(std::pair<bline_node, int>(initial_node1, 2));
+ test_beach_line.insert(std::pair<bline_node, int>(initial_node2, 3));
 
     int cur_value = 0;
     for (bline_it it = test_beach_line.begin();
@@ -71,7 +71,7 @@
         BOOST_CHECK_EQUAL(it->second, cur_value);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test3, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp3, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef beach_line_node<T> bline_node;
     node_comparer<bline_node> node_comparer_test;
@@ -104,7 +104,7 @@
     BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test4, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp4, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef beach_line_node<T> bline_node;
     node_comparer<bline_node> node_comparer_test;
@@ -114,12 +114,11 @@
         make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 1));
     
     bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
- bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 3));
- bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 4));
- bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
- bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
- bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 4));
- bline_node new_node7(make_site_event<T>(static_cast<T>(2), static_cast<T>(10), 4));
+ bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 2));
+ bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 2));
+ bline_node new_node4(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 2));
+ bline_node new_node5(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 2));
+ bline_node new_node6(make_site_event<T>(static_cast<T>(2), static_cast<T>(3), 2));
 
     BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
     BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), true);
@@ -127,7 +126,6 @@
     BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node4), true);
     BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node5), true);
     BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node6), true);
- BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node7), true);
 
     BOOST_CHECK_EQUAL(node_comparer_test(new_node1, initial_node), true);
     BOOST_CHECK_EQUAL(node_comparer_test(new_node2, initial_node), false);
@@ -135,10 +133,9 @@
     BOOST_CHECK_EQUAL(node_comparer_test(new_node4, initial_node), false);
     BOOST_CHECK_EQUAL(node_comparer_test(new_node5, initial_node), false);
     BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
- BOOST_CHECK_EQUAL(node_comparer_test(new_node7, initial_node), false);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test5, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp5, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef beach_line_node<T> bline_node;
     node_comparer<bline_node> node_comparer_test;
@@ -171,7 +168,7 @@
     BOOST_CHECK_EQUAL(node_comparer_test(new_node6, initial_node), false);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test6, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp6, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef beach_line_node<T> bline_node;
     node_comparer<bline_node> node_comparer_test;
@@ -205,7 +202,7 @@
     BOOST_CHECK_EQUAL(node_comparer_test(new_node7, initial_node), false);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test7, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp7, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef beach_line_node<T> bline_node;
     node_comparer<bline_node> node_comparer_test;
@@ -227,7 +224,7 @@
     BOOST_CHECK_EQUAL(node_comparer_test(new_node3, initial_node), false);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test8, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp8, T, test_types) {
     typedef point_2d<T> Point2D;
     typedef beach_line_node<T> bline_node;
     node_comparer<bline_node> node_comparer_test;

Added: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_predicates_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_predicates_test.cpp 2010-08-20 08:44:09 EDT (Fri, 20 Aug 2010)
@@ -0,0 +1,295 @@
+// Boost sweepline library segment_predicates_test.cpp file
+
+// Copyright Andrii Sydorchuk 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include "../test_type_list.hpp"
+#include "boost/sweepline/voronoi_segment_sweepline.hpp"
+using namespace boost::sweepline;
+
+#define BOOST_TEST_MODULE predicates_test
+#include <boost/test/test_case_template.hpp>
+
+#define CHECK_ORIENTATION_EQUAL(p1, p2, p3, orientation) \
+ BOOST_CHECK_EQUAL(detail::orientation_test(p1, p2, p3) == orientation, true)
+
+#define CHECK_FAST_LESS_PREDICATE_PP(p1, p2, p3, exp) \
+ BOOST_CHECK_EQUAL(detail::fast_less_predicate(p1, p2, p3) == exp, true)
+
+#define CHECK_LESS_PREDICATE_PP(p1, p2, p3, exp) \
+ BOOST_CHECK_EQUAL(detail::less_predicate(p1, p2, p3) == exp, true)
+
+#define CHECK_LESS_PREDICATE_CHECK_PS(p1, p2, p3, p4, r, exp) \
+ BOOST_CHECK_EQUAL(detail::less_predicate_check(p1, p2, p3, p4, r) == exp, true); \
+ if (exp != detail::UNDEFINED) { \
+ bool exp_res = (exp == detail::LESS) ? true : false; \
+ BOOST_CHECK_EQUAL(detail::less_predicate(p1, p2, p3, p4, r), exp_res); \
+ }
+
+#define CHECK_LESS_PREDICATE_PS(p1, p2, p3, p4, r, exp) \
+ BOOST_CHECK_EQUAL(detail::less_predicate(p1, p2, p3, p4, r) == exp, true)
+
+#define CHECK_LESS_PREDICATE_SS(p1, p2, p3, p4, p5, r, exp) \
+ BOOST_CHECK_EQUAL(detail::less_predicate(p1, p2, p3, p4, p5, r) == exp, true)
+
+// This test uses integer values in the range [-2^31, 2^31), to validate
+// orientation predicate for the hole integer range input coordinates.
+BOOST_AUTO_TEST_CASE_TEMPLATE(orientation_test1, T, test_types) {
+ int min_int = std::numeric_limits<int>::min();
+ int max_int = std::numeric_limits<int>::max();
+ point_2d<T> point1 = make_point_2d<T>(min_int, min_int);
+ point_2d<T> point2 = make_point_2d<T>(0, 0);
+ point_2d<T> point3 = make_point_2d<T>(max_int, max_int);
+ point_2d<T> point4 = make_point_2d<T>(min_int, max_int);
+ point_2d<T> point5 = make_point_2d<T>(max_int - 1, max_int);
+
+ CHECK_ORIENTATION_EQUAL(point1, point2, point3, detail::COLINEAR);
+ CHECK_ORIENTATION_EQUAL(point1, point3, point2, detail::COLINEAR);
+ CHECK_ORIENTATION_EQUAL(point2, point3, point1, detail::COLINEAR);
+ CHECK_ORIENTATION_EQUAL(point2, point1, point3, detail::COLINEAR);
+ CHECK_ORIENTATION_EQUAL(point3, point1, point2, detail::COLINEAR);
+ CHECK_ORIENTATION_EQUAL(point3, point2, point1, detail::COLINEAR);
+
+ CHECK_ORIENTATION_EQUAL(point1, point4, point3, detail::RIGHT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point1, point3, point4, detail::LEFT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point4, point1, point3, detail::LEFT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point4, point3, point1, detail::RIGHT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point3, point4, point1, detail::LEFT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point3, point1, point4, detail::RIGHT_ORIENTATION);
+
+ CHECK_ORIENTATION_EQUAL(point1, point5, point3, detail::RIGHT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point1, point3, point5, detail::LEFT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point5, point1, point3, detail::LEFT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point5, point3, point1, detail::RIGHT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point3, point5, point1, detail::LEFT_ORIENTATION);
+ CHECK_ORIENTATION_EQUAL(point3, point1, point5, detail::RIGHT_ORIENTATION);
+}
+
+// Test fast point-point predicate.
+BOOST_AUTO_TEST_CASE_TEMPLATE(fast_less_predicate_test1, T, test_types) {
+ point_2d<T> point1 = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(0));
+ point_2d<T> point2 = make_point_2d<T>(static_cast<T>(-8), static_cast<T>(9));
+ point_2d<T> point3 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(1));
+
+ point_2d<T> site1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(5));
+ CHECK_FAST_LESS_PREDICATE_PP(point1, point2, site1, detail::UNDEFINED);
+ CHECK_FAST_LESS_PREDICATE_PP(point3, point1, site1, detail::UNDEFINED);
+
+ point_2d<T> site2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(4));
+ CHECK_FAST_LESS_PREDICATE_PP(point1, point2, site2, detail::MORE);
+ CHECK_FAST_LESS_PREDICATE_PP(point3, point1, site2, detail::MORE);
+
+ point_2d<T> site3 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(6));
+ CHECK_FAST_LESS_PREDICATE_PP(point1, point2, site3, detail::LESS);
+ CHECK_FAST_LESS_PREDICATE_PP(point3, point1, site3, detail::LESS);
+}
+
+// Test main point-point predicate.
+BOOST_AUTO_TEST_CASE_TEMPLATE(less_predicates_point_point_test1, T, test_types) {
+ point_2d<T> point1 = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(0));
+ point_2d<T> point2 = make_point_2d<T>(static_cast<T>(-8), static_cast<T>(9));
+ point_2d<T> point3 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(1));
+
+ point_2d<T> site1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(5));
+ CHECK_LESS_PREDICATE_PP(point1, point2, site1, false);
+ CHECK_LESS_PREDICATE_PP(point3, point1, site1, false);
+
+ point_2d<T> site2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(4));
+ CHECK_LESS_PREDICATE_PP(point1, point2, site2, false);
+ CHECK_LESS_PREDICATE_PP(point3, point1, site2, false);
+
+ point_2d<T> site3 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(6));
+ CHECK_LESS_PREDICATE_PP(point1, point2, site3, true);
+ CHECK_LESS_PREDICATE_PP(point3, point1, site3, true);
+}
+
+// Vertical segment case.
+BOOST_AUTO_TEST_CASE_TEMPLATE(less_predicate_check_point_segment_test1, T, test_types) {
+ point_2d<T> segm_start = make_point_2d<T>(static_cast<T>(-4), static_cast<T>(0));
+ point_2d<T> segm_end = make_point_2d<T>(static_cast<T>(-4), static_cast<T>(20));
+
+ point_2d<T> site_p = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(10));
+ point_2d<T> new_p1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(11));
+ point_2d<T> new_p2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(9));
+
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p, new_p1,
+ false, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p, new_p2,
+ false, detail::MORE);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p, new_p1,
+ true, detail::LESS);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p, new_p2,
+ true, detail::UNDEFINED);
+}
+
+// Not vertical segment case. Site is to the left of the segment vector.
+BOOST_AUTO_TEST_CASE_TEMPLATE(less_predicate_check_point_segment_test2, T, test_types) {
+ point_2d<T> segm_start = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(5));
+ point_2d<T> segm_end = make_point_2d<T>(static_cast<T>(2), static_cast<T>(-2));
+
+ point_2d<T> site_p1 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(4));
+ point_2d<T> new_p1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-1));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p1,
+ false, detail::MORE);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p1,
+ true, detail::MORE);
+
+ point_2d<T> new_p2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(1));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p2,
+ false, detail::MORE);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p2,
+ true, detail::UNDEFINED);
+
+ point_2d<T> new_p3 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(4));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p3,
+ false, detail::MORE);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p3,
+ true, detail::UNDEFINED);
+
+ point_2d<T> new_p4 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(5));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p4,
+ false, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p4,
+ true, detail::LESS);
+}
+
+// Not vertical segment case. Site is to the right of the segment vector.
+BOOST_AUTO_TEST_CASE_TEMPLATE(less_predicate_check_point_segment_test3, T, test_types) {
+ point_2d<T> segm_start = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(5));
+ point_2d<T> segm_end = make_point_2d<T>(static_cast<T>(2), static_cast<T>(-2));
+
+ point_2d<T> site_p1 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(-4));
+ point_2d<T> site_p2 = make_point_2d<T>(static_cast<int>(-4), static_cast<int>(1));
+
+ point_2d<T> new_p1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(1));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p1,
+ false, detail::LESS);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p1,
+ true, detail::LESS);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p1,
+ false, detail::LESS);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p1,
+ true, detail::LESS);
+
+ point_2d<T> new_p2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-2));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p2,
+ false, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p2,
+ true, detail::LESS);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p2,
+ false, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p2,
+ true, detail::LESS);
+
+ point_2d<T> new_p3 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-8));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p3,
+ false, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p3,
+ true, detail::LESS);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p3,
+ false, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p3,
+ true, detail::LESS);
+
+ point_2d<T> new_p4 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-9));
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p4,
+ false, detail::MORE);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p1, new_p4,
+ true, detail::UNDEFINED);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p4,
+ false, detail::MORE);
+ CHECK_LESS_PREDICATE_CHECK_PS(segm_start, segm_end, site_p2, new_p4,
+ true, detail::UNDEFINED);
+}
+
+// Test main point-segment predicate.
+BOOST_AUTO_TEST_CASE_TEMPLATE(less_predicate_point_segment_test1, T, test_types) {
+ point_2d<T> segm_start = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(5));
+ point_2d<T> segm_end = make_point_2d<T>(static_cast<T>(2), static_cast<T>(-2));
+
+ point_2d<T> site_p1 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(4));
+ point_2d<T> site_p2 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(-4));
+ point_2d<T> site_p3 = make_point_2d<T>(static_cast<int>(-4), static_cast<int>(1));
+
+ point_2d<T> new_p1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(1));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p1, new_p1, true, false);
+
+ point_2d<T> new_p2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(4));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p1, new_p2, true, true);
+
+ point_2d<T> new_p3 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(5));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p1, new_p3, false, false);
+
+ point_2d<T> new_p4 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(7));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p1, new_p4, false, true);
+
+ point_2d<T> new_p5 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-2));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p2, new_p5, false, false);
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p3, new_p5, false, false);
+
+ point_2d<T> new_p6 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-8));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p2, new_p6, false, false);
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p3, new_p6, false, false);
+
+ point_2d<T> new_p7 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-9));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p2, new_p7, true, true);
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p3, new_p7, true, true);
+
+ point_2d<T> new_p8 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-18));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p2, new_p8, true, false);
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p3, new_p8, true, false);
+
+ point_2d<T> new_p9 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(-1));
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p2, new_p9, false, true);
+ CHECK_LESS_PREDICATE_PS(segm_start, segm_end, site_p3, new_p9, false, true);
+}
+
+// Test main segment-segment predicate.
+BOOST_AUTO_TEST_CASE_TEMPLATE(less_predicate_segment_segment_test1, T, test_types) {
+ point_2d<T> segm_start1 = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(5));
+ point_2d<T> segm_end1 = make_point_2d<T>(static_cast<T>(2), static_cast<T>(-2));
+
+ // Common start point case.
+ point_2d<T> segm_start2_1 = make_point_2d<T>(static_cast<T>(-5), static_cast<T>(5));
+ point_2d<T> segm_end2_1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(6));
+ point_2d<T> new_site1 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(2));
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_1, segm_end2_1,
+ new_site1, false, false);
+
+ point_2d<T> new_site2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(9));
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_1, segm_end2_1,
+ new_site2, false, true);
+
+ point_2d<T> new_site3 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(10));
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_1, segm_end2_1,
+ new_site3, false, true);
+
+ // No common segment end points.
+ point_2d<T> segm_start2_2 = make_point_2d<T>(static_cast<T>(-2), static_cast<T>(4));
+ point_2d<T> segm_end2_2 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(4));
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_2, segm_end2_2,
+ new_site1, false, false);
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_2, segm_end2_2,
+ new_site1, true, false);
+ CHECK_LESS_PREDICATE_SS(segm_start2_2, segm_end2_2, segm_start1, segm_end1,
+ new_site1, false, false);
+
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_2, segm_end2_2,
+ new_site2, false, true);
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_2, segm_end2_2,
+ new_site2, true, true);
+ CHECK_LESS_PREDICATE_SS(segm_start2_2, segm_end2_2, segm_start1, segm_end1,
+ new_site2, false, true);
+
+ point_2d<T> new_site4 = make_point_2d<T>(static_cast<T>(0), static_cast<T>(5));
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_2, segm_end2_2,
+ new_site4, false, true);
+ CHECK_LESS_PREDICATE_SS(segm_start1, segm_end1, segm_start2_2, segm_end2_2,
+ new_site4, true, false);
+ CHECK_LESS_PREDICATE_SS(segm_start2_2, segm_end2_2, segm_start1, segm_end1,
+ new_site4, false, false);
+}
\ No newline at end of file


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