Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78291 - in sandbox/gtl: boost/polygon doc libs/polygon/test
From: sydorchuk.andriy_at_[hidden]
Date: 2012-05-01 07:34:08


Author: asydorchuk
Date: 2012-05-01 07:34:07 EDT (Tue, 01 May 2012)
New Revision: 78291
URL: http://svn.boost.org/trac/boost/changeset/78291

Log:
Updating tests/docs/sources for segment concept.

Text files modified:
   sandbox/gtl/boost/polygon/segment_concept.hpp | 187 +++++++++++++++++----------------------
   sandbox/gtl/doc/gtl_segment_concept.htm | 154 +++++++++++++++++---------------
   sandbox/gtl/libs/polygon/test/polygon_segment_test.cpp | 59 +++++++++--
   3 files changed, 207 insertions(+), 193 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-05-01 07:34:07 EDT (Tue, 01 May 2012)
@@ -534,7 +534,46 @@
     return segment;
   }
 
-struct y_s_e_intersects : gtl_yes {};
+ struct y_s_abuts1 : gtl_yes {};
+
+ template <typename Segment1, typename Segment2>
+ typename enable_if<
+ typename gtl_and_3<
+ y_s_abuts1,
+ typename is_segment_concept<
+ typename geometry_concept<Segment1>::type
+ >::type,
+ typename is_segment_concept<
+ typename geometry_concept<Segment2>::type
+ >::type
+ >::type,
+ bool
+ >::type
+ 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 {};
+
+ template <typename Segment1, typename Segment2>
+ typename enable_if<
+ typename gtl_and_3<
+ y_s_abuts2,
+ typename is_segment_concept<
+ typename geometry_concept<Segment1>::type
+ >::type,
+ typename is_segment_concept<
+ typename geometry_concept<Segment2>::type
+ >::type
+ >::type,
+ bool
+ >::type
+ abuts(const Segment1& segment1, const Segment2& segment2) {
+ return abuts(segment1, segment2, HIGH) || abuts(segment1, segment2, LOW);
+ }
+
+ struct y_s_e_intersects : gtl_yes {};
 
   template <typename Segment1, typename Segment2>
   typename enable_if<
@@ -568,6 +607,48 @@
                            typename paf::half_edge(l2, h2));
   }
 
+ struct y_s_intersect : gtl_yes {};
+
+ // Set point to the intersection of segment and b
+ 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 is_segment_concept<
+ typename geometry_concept<Segment1>::type
+ >::type,
+ typename is_segment_concept<
+ typename geometry_concept<Segment2>::type
+ >::type
+ >::type,
+ bool
+ >::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<Segment1>::type
+ > paf;
+ typename paf::Point pt;
+ 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);
+ return true;
+ }
+ return false;
+ }
+
   struct y_s_e_dist : gtl_yes {};
 
   template <typename Segment, typename Point>
@@ -638,110 +719,6 @@
     return (subres1 < subres2) ? subres1 : subres2;
   }
 
- struct y_s_abuts1 : gtl_yes {};
-
- template <typename Segment1, typename Segment2>
- typename enable_if<
- typename gtl_and_3<
- y_s_abuts1,
- typename is_segment_concept<
- typename geometry_concept<Segment1>::type
- >::type,
- typename is_segment_concept<
- typename geometry_concept<Segment2>::type
- >::type
- >::type,
- bool
- >::type
- 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 {};
-
- template <typename Segment1, typename Segment2>
- typename enable_if<
- typename gtl_and_3<
- y_s_abuts2,
- typename is_segment_concept<
- typename geometry_concept<Segment1>::type
- >::type,
- typename is_segment_concept<
- typename geometry_concept<Segment2>::type
- >::type
- >::type,
- bool
- >::type
- abuts(const Segment1& segment1, const Segment2& segment2) {
- return abuts(segment1, segment2, HIGH) || abuts(segment1, segment2, LOW);
- }
-
- struct y_s_e_bintersect : gtl_yes {};
-
- template <typename Segment1, typename Segment2>
- typename enable_if<
- typename gtl_and_3<
- y_s_e_bintersect,
- typename is_segment_concept<
- typename geometry_concept<Segment1>::type
- >::type,
- typename is_segment_concept<
- typename geometry_concept<Segment2>::type
- >::type
- >::type,
- bool
- >::type
- boundaries_intersect(const Segment1& segment1, const Segment2& segment2,
- bool consider_touch = true) {
- 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_intersect : gtl_yes {};
-
- // Set point to the intersection of segment and b
- 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 is_segment_concept<
- typename geometry_concept<Segment1>::type
- >::type,
- typename is_segment_concept<
- typename geometry_concept<Segment2>::type
- >::type
- >::type,
- bool
- >::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<Segment1>::type
- > paf;
- typename paf::Point pt;
- 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);
- return true;
- }
- return false;
- }
-
   template <class T>
   template <class Segment>
   segment_data<T>& segment_data<T>::operator=(const Segment& rvalue) {

Modified: sandbox/gtl/doc/gtl_segment_concept.htm
==============================================================================
--- sandbox/gtl/doc/gtl_segment_concept.htm (original)
+++ sandbox/gtl/doc/gtl_segment_concept.htm 2012-05-01 07:34:07 EDT (Tue, 01 May 2012)
@@ -1,5 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en"><head><!--
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en"><head>
+<!--
     Copyright 2009-2010 Intel Corporation
     license banner
 --><title>Boost Polygon Library: Segment Concept</title>
@@ -9,6 +10,8 @@
 
 
 
+
+
   
 
   
@@ -88,7 +91,7 @@
       <h1>Segment Concept</h1>
       <p> </p>
       <p> The segment concept tag is <font face="Courier New">segment_concept</font></p>
- <p> To register a user defined type as a model of segment
+ <p> To register a user defined type as a model of the segment
 concept, specialize the geometry concept meta-function for that
 type.&nbsp; In the example below CSegment is registered as a model of
 the segment concept.</p>
@@ -96,10 +99,9 @@
 struct geometry_concept&lt;</font>CSegment<font face="Courier New">&gt;
 { typedef segment_concept type; };</font></p>
       <p> The semantic of a segment is
-that it has an low and high point.&nbsp; A
-std::pair&lt;std::pair&lt;int, int&gt;, std::pair&lt;int,int&gt;&gt;,
-boost::tuple&lt;boost::tuple&lt;int, int&gt;, boost::tuple&lt;int,
-int&gt;&gt; or boost::array&lt;int, 4&gt; could all be made models of
+that it has a low and high point.&nbsp; A
+std::pair&lt;Point, Point&gt;,
+boost::tuple&lt;Point, Point&gt; or boost::array&lt;Point, 2&gt; could all be made models of
 segment by simply providing indirect access to their elements through
 traits, however, these objects cannot be made a model of both segment
 and interval in the same compilation unit, for obvious reason that
@@ -107,9 +109,10 @@
 also because it would make overloading generic function by concept
 ambiguous if a type modeled more than one concept.</p>
       <p> Below is shown the default
-segment traits.&nbsp; Specialization of these traits is required for
+segment traits. Specialization of these traits is required for
 types that don't conform to the default behavior.</p>
       
+
       <p><span style="font-family: Courier New,Courier,monospace;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
       <span style="font-family: Courier New,Courier,monospace;">struct segment_traits {</span><br style="font-family: Courier New,Courier,monospace;" />
       <span style="font-family: Courier New,Courier,monospace;">&nbsp; typedef typename Segment::coordinate_type coordinate_type;</span><br style="font-family: Courier New,Courier,monospace;" />
@@ -120,8 +123,8 @@
       <span style="font-family: Courier New,Courier,monospace;">&nbsp; }</span><br style="font-family: Courier New,Courier,monospace;" />
       <span style="font-family: Courier New,Courier,monospace;">};</span><br />
       <br /><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment&gt;<br />
-struct segment_mutable_traits {</span></span></p>
- <p><span style="font-family: Courier New,Courier,monospace;"><span style="font-family: Courier New,Courier,monospace;">&nbsp; typedef typename segment_traits&lt;Segment&gt;::point_type point_type;<br />
+struct segment_mutable_traits {<br />
+&nbsp; typedef typename segment_traits&lt;Segment&gt;::point_type point_type;<br />
 <br />
 &nbsp; static inline void set(Segment&amp; segment, direction_1d dir, const point_type&amp; point) {<br />
 &nbsp;&nbsp;&nbsp; segment.set(dir, p);<br />
@@ -151,24 +154,24 @@
 void <b>set</b>(</font><font face="Courier New">Segment</font><font face="Courier New">&amp; segment, direction_1d dir,<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const Point&amp; </font><span style="font-family: Courier New;">point</span><font face="Courier New">)</font></td>
             <td>Sets the low or high endpoint of an object that models a segment to an object that models a
-point, depending on the direction_1d&nbsp; value.</td>
+point, depending on the direction_1d value.</td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New">template &lt;typename Segment, typename Point1, typename Point2&gt;<br />
 Segment<b> construct</b>(const Point1&amp; low, const Point2&amp; high)</font></td>
- <td>Construct an object that is a model of segment given the two objects that are models of point.</td>
+ <td>Constructs an object that is a model of segment given the two objects that are models of point.</td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><font face="Courier New">template &lt;typename Segment1, typename </font><font face="Courier New">Segment2</font><font face="Courier New">&gt;<br /></font><font face="Courier New">Segment1</font><font face="Courier New"> <span style="font-weight: bold;">copy_construct</span>(const </font><font face="Courier New">Segment2</font><font face="Courier New">&amp; segment)</font></td>
- <td style="vertical-align: middle; text-align: left;">Copy construct an object that is a model of segment given another segment.</td>
+ <td><font face="Courier New">template &lt;typename Segment1, typename </font><font face="Courier New">Segment2</font><font face="Courier New">&gt;<br /></font><font face="Courier New">Segment1</font><font face="Courier New"> <span style="font-weight: bold;">copy_construct</span>(const </font><font face="Courier New">Segment2</font><font face="Courier New">&amp; segment)</font></td>
+ <td style="text-align: left;">Copy constructs an object that is a model of segment given another segment.</td>
           </tr>
 <tr>
             <td width="586"><font face="Courier New">template
 &lt;typename </font><font face="Courier New">Segment1</font><font face="Courier New">, typename </font><font face="Courier New">Segment2&gt;</font><br />
             <font face="Courier New">Segment1</font><font face="Courier New">&amp; <b>assign</b>(</font><font face="Courier New">Segment1</font><font face="Courier New">&amp; segment1,<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">Segment2</font><font face="Courier New">&amp; segment2)</font></td>
- <td>Copies data from the right object that models segment into
-the left object that models segment.</td>
+ <td>Copies data from the second object that models a segment into
+the first object that models a segment.</td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New">template
@@ -176,20 +179,21 @@
 bool <b>equivalence</b>(const </font><font face="Courier New">Segment1</font><font face="Courier New">&amp; segment1,<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">Segment1</font><font face="Courier New">&amp; segment2)</font></td>
             <td>Given two objects that model a segment, compares and
-returns true if their low and high values are respectively equal to each
-other.</td>
+returns true if their low and high values are respectively equal.</td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment, typename Point&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
- <span style="font-family: Courier New,Courier,monospace;">bool </span><span style="font-weight: bold; font-family: Courier New,Courier,monospace;">on_above_or_below</span><span style="font-family: Courier New,Courier,monospace;">(const </span><span style="font-family: Courier New,Courier,monospace;">Segment</span><span style="font-family: Courier New,Courier,monospace;">&amp; segment,</span><br style="font-family: Courier New,Courier,monospace;" />
- <span style="font-family: Courier New,Courier,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <td><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment, typename Point&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
+ <span style="font-family: Courier New,Courier,monospace;">int </span><span style="font-weight: bold; font-family: Courier New,Courier,monospace;">on_above_or_below</span><span style="font-family: Courier New,Courier,monospace;">(const </span><span style="font-family: Courier New,Courier,monospace;">Segment</span><span style="font-family: Courier New,Courier,monospace;">&amp; segment,</span><br style="font-family: Courier New,Courier,monospace;" />
+ <span style="font-family: Courier New,Courier,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 const Point&amp; point)</span><br />
             </td>
- <td>Returns false if an object that is a model of segment and an object that is a model of point are collinear, else true.<br />
+ <td>Returns 0 if an object that is a model of segment and an object that is a model of point are collinear.<br />
+Returns 1 if the point object lies to the left of the segment object.<br />
+Returns -1 if the point object lies to the right of the segment object.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename </span><font face="Courier New">Segment, typename Point</font><span style="font-family: Courier New,Courier,monospace;">&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
+ <td><span style="font-family: Courier New,Courier,monospace;">template &lt;typename </span><font face="Courier New">Segment, typename Point</font><span style="font-family: Courier New,Courier,monospace;">&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
             <span style="font-family: Courier New,Courier,monospace;">bool </span><span style="font-weight: bold; font-family: Courier New,Courier,monospace;">contains</span><span style="font-family: Courier New,Courier,monospace;">(const </span><font face="Courier New">Segment</font><span style="font-family: Courier New,Courier,monospace;">&amp; segment,</span><br style="font-family: Courier New,Courier,monospace;" />
             <span style="font-family: Courier New,Courier,monospace;">&nbsp;&nbsp;&nbsp; const Point&amp; value,</span><span style="font-family: Courier New,Courier,monospace;"> bool consider_touch)</span><br />
             </td>
@@ -197,46 +201,46 @@
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
+ <td><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
 
             <span style="font-family: Courier New,Courier,monospace;">bool </span><span style="font-weight: bold; font-family: Courier New,Courier,monospace;">contains</span><span style="font-family: Courier New,Courier,monospace;">(const </span><span style="font-family: Courier New,Courier,monospace;">Segment1</span><span style="font-family: Courier New,Courier,monospace;">&amp; segment1,</span><br style="font-family: Courier New,Courier,monospace;" />
 
             <span style="font-family: Courier New,Courier,monospace;">&nbsp;&nbsp;&nbsp; const </span><span style="font-family: Courier New,Courier,monospace;">Segment</span><span style="font-family: Courier New,Courier,monospace;">2&amp; segment2,</span> <span style="font-family: Courier New,Courier,monospace;">bool consider_touch)</span></td>
- <td>Returns true if the first of the objects contains the second one, else false. Both objects represent a model of segment.<br />
+ <td>Returns true if the first object contains the second one, else false. Both objects model a segment.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>&gt;<br />
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>&gt;<br />
 point_type <span style="font-weight: bold;">low</span>(const <span style="font-family: Courier New,Courier,monospace;">Segment</span>&amp; segment)<br />
             </td>
             <td>Returns the low endpoint of an object that is a model of segment.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>&gt;<br />
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>&gt;<br />
 point_type <span style="font-weight: bold;">high</span>(const <span style="font-family: Courier New,Courier,monospace;">Segment</span>&amp; segment)</td>
             <td>Returns the high endpoint of an object that is a model of segment.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>&gt;<br />
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>&gt;<br />
 point_type <span style="font-weight: bold;">center</span>(const <span style="font-family: Courier New,Courier,monospace;">Segment</span>&amp; segment)</td>
             <td>Returns the central point of an object that is a model of segment.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>, typename Point&gt;<br />void <span style="font-weight: bold;">low</span>(<span style="font-family: Courier New,Courier,monospace;">Segment</span>&amp; segment, const Point&amp; point)</td>
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment</span>, typename Point&gt;<br />void <span style="font-weight: bold;">low</span>(<span style="font-family: Courier New,Courier,monospace;">Segment</span>&amp; segment, const Point&amp; point)</td>
             <td>Sets the low endpoint of an object that is a model of segment.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment, typename Point</span>&gt;<br />
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename <span style="font-family: Courier New,Courier,monospace;">Segment, typename Point</span>&gt;<br />
 void <span style="font-weight: bold;">high</span>(<span style="font-family: Courier New,Courier,monospace;">Segment</span>&amp; segment, const Point&amp; point)</td>
             <td>Sets the high endpoint of an object that is a model of segment.<br />
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename </span><span style="font-family: Courier New,Courier,monospace;">Segment</span><span style="font-family: Courier New,Courier,monospace;">&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
+ <td><span style="font-family: Courier New,Courier,monospace;">template &lt;typename </span><span style="font-family: Courier New,Courier,monospace;">Segment</span><span style="font-family: Courier New,Courier,monospace;">&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
             <span style="font-family: Courier New,Courier,monospace;">distance_type <span style="font-weight: bold;">length</span>(const </span><span style="font-family: Courier New,Courier,monospace;">Segment</span><span style="font-family: Courier New,Courier,monospace;">&amp; segment)</span><br />
             </td>
             <td>Returns length of an object that is a model of segment.<br />
@@ -278,7 +282,7 @@
 &lt;typename </font><span style="font-family: Courier New,Courier,monospace;">Segment</span><font face="Courier New">&gt;<br />
             </font><span style="font-family: Courier New,Courier,monospace;">Segment</span><font face="Courier New">&amp; <b>move</b>(</font><span style="font-family: Courier New,Courier,monospace;">Segment</span><font face="Courier New">&amp; segment, orientation_2d<br />
 &nbsp;&nbsp;&nbsp; coordinate_difference displacement)</font></td>
- <td>Adds displacement value to the coordinates of both endpoints of an object
+ <td>Adds displacement value to the x or y coordinates of both endpoints of an object
 that is a model of segment indicated by the orientation_2d.</td>
           </tr>
           <tr>
@@ -295,61 +299,63 @@
             <td>Deconvolves both endpoints of an object that models a segment with an object that models a point. </td>
           </tr>
           <tr>
- <td width="586"><font face="Courier New">template
-&lt;typename </font><span style="font-family: Courier New,Courier,monospace;">Segment, typename Point</span><font face="Courier New">&gt;<br />distance_type <b>euclidean_distance</b>(<br />
-&nbsp;&nbsp;&nbsp; const </font><span style="font-family: Courier New,Courier,monospace;">Segment</span><font face="Courier New">&amp; segment, const Point&amp; point)</font></td>
- <td>Returns distance from an object that is a model of segment
-to an object that is a model of point.</td>
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;<br />
+
+
+bool <span style="font-weight: bold;">abuts</span>(const Segment1&amp; segment1,<br />
+
+
+&nbsp;&nbsp;&nbsp; const Segment2&amp; segment2, direction_1d dir)</td>
+ <td>Returns true if two objects that model a segment abut, depending on the direction_1d value.</td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><font face="Courier New">template
-&lt;typename Segment1, typename </font><font face="Courier New">Segment2</font><font face="Courier New">&gt;<br />distance_type <b>euclidean_distance</b>(<br />
-&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">Segment1</font><font face="Courier New">&amp; segment1, const </font><font face="Courier New">Segment2</font><font face="Courier New">&amp; segment2)</font></td>
- <td style="vertical-align: middle;">Returns distance between two objects that are models of segment.</td>
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;<br />
+
+bool <span style="font-weight: bold;">abuts</span>(const Segment1&amp; segment1,<br />
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const Segment2&amp; segment2)</td>
+ <td>Returns true if two objects that model a segment abut: either the first one to the second one or vice versa.</td>
           </tr>
+
+
           <tr>
- <td style="vertical-align: top;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
+ <td><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
             <span style="font-family: Courier New,Courier,monospace;">bool <span style="font-weight: bold;">intersects</span>(const Segment1&amp; segment1,</span><br style="font-family: Courier New,Courier,monospace;" />
- <span style="font-family: Courier New,Courier,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const Segment2&amp; segment2)</span><br />
+ <span style="font-family: Courier New,Courier,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const Segment2&amp; segment2,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool consider_touch)</span><br />
             </td>
             <td>Returns true if two objects that model a segment intersect, else false.<br />
             </td>
           </tr>
+
           <tr>
- <td style="vertical-align: top;"><span style="font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
+ <td style="font-family: Courier New,Courier,monospace;">template &lt;typename Point, typename Segment1, typename Segment2&gt;<br />
 
- <span style="font-family: Courier New,Courier,monospace;">bool <span style="font-weight: bold;">boundaries_intersect</span>(<br />
-&nbsp;&nbsp;&nbsp; const Segment1&amp; segment1,</span><span style="font-family: Courier New,Courier,monospace;"> const Segment2&amp; segment2)</span>
- </td>
- <td>Returns true if two objects that model a segment are collinear and overlap, else false.<br />
- </td>
- </tr>
- <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;<br />
+bool <span style="font-weight: bold;">intersection</span>(Point&amp; point,<br />
 
-bool <span style="font-weight: bold;">abuts</span>(const Segment1&amp; segment1,<br />
+&nbsp;&nbsp;&nbsp; const Segment1&amp; segment1, const Segment2&amp; segment2,<br />
 
-&nbsp;&nbsp;&nbsp; const Segment2&amp; segment2, direction_1d dir)</td>
- <td>Returns true if two objects that model a segment abut, depending on the direction_1d value.<br />
+&nbsp;&nbsp;&nbsp; bool projected = false, bool round_closest = false)</td>
+ <td>Returns
+true and computes the intersection point of the two objects that model
+a segment in case those intersect, else returns false.
             </td>
           </tr>
 <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename Segment1, typename Segment2&gt;<br />
-bool <span style="font-weight: bold;">abuts</span>(const Segment1&amp; segment1,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const Segment2&amp; segment2)<br />
+ <td style="font-family: Courier New,Courier,monospace;"><font face="Courier New">template
+&lt;typename </font><span style="font-family: Courier New,Courier,monospace;">Segment, typename Point</span><font face="Courier New">&gt;<br />distance_type <b>euclidean_distance</b>(<br />
+&nbsp;&nbsp;&nbsp; const </font><span style="font-family: Courier New,Courier,monospace;">Segment</span><font face="Courier New">&amp; segment, const Point&amp; point)</font>
             </td>
- <td>Returns true if two objects that model a segment abut: either the first one to the second one or vice versa.<br />
+ <td>Returns distance from an object that is a model of segment
+to an object that is a model of point.
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename Point, typename Segment1, typename Segment2&gt;<br />
-bool <span style="font-weight: bold;">intersection</span>(Point&amp; point,<br />
-&nbsp;&nbsp;&nbsp; const Segment1&amp; segment1, const Segment2&amp; segment2,<br />
-&nbsp;&nbsp;&nbsp; bool projected = false, bool round_closest = false)<br />
+ <td style="font-family: Courier New,Courier,monospace;"><font face="Courier New">template
+&lt;typename Segment1, typename </font><font face="Courier New">Segment2</font><font face="Courier New">&gt;<br />distance_type <b>euclidean_distance</b>(<br />
+&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">Segment1</font><font face="Courier New">&amp; segment1, const </font><font face="Courier New">Segment2</font><font face="Courier New">&amp; segment2)</font>
             </td>
- <td>Returns
-true and computes the intersection point of the two objects that model
-a segment. If those don't intersect returns false.<br />
+ <td>Returns distance between two objects that are models of segment.
             </td>
           </tr>
           
@@ -367,9 +373,9 @@
 library segment data type instead of providing their own.&nbsp; The data
 type is implemented to be convenient to use with the library traits.</p>
       <p>Example code segment_usage.cpp
-demonstrates using the library provided segment data type and functions</p>
+demonstrates using the library provided segment data type and functions.</p>
       <h2>Members</h2>
- <table id="table2" border="1" width="100%">
+ <table style="width: 100%;" id="table2" border="1">
         <tbody>
           <tr>
             <td width="586"><b><font face="Courier New">geometry_type</font></b></td>
@@ -380,8 +386,8 @@
             <td>T</td>
           </tr>
           <tr>
- <td style="vertical-align: top;"><b><font face="Courier New">point_type</font></b></td>
- <td style="vertical-align: top;">point_data&lt;T&gt;<br />
+ <td><b><font face="Courier New">point_type</font></b></td>
+ <td>point_data&lt;T&gt;<br />
             </td>
           </tr>
 <tr>
@@ -417,27 +423,27 @@
           </tr>
           <tr>
             <td width="586"><font face="Courier New"><b> </b>bool<b> operator&lt;</b>(const segment_data&amp; that) const</font></td>
- <td>Less operator overload. Compares low endpoint then high endpoint to break ties.<br />
+ <td>Less operator overload. Compares low endpoints then high endpoints to break ties.<br />
 </td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New"><b> </b>bool<b> operator&lt;=</b>(const segment_data&amp; that) const</font></td>
- <td>Less or equal operator overload. Compares low endpoint then high endpoint to break ties.<br />
+ <td>Less or equal operator overload. Compares low endpoints then high endpoints to break ties.<br />
 </td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New"><b> </b>bool<b> operator&gt;</b>(const segment_data&amp; that) const</font></td>
- <td>Greater operator overload. Compares low endpoint then high endpoint to break ties.<br />
+ <td>Greater operator overload. Compares low endpoints then high endpoints to break ties.<br />
 </td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New"><b> </b>bool<b> operator&gt;=</b>(const segment_data&amp; that) const</font></td>
- <td>Greater or equal operator overload. Compares low endpoint then high endpoint to break ties.<br />
+ <td>Greater or equal operator overload. Compares low endpoints then high endpoints to break ties.<br />
 </td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New">point_type <b>get</b>(direction_1d dir) const</font></td>
- <td>Retrieves the low/high endpoint considering direction.</td>
+ <td>Retrieves the low/high endpoint considering direction value.</td>
           </tr>
           <tr>
             <td width="586"><font face="Courier New">point_type <span style="font-weight: bold;">low</span>() const</font></td>

Modified: sandbox/gtl/libs/polygon/test/polygon_segment_test.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/test/polygon_segment_test.cpp (original)
+++ sandbox/gtl/libs/polygon/test/polygon_segment_test.cpp 2012-05-01 07:34:07 EDT (Tue, 01 May 2012)
@@ -47,7 +47,6 @@
   BOOST_CHECK(segment1 == segment2);
 }
 
-
 BOOST_AUTO_TEST_CASE_TEMPLATE(segment_traits_test, T, test_types) {
   typedef point_data<T> point_type ;
   typedef segment_data<T> segment_type;
@@ -294,6 +293,46 @@
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
+ segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(1, 2));
+ segment_type segment2 = construct<segment_type>(point_type(1, 2), point_type(2, 4));
+ segment_type segment3 = construct<segment_type>(point_type(2, 4), point_type(0, 4));
+ segment_type segment4 = construct<segment_type>(point_type(0, 4), point_type(0, 0));
+
+ BOOST_CHECK(abuts(segment1, segment2, HIGH));
+ BOOST_CHECK(abuts(segment2, segment3, HIGH));
+ BOOST_CHECK(abuts(segment3, segment4, HIGH));
+ BOOST_CHECK(abuts(segment4, segment1, HIGH));
+
+ BOOST_CHECK(!abuts(segment1, segment2, LOW));
+ BOOST_CHECK(!abuts(segment2, segment3, LOW));
+ BOOST_CHECK(!abuts(segment3, segment4, LOW));
+ BOOST_CHECK(!abuts(segment4, segment1, LOW));
+
+ BOOST_CHECK(abuts(segment2, segment1));
+ BOOST_CHECK(abuts(segment3, segment2));
+ BOOST_CHECK(abuts(segment4, segment3));
+ BOOST_CHECK(abuts(segment1, segment4));
+
+ BOOST_CHECK(!abuts(segment1, segment3));
+ BOOST_CHECK(!abuts(segment2, segment4));
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test8, T, test_types) {
+ typedef point_data<T> point_type;
+ typedef Segment<T> segment_type;
+
+ point_type point;
+ segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(2, 2));
+ segment_type segment2 = construct<segment_type>(point_type(1, 1), point_type(3, 3));
+
+ BOOST_CHECK(!intersection(point, segment1, segment2));
+ BOOST_CHECK(intersects(segment1, segment2));
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test9, T, test_types) {
+ typedef point_data<T> point_type;
+ typedef Segment<T> segment_type;
+
   point_type point1(1, 2);
   point_type point2(7, 10);
   segment_type segment1 = construct<segment_type>(point1, point2);
@@ -306,7 +345,7 @@
   BOOST_CHECK(euclidean_distance(segment1, point_type(8, 3)) == 5.0);
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test8, T, test_types) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test10, T, test_types) {
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
@@ -314,6 +353,8 @@
   segment_type segment2 = construct<segment_type>(point_type(2, 0), point_type(0, 2));
   segment_type segment3 = construct<segment_type>(point_type(1, -7), point_type(10, 5));
   segment_type segment4 = construct<segment_type>(point_type(7, 7), point_type(10, 11));
+ segment_type segment5 = construct<segment_type>(point_type(1, 1), point_type(-1, 3));
+ segment_type segment6 = construct<segment_type>(point_type(0, 0), point_type(1, 1));
 
   BOOST_CHECK(intersects(segment1, segment2, false));
   BOOST_CHECK(euclidean_distance(segment1, segment2) == 0.0);
@@ -321,16 +362,6 @@
   BOOST_CHECK(euclidean_distance(segment1, segment3) == 5.0);
   BOOST_CHECK(!intersects(segment1, segment4, true));
   BOOST_CHECK(euclidean_distance(segment1, segment4) == 5.0);
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test9, T, test_types) {
- typedef point_data<T> point_type;
- typedef Segment<T> segment_type;
-
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test10, T, test_types) {
- typedef point_data<T> point_type;
- typedef Segment<T> segment_type;
-
+ BOOST_CHECK(intersects(segment2, segment5, false));
+ BOOST_CHECK(intersects(segment2, segment6, false));
 }


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