Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78186 - sandbox/gtl/boost/polygon
From: sydorchuk.andriy_at_[hidden]
Date: 2012-04-24 19:51:11


Author: asydorchuk
Date: 2012-04-24 19:51:09 EDT (Tue, 24 Apr 2012)
New Revision: 78186
URL: http://svn.boost.org/trac/boost/changeset/78186

Log:
Updating segment concept/data/traits.
Text files modified:
   sandbox/gtl/boost/polygon/segment_concept.hpp | 478 +++++++++++++++++++--------------------
   sandbox/gtl/boost/polygon/segment_data.hpp | 92 ++++--
   sandbox/gtl/boost/polygon/segment_traits.hpp | 32 +-
   3 files changed, 310 insertions(+), 292 deletions(-)

Modified: sandbox/gtl/boost/polygon/segment_concept.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/segment_concept.hpp (original)
+++ sandbox/gtl/boost/polygon/segment_concept.hpp 2012-04-24 19:51:09 EDT (Tue, 24 Apr 2012)
@@ -1,6 +1,6 @@
 /*
   Copyright 2008 Intel Corporation
-
+
   Use, modification and distribution are subject to 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).
@@ -15,207 +15,209 @@
 
 namespace boost { namespace polygon{
   struct segment_concept {};
-
- template <typename T>
+
+ template <typename Segment>
   struct is_segment_concept { typedef gtl_no type; };
+
   template <>
   struct is_segment_concept<segment_concept> {
     typedef gtl_yes type;
   };
 
- template <typename T>
+ template <typename Segment>
   struct is_mutable_segment_concept { typedef gtl_no type; };
+
   template <>
   struct is_mutable_segment_concept<segment_concept> {
     typedef gtl_yes type;
   };
 
- template <typename T, typename CT>
+ template <typename Segment, typename CT>
   struct segment_distance_type_by_concept {
     typedef void type;
   };
 
- template <typename T>
- struct segment_distance_type_by_concept<T, gtl_yes> {
+ template <typename Segment>
+ struct segment_distance_type_by_concept<Segment, gtl_yes> {
     typedef typename coordinate_traits<
- typename segment_traits<T>::coordinate_type
+ typename segment_traits<Segment>::coordinate_type
>::coordinate_distance type;
   };
 
- template <typename T>
+ template <typename Segment>
   struct segment_distance_type {
     typedef typename segment_distance_type_by_concept<
- T,
+ Segment,
       typename is_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment>::type
>::type
>::type type;
   };
 
- template <typename T, typename CT>
+ template <typename Segment, typename CT>
   struct segment_point_type_by_concept { typedef void type; };
- template <typename T>
- struct segment_point_type_by_concept<T, gtl_yes> {
- typedef typename segment_traits<T>::point_type type;
+
+ template <typename Segment>
+ struct segment_point_type_by_concept<Segment, gtl_yes> {
+ typedef typename segment_traits<Segment>::point_type type;
   };
 
- template <typename T>
+ template <typename Segment>
   struct segment_point_type {
     typedef typename segment_point_type_by_concept<
- T,
+ Segment,
       typename is_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment>::type
>::type
>::type type;
   };
 
- template <typename T, typename CT>
+ template <typename Segment, typename CT>
   struct segment_coordinate_type_by_concept {
     typedef void type;
   };
-
- template <typename T>
- struct segment_coordinate_type_by_concept<T, gtl_yes> {
- typedef typename segment_traits<T>::coordinate_type type;
+
+ template <typename Segment>
+ struct segment_coordinate_type_by_concept<Segment, gtl_yes> {
+ typedef typename segment_traits<Segment>::coordinate_type type;
   };
 
- template <typename T>
+ template <typename Segment>
   struct segment_coordinate_type {
     typedef typename segment_coordinate_type_by_concept<
- T,
+ Segment,
       typename is_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment>::type
>::type
>::type type;
   };
 
   struct y_s_get : gtl_yes {};
 
- template <typename T>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_get,
       typename is_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<T>::type
+ typename segment_point_type<Segment>::type
>::type
- get(const T& segment, direction_1d dir) {
- return segment_traits<T>::get(segment, dir);
+ get(const Segment& segment, direction_1d dir) {
+ return segment_traits<Segment>::get(segment, dir);
   }
 
   struct y_s_set : gtl_yes {};
 
- template <typename T, typename point_type>
+ template <typename Segment, typename Point>
   typename enable_if<
     typename gtl_and<
       y_s_set,
       typename is_mutable_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
     void
>::type
- set(T& segment, direction_1d dir, const point_type& value) {
- segment_mutable_traits<T>::set(segment, dir, value);
+ set(Segment& segment, direction_1d dir, const Point& value) {
+ segment_mutable_traits<Segment>::set(segment, dir, value);
   }
 
   struct y_s_construct : gtl_yes {};
-
- template <typename T, typename T2, typename T3>
+
+ template <typename Segment, typename Point1, typename Point2>
   typename enable_if<
     typename gtl_and<
       y_s_construct,
       typename is_mutable_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- T
+ Segment
>::type
- construct(const T2& low_value, const T3& high_value) {
- return segment_mutable_traits<T>::construct(low_value, high_value);
+ construct(const Point1& low, const Point2& high) {
+ return segment_mutable_traits<Segment>::construct(low, high);
   }
 
   struct y_s_copy_construct : gtl_yes {};
 
- template <typename T, typename T2>
+ template <typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_3<
       y_s_copy_construct,
       typename is_mutable_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<T2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
- T
+ Segment1
>::type
- copy_construct(const T2& segment) {
- return construct<T>(get(segment, LOW ), get(segment, HIGH));
+ copy_construct(const Segment2& segment) {
+ return construct<Segment1>(get(segment, LOW), get(segment, HIGH));
   }
 
   struct y_s_assign : gtl_yes {};
 
- template <typename T1, typename T2>
+ template <typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_3<
       y_s_assign,
         typename is_mutable_segment_concept<
- typename geometry_concept<T1>::type
+ typename geometry_concept<Segment1>::type
>::type,
         typename is_segment_concept<
- typename geometry_concept<T2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
- T1
+ Segment1
>::type &
- assign(T1& lvalue, const T2& rvalue) {
- lvalue = copy_construct<T1>(rvalue);
- return lvalue;
+ assign(Segment1& lvalue, const Segment2& rvalue) {
+ return lvalue = copy_construct<Segment1>(rvalue);
   }
 
   struct y_s_equivalence : gtl_yes {};
 
- template <typename T, typename T2>
+ template <typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_3<
       y_s_equivalence,
       typename is_segment_concept<
- typename geometry_concept<T>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<T2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
>::type
- equivalence(const T& segment1, const T2& segment2) {
+ equivalence(const Segment1& segment1, const Segment2& segment2) {
     return get(segment1, LOW) == get(segment2, LOW) &&
            get(segment1, HIGH) == get(segment2, HIGH);
   }
-
+
   struct y_s_on_above_or_below : gtl_yes {};
 
   //-1 for below, 0 for on and 1 for above
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_on_above_or_below,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
     bool
- >::type
- on_above_or_below(const segment_type& segment,
- typename segment_point_type<segment_type>::type value) {
+ >::type
+ on_above_or_below(const Segment& segment,
+ const typename segment_point_type<Segment>::type& point) {
     typedef polygon_arbitrary_formation<
- typename segment_coordinate_type<segment_type>::type
+ typename segment_coordinate_type<Segment>::type
> paf;
     typename paf::Point pt, l, h;
- assign(pt, value);
+ assign(pt, point);
     assign(l, low(segment));
     assign(h, high(segment));
     return paf::on_above_or_below(pt, typename paf::half_edge(l, h));
@@ -223,26 +225,26 @@
 
   struct y_s_contains : gtl_yes {};
 
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_contains,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
     bool
- >::type
- contains(const segment_type& segment,
- typename segment_point_type<segment_type>::type value,
+ >::type
+ contains(const Segment& segment,
+ const typename segment_point_type<Segment>::type& point,
            bool consider_touch = true ) {
- if(on_above_or_below(segment, value) == 0) {
- rectangle_data<typename segment_coordinate_type<segment_type>::type> rect;
+ if(on_above_or_below(segment, point) == 0) {
+ rectangle_data<typename segment_coordinate_type<Segment>::type> rect;
       set_points(rect, low(segment), high(segment));
       if(area(rect) == 0.0) {
         if(!consider_touch) {
- return !equivalence(value, low(segment)) &&
- !equivalence(value, high(segment));
+ return !equivalence(point, low(segment)) &&
+ !equivalence(point, high(segment));
         }
       }
       return contains(rect, value, consider_touch);
@@ -252,149 +254,149 @@
 
   struct y_s_contains2 : gtl_yes {};
 
- template <typename segment_type, typename segment_type_2>
+ template <typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_3<
       y_s_contains2,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
>::type
- contains(const segment_type& segment,
- const segment_type_2& value,
+ contains(const Segment1& segment,
+ const Segment2& value,
            bool consider_touch = true) {
     return contains(segment, get(value, LOW), consider_touch) &&
            contains(segment, get(value, HIGH), consider_touch);
   }
 
   struct y_s_low : gtl_yes {};
-
+
   // get the low point
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_low,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<segment_type>::type
+ typename segment_point_type<Segment>::type
>::type
- low(const segment_type& segment) {
+ low(const Segment& segment) {
     return get(segment, LOW);
   }
 
   struct y_s_high : gtl_yes {};
 
   // get the high point
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_high,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<segment_type>::type
+ typename segment_point_type<Segment>::type
>::type
- high(const segment_type& segment) {
+ high(const Segment& segment) {
     return get(segment, HIGH);
   }
 
   struct y_s_center : gtl_yes {};
 
   // get the center point
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_center,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<segment_type>::type
+ typename segment_point_type<Segment>::type
>::type
- center(const segment_type& segment) {
- return construct<typename segment_coordinate_type<segment_type>::type>(
+ center(const Segment& segment) {
+ return construct<typename segment_coordinate_type<Segment>::type>(
         (x(high(segment)) + x(low(segment)))/2,
- (y(high(segment)) + y(low(segment)))/2);
+ (y(high(segment)) + y(low(segment)))/2);
   }
 
   struct y_s_low2 : gtl_yes {};
 
   // set the low point to v
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_low2,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
     void
- >::type
- low(segment_type& segment,
- const typename segment_point_type<segment_type>::type& v) {
- set(segment, LOW, v);
+ >::type
+ low(Segment& segment,
+ const typename segment_point_type<Segment>::type& point) {
+ set(segment, LOW, point);
   }
-
+
   struct y_s_high2 : gtl_yes {};
 
   // set the high coordinate to v
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_high2,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
     void
- >::type
- high(segment_type& segment,
- const typename segment_point_type<segment_type>::type& v) {
- set(segment, HIGH, v);
+ >::type
+ high(Segment& segment,
+ const typename segment_point_type<Segment>::type& point) {
+ set(segment, HIGH, point);
   }
 
   struct y_s_length : gtl_yes {};
 
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_length,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_distance_type<segment_type>::type
+ typename segment_distance_type<Segment>::type
>::type
- length(const segment_type& segment) {
+ length(const Segment& segment) {
     return euclidean_distance(low(segment), high(segment));
   }
 
   struct y_s_scale_up : gtl_yes {};
 
   // scale segment by factor
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_scale_up,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- scale_up(segment_type& segment,
+ scale_up(Segment& segment,
            typename coordinate_traits<
- typename segment_coordinate_type<segment_type>::type
+ typename segment_coordinate_type<Segment>::type
>::unsigned_area_type factor) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
     low(segment, scale_up(l, factor));
     high(segment, scale_up(h, factor));
     return segment;
@@ -402,21 +404,21 @@
 
   struct y_s_scale_down : gtl_yes {};
 
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_scale_down,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- scale_down(segment_type& segment,
+ scale_down(Segment& segment,
              typename coordinate_traits<
- typename segment_coordinate_type<segment_type>::type
+ typename segment_coordinate_type<Segment>::type
>::unsigned_area_type factor) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
     low(segment, scale_down(l, factor));
     high(segment, scale_down(h, factor));
     return segment;
@@ -424,18 +426,18 @@
 
   struct y_s_scale : gtl_yes {};
 
- template <typename segment_type, typename scaling_type>
+ template <typename Segment, typename scaling_type>
   typename enable_if<
     typename gtl_and<
       y_s_scale,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- scale(segment_type& segment, scaling_type factor) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
+ scale(Segment& segment, scaling_type factor) {
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
     low(segment, scale(l, factor));
     high(segment, scale(h, factor));
     return segment;
@@ -444,18 +446,18 @@
 
   struct y_s_transform : gtl_yes {};
 
- template <typename segment_type, typename transform_type>
+ template <typename Segment, typename transform_type>
   typename enable_if<
     typename gtl_and<
       y_s_transform,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- transform(segment_type& segment, const transform_type& val) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
+ transform(Segment& segment, const transform_type& val) {
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
     low(segment, transform(l, val));
     high(segment, transform(h, val));
     return segment;
@@ -464,82 +466,82 @@
   struct y_s_move : gtl_yes {};
 
   // move segment by delta
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_move,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- move(segment_type& segment, orientation_2d orient,
- typename segment_coordinate_type<segment_type>::type displacement) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
+ move(Segment& segment, orientation_2d orient,
+ typename segment_coordinate_type<Segment>::type displacement) {
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
     low(segment, move(l, orient, displacement));
     high(segment, move(h, orient, displacement));
     return segment;
   }
-
+
   struct y_s_convolve : gtl_yes {};
 
- // convolve this with b
- template <typename segment_type>
+ // convolve this with point
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_convolve,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- convolve(segment_type& segment,
- const typename segment_point_type<segment_type>::type& b) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
- low(segment, convolve(l, b));
- high(segment, convolve(h, b));
+ convolve(Segment& segment,
+ const typename segment_point_type<Segment>::type& point) {
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
+ low(segment, convolve(l, point));
+ high(segment, convolve(h, point));
     return segment;
   }
 
   struct y_s_deconvolve : gtl_yes {};
 
- // deconvolve this with b
- template <typename segment_type>
+ // deconvolve this with point
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_deconvolve,
       typename is_mutable_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- segment_type
+ Segment
>::type &
- deconvolve(segment_type& segment,
- const typename segment_point_type<segment_type>::type& b) {
- typename segment_point_type<segment_type>::type l = low(segment), h = high(segment);
- low(segment, deconvolve(l, b));
- high(segment, deconvolve(h, b));
+ deconvolve(Segment& segment,
+ const typename segment_point_type<Segment>::type& point) {
+ typename segment_point_type<Segment>::type l = low(segment), h = high(segment);
+ low(segment, deconvolve(l, point));
+ high(segment, deconvolve(h, point));
     return segment;
   }
 
   struct y_s_e_dist : gtl_yes {};
 
   // distance from a point to a segment
- template <typename segment_type>
+ template <typename Segment>
   typename enable_if<
     typename gtl_and<
       y_s_e_dist,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_distance_type<segment_type>::type
+ typename segment_distance_type<Segment>::type
>::type
- euclidean_distance(const segment_type& segment,
- const typename segment_point_type<segment_type>::type& position) {
- typedef typename segment_distance_type<segment_type>::type Unit;
+ euclidean_distance(const Segment& segment,
+ const typename segment_point_type<Segment>::type& position) {
+ typedef typename segment_distance_type<Segment>::type Unit;
     Unit x1 = x(low(segment));
     Unit y1 = y(low(segment));
     Unit x2 = x(high(segment));
@@ -556,7 +558,7 @@
       return euclidean_distance(high(segment), position);
     } else if(param < 0.0) {
       return euclidean_distance(low(segment), position);
- }
+ }
     Unit denom = sqrt(length_sq);
     if(denom == 0.0)
       return 0.0;
@@ -567,169 +569,165 @@
   }
 
   struct y_s_e_dist2 : gtl_yes {};
-
+
   // distance between two segments
- template <typename segment_type, typename segment_type_2>
- typename enable_if<
+ template <typename Segment1, typename Segment2>
+ typename enable_if<
     typename gtl_and_3<
       y_s_e_dist2,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
- typename segment_distance_type<segment_type>::type
+ typename segment_distance_type<Segment1>::type
>::type
- euclidean_distance(const segment_type& segment,
- const segment_type_2& b) {
- typename segment_distance_type<segment_type>::type
- result1 = euclidean_distance(segment, low(b)),
- result2 = euclidean_distance(segment, high(b));
+ euclidean_distance(const Segment1& segment1,
+ const Segment2& segment2) {
+ typename segment_distance_type<Segment1>::type
+ result1 = euclidean_distance(segment1, low(segment2)),
+ result2 = euclidean_distance(segment1, high(segment2));
     if(result2 < result1) return result2;
     return result1;
   }
-
+
   struct y_s_e_intersects : gtl_yes {};
 
   // check if Interval b intersects `this` Interval
- template <typename segment_type, typename segment_type_2>
+ template <typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_3<
- y_s_e_intersects,
+ y_s_e_intersects,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
- >::type,
+ typename geometry_concept<Segment1>::type
+ >::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
- >::type
- intersects(const segment_type& segment,
- const segment_type_2& b,
+ >::type
+ intersects(const Segment1& segment1,
+ const Segment2& segment2,
              bool consider_touch = true) {
     if(consider_touch) {
- if(low(segment) == low(b) || low(segment) == high(b) ||
- high(segment) == low(b) || high(segment) == high(b))
+ if(low(segment1) == low(segment2) || low(segment1) == high(segment2) ||
+ high(segment1) == low(segment2) || high(segment1) == high(segment2))
         return true;
     }
     typedef polygon_arbitrary_formation<
- typename segment_coordinate_type<segment_type>::type
+ typename segment_coordinate_type<Segment1>::type
> paf;
- typename paf::Point l, h, l2, h2;
- assign(l, low(segment));
- assign(h, high(segment));
- assign(l2, low(b));
- assign(h2, high(b));
- return paf::intersects(typename paf::half_edge(l, h),
+ typename paf::Point l1, h1, l2, h2;
+ assign(l1, low(segment1));
+ assign(h1, high(segment1));
+ assign(l2, low(segment2));
+ assign(h2, high(segment2));
+ return paf::intersects(typename paf::half_edge(l1, h1),
                            typename paf::half_edge(l2, h2));
   }
 
   struct y_s_e_bintersect : gtl_yes {};
 
   // check if Interval b partially overlaps `this` Interval
- template <typename segment_type, typename segment_type_2>
- typename enable_if<
+ template <typename Segment1, typename Segment2>
+ typename enable_if<
     typename gtl_and_3<
       y_s_e_bintersect,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
- >::type
- boundaries_intersect(const segment_type& segment, const segment_type_2& b,
+ >::type
+ boundaries_intersect(const Segment1& segment1, const Segment2& segment2,
                        bool consider_touch = true) {
- return (contains(segment, low(b), consider_touch) ||
- contains(segment, high(b), consider_touch)) &&
- (contains(b, low(segment), consider_touch) ||
- contains(b, high(segment), consider_touch));
+ return (contains(segment1, low(segment2), consider_touch) ||
+ contains(segment1, high(segment2), consider_touch)) &&
+ (contains(segment2, low(segment1), consider_touch) ||
+ contains(segment2, high(segment1), consider_touch));
   }
 
   struct y_s_abuts1 : gtl_yes {};
 
   // check if they are end to end
- template <typename segment_type, typename segment_type_2>
+ template <typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_3<
       y_s_abuts1,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
>::type
- abuts(const segment_type& segment,
- const segment_type_2& b,
- direction_1d dir) {
- return dir.to_int() ? equivalence(low(b) , high(segment)) :
- equivalence(low(segment) , high(b));
+ abuts(const Segment1& segment1, const Segment2& segment2, direction_1d dir) {
+ return dir.to_int() ? equivalence(low(segment2) , high(segment1)) :
+ equivalence(low(segment1) , high(segment2));
   }
 
   struct y_s_abuts2 : gtl_yes {};
 
   // check if they are end to end
- template <typename segment_type, typename segment_type_2>
- typename enable_if<
+ template <typename Segment1, typename Segment2>
+ typename enable_if<
     typename gtl_and_3<
       y_s_abuts2,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
- >::type
- abuts(const segment_type& segment, const segment_type_2& b) {
- return abuts(segment, b, HIGH) || abuts(segment, b, LOW);
- }
+ >::type
+ abuts(const Segment1& segment1, const Segment2& segment2) {
+ return abuts(segment1, segment2, HIGH) || abuts(segment1, segment2, LOW);
+ }
 
   struct y_s_intersect : gtl_yes {};
 
   // set point to the intersection of segment and b
- template <typename point_type,
- typename segment_type,
- typename segment_type_2>
+ template <typename Point, typename Segment1, typename Segment2>
   typename enable_if<
     typename gtl_and_4<
       y_s_intersect,
       typename is_mutable_point_concept<
- typename geometry_concept<point_type>::type
+ typename geometry_concept<Point>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type>::type
+ typename geometry_concept<Segment1>::type
>::type,
       typename is_segment_concept<
- typename geometry_concept<segment_type_2>::type
+ typename geometry_concept<Segment2>::type
>::type
>::type,
     bool
- >::type
- intersection(point_type& intersection,
- const segment_type& segment,
- const segment_type_2& b,
+ >::type
+ intersection(Point& intersection,
+ const Segment1& segment1,
+ const Segment2& segment2,
                bool projected = false,
                bool round_closest = false) {
     typedef polygon_arbitrary_formation<
- typename segment_coordinate_type<segment_type>::type
+ typename segment_coordinate_type<Segment1>::type
> paf;
     typename paf::Point pt;
- typename paf::Point l, h, l2, h2;
- assign(l, low(segment));
- assign(h, high(segment));
- assign(l2, low(b));
- assign(h2, high(b));
- typename paf::half_edge he1(l, h), he2(l2, h2);
+ typename paf::Point l1, h1, l2, h2;
+ assign(l1, low(segment1));
+ assign(h1, high(segment1));
+ assign(l2, low(segment2));
+ assign(h2, high(segment2));
+ typename paf::half_edge he1(l1, h1), he2(l2, h2);
     typename paf::compute_intersection_pack pack;
     if(pack.compute_intersection(pt, he1, he2, projected, round_closest)) {
       assign(intersection, pt);
@@ -739,8 +737,8 @@
   }
 
   template <class T>
- template <class T2>
- segment_data<T>& segment_data<T>::operator=(const T2& rvalue) {
+ template <class Segment>
+ segment_data<T>& segment_data<T>::operator=(const Segment& rvalue) {
     assign(*this, rvalue);
     return *this;
   }

Modified: sandbox/gtl/boost/polygon/segment_data.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/segment_data.hpp (original)
+++ sandbox/gtl/boost/polygon/segment_data.hpp 2012-04-24 19:51:09 EDT (Tue, 24 Apr 2012)
@@ -1,84 +1,106 @@
 /*
   Copyright 2008 Intel Corporation
-
+
   Use, modification and distribution are subject to 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).
 */
 #ifndef BOOST_POLYGON_SEGMENT_DATA_HPP
 #define BOOST_POLYGON_SEGMENT_DATA_HPP
+
 #include "isotropy.hpp"
 #include "point_data.hpp"
+
 namespace boost { namespace polygon{
   template <typename T>
   class segment_data {
   public:
     typedef T coordinate_type;
     typedef point_data<T> point_type;
+
     inline segment_data()
-#ifndef BOOST_POLYGON_MSVC
- :points_()
-#endif
- {}
- inline segment_data(point_type low, point_type high)
-#ifndef BOOST_POLYGON_MSVC
- :points_()
-#endif
+#ifndef BOOST_POLYGON_MSVC
+ :points_()
+#endif
+ {}
+
+ inline segment_data(const point_type& low, const point_type& high)
+#ifndef BOOST_POLYGON_MSVC
+ :points_()
+#endif
     {
- points_[LOW] = low; points_[HIGH] = high;
+ points_[LOW] = low; points_[HIGH] = high;
     }
+
     inline segment_data(const segment_data& that)
-#ifndef BOOST_POLYGON_MSVC
- :points_()
-#endif
+#ifndef BOOST_POLYGON_MSVC
+ :points_()
+#endif
     {
- (*this) = that;
+ (*this) = that;
     }
- inline segment_data& operator=(
- const segment_data& that) {
- points_[0] = that.points_[0]; points_[1] = that.points_[1];
+
+ inline segment_data& operator=(const segment_data& that) {
+ points_[0] = that.points_[0];
+ points_[1] = that.points_[1];
       return *this;
     }
- template <typename T2>
- inline segment_data& operator=(const T2& rvalue);
- inline point_type get(direction_1d dir) const {
- return points_[dir.to_int()];
+
+ template <typename Segment>
+ inline segment_data& operator=(const Segment& that);
+
+ inline const point_type& get(direction_1d dir) const {
+ return points_[dir.to_int()];
+ }
+
+ inline void set(direction_1d dir, const point_type& point) {
+ points_[dir.to_int()] = point;
     }
- inline point_type low() const { return points_[0]; }
- inline point_type low(point_type low) {
+
+ inline const point_type& low() const { return points_[0]; }
+
+ inline point_type& low(const point_type& low) {
       points_[0] = low;
       return *this;
     }
- inline point_type high() const { return points_[1]; }
- inline point_type high(point_type high) {
+
+ inline const point_type& high() const {return points_[1]; }
+
+ inline point_type& high(const point_type& high) {
         points_[1] = high;
         return *this;
     }
+
     inline bool operator==(const segment_data& that) const {
- return low() == that.low() && high() == that.high(); }
+ return low() == that.low() && high() == that.high();
+ }
+
     inline bool operator!=(const segment_data& that) const {
- return low() != that.low() || high() != that.high(); }
+ return low() != that.low() || high() != that.high();
+ }
+
     inline bool operator<(const segment_data& that) const {
- if(points_[0] < that.points_[0]) return true;
- if(points_[0] > that.points_[0]) return false;
- if(points_[1] < that.points_[1]) return true;
- return false;
+ if (points_[0] < that.points_[0])
+ return true;
+ if (points_[0] > that.points_[0])
+ return false;
+ return points_[1] < that.points_[1];
     }
+
     inline bool operator<=(const segment_data& that) const {
       return !(that < *this);
     }
+
     inline bool operator>(const segment_data& that) const {
       return that < *this;
     }
+
     inline bool operator>=(const segment_data& that) const {
       return !((*this) < that);
     }
- inline void set(direction_1d dir, point_type value) {
- points_[dir.to_int()] = value;
- }
 
   private:
- point_type points_[2];
+ point_type points_[2];
 };
 }
 }

Modified: sandbox/gtl/boost/polygon/segment_traits.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/segment_traits.hpp (original)
+++ sandbox/gtl/boost/polygon/segment_traits.hpp 2012-04-24 19:51:09 EDT (Tue, 24 Apr 2012)
@@ -1,6 +1,6 @@
 /*
   Copyright 2008 Intel Corporation
-
+
   Use, modification and distribution are subject to 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).
@@ -8,35 +8,33 @@
 #ifndef BOOST_POLYGON_SEGMENT_TRAITS_HPP
 #define BOOST_POLYGON_SEGMENT_TRAITS_HPP
 namespace boost { namespace polygon{
- template <typename T>
+ template <typename Segment>
   struct segment_traits {
- typedef typename T::coordinate_type coordinate_type;
- typedef typename T::point_type point_type;
+ typedef typename Segment::coordinate_type coordinate_type;
+ typedef typename Segment::point_type point_type;
 
- static inline point_type get(const T& segment, direction_1d dir) {
- return segment.get(dir);
+ static inline point_type get(const Segment& segment, direction_1d dir) {
+ return segment.get(dir);
     }
   };
 
- template <typename T>
+ template <typename Segment>
   struct segment_mutable_traits {
- template <typename Point1>
- static inline void set(T& segment, direction_1d dir, const Point1& value) {
- typename segment_traits<T>::point_type p1;
+ template <typename Point>
+ static inline void set(Segment& segment, direction_1d dir, const Point& value) {
+ typename segment_traits<Segment>::point_type p1;
       assign(p1, value);
- segment.set(dir, value);
+ segment.set(dir, p1);
     }
-
+
     template <typename Point1, typename Point2>
- static inline T construct(const Point1& low_value,
- const Point2& high_value) {
- typename segment_traits<T>::point_type p1, p2;
+ static inline Segment construct(const Point1& low_value, const Point2& high_value) {
+ typename segment_traits<Segment>::point_type p1, p2;
       assign(p1, low_value);
       assign(p2, high_value);
- return T(p1, p2);
+ return Segment(p1, p2);
     }
   };
 }
 }
 #endif
-


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