$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r80538 - in trunk: boost/polygon libs/polygon/doc libs/polygon/test
From: sydorchuk.andriy_at_[hidden]
Date: 2012-09-16 07:10:50
Author: asydorchuk
Date: 2012-09-16 07:10:49 EDT (Sun, 16 Sep 2012)
New Revision: 80538
URL: http://svn.boost.org/trac/boost/changeset/80538
Log:
Polygon: Final style fixes & layout fixes before merging with release branch.
Text files modified: 
   trunk/boost/polygon/segment_utils.hpp           |    32 ++++++++++++------------                
   trunk/libs/polygon/doc/gtl_segment_concept.htm  |    50 +++++++++++++++++++++------------------ 
   trunk/libs/polygon/test/gtl_boost_unit_test.cpp |     8 +++---                                  
   3 files changed, 47 insertions(+), 43 deletions(-)
Modified: trunk/boost/polygon/segment_utils.hpp
==============================================================================
--- trunk/boost/polygon/segment_utils.hpp	(original)
+++ trunk/boost/polygon/segment_utils.hpp	2012-09-16 07:10:49 EDT (Sun, 16 Sep 2012)
@@ -16,7 +16,7 @@
 namespace boost {
 namespace polygon {
 
-template <typename SegmentIterator, typename Segment>
+template <typename Segment, typename SegmentIterator>
 typename enable_if<
   typename gtl_and<
     typename gtl_if<
@@ -35,8 +35,8 @@
   void
 >::type
 intersect_segments(
-    SegmentIterator first, SegmentIterator last,
-    std::vector<std::pair<std::size_t, Segment> >* result) {
+    std::vector<std::pair<std::size_t, Segment> >& result,
+    SegmentIterator first, SegmentIterator last) {
   typedef typename segment_traits<Segment>::coordinate_type Unit;
   typedef typename scanline_base<Unit>::Point Point;
   typedef typename scanline_base<Unit>::half_edge half_edge;
@@ -58,16 +58,16 @@
         half_edges_out, half_edges.begin(), half_edges.end());
   }
 
-  result->reserve(result->size() + half_edges_out.size());
+  result.reserve(result.size() + half_edges_out.size());
   for (std::size_t i = 0; i < half_edges_out.size(); ++i) {
     std::size_t id = (std::size_t)(half_edges_out[i].second);
     Point l = half_edges_out[i].first.first;
     Point h = half_edges_out[i].first.second;
-    result->push_back(std::make_pair(id, construct<Segment>(l, h)));
+    result.push_back(std::make_pair(id, construct<Segment>(l, h)));
   }
 }
 
-template <typename SegmentIterator, typename SegmentContainer>
+template <typename SegmentContainer, typename SegmentIterator>
 typename enable_if<
   typename gtl_and<
     typename gtl_if<
@@ -88,9 +88,9 @@
   void
 >::type
 intersect_segments(
+    SegmentContainer& result,
     SegmentIterator first,
-    SegmentIterator last,
-    SegmentContainer* result) {
+    SegmentIterator last) {
   typedef typename SegmentContainer::value_type segment_type;
   typedef typename segment_traits<segment_type>::coordinate_type Unit;
   typedef typename scanline_base<Unit>::Point Point;
@@ -113,15 +113,15 @@
         half_edges_out, half_edges.begin(), half_edges.end());
   }
 
-  result->reserve(result->size() + half_edges_out.size());
+  result.reserve(result.size() + half_edges_out.size());
   for (std::size_t i = 0; i < half_edges_out.size(); ++i) {
     Point l = half_edges_out[i].first.first;
     Point h = half_edges_out[i].first.second;
-    result->push_back(construct<segment_type>(l, h));
+    result.push_back(construct<segment_type>(l, h));
   }
 }
 
-template <typename SegmentIterator, typename Rectangle>
+template <typename Rectangle, typename SegmentIterator>
 typename enable_if<
   typename gtl_and<
     typename gtl_if<
@@ -140,15 +140,15 @@
   bool
 >::type
 envelope_segments(
+    Rectangle& rect,
     SegmentIterator first,
-    SegmentIterator last,
-    Rectangle* rect) {
+    SegmentIterator last) {
   for (SegmentIterator it = first; it != last; ++it) {
     if (it == first) {
-      set_points(*rect, low(*it), high(*it));
+      set_points(rect, low(*it), high(*it));
     } else {
-      encompass(*rect, low(*it));
-      encompass(*rect, high(*it));
+      encompass(rect, low(*it));
+      encompass(rect, high(*it));
     }
   }
   return first != last;
Modified: trunk/libs/polygon/doc/gtl_segment_concept.htm
==============================================================================
--- trunk/libs/polygon/doc/gtl_segment_concept.htm	(original)
+++ trunk/libs/polygon/doc/gtl_segment_concept.htm	2012-09-16 07:10:49 EDT (Sun, 16 Sep 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>
@@ -484,12 +485,13 @@
 
           <tr>
             <td width="586"><font face="Courier New">template
-<typename SegmentIterator,<br />
-          typename SegmentContainer><b><br />
+<</font><font face="Courier New">typename SegmentContainer</font><font face="Courier New">,</font><font face="Courier New"><br />
+          typename SegmentIterator</font><font face="Courier New">><b><br />
             </b>void <b>intersect_segments</b>(<br />
+    </font><font face="Courier New">SegmentContainer* result,</font><br />
+            <font face="Courier New">
     SegmentIterator first,<br />
-    SegmentIterator last,<br />
-    SegmentContainer* result)
+    SegmentIterator last)
             </font></td>
             <td>Accumulates
 the result of splitting the segments in the iterator range at their
@@ -502,30 +504,32 @@
           </tr>
           <tr>
             <td width="586"><font face="Courier New">template
-<typename SegmentIterator,<br />
-          typename Segment><b><br />
+<</font><font face="Courier New">typename Segment,</font><font face="Courier New"><br />
+          </font><font face="Courier New">typename SegmentIterator</font><font face="Courier New">><b><br />
             </b>void <b>intersect_segments</b>(<br />
+    </font><font face="Courier New">vector<pair<size_t, Segment>* result,</font><br />
+            <font face="Courier New">
     SegmentIterator first,<br />
-    SegmentIterator last,<br />
-    vector<pair<size_t, Segment>* result)</font></td>
-            <td>Accumulates the result of splitting the segments in the
-              iterator range at their intersection points into the result container.
-              Preconditions: segment type used by all the input structures should model segment concept. Postconditions: no segments intersect except at their end
-              points. The index of the input segment is paired with each
-              resultant segment
-              that was split to produce it to associate the result segments with
-              the inputs segments.
-              Expected n log n runtime, worst case quadratic runtime wrt. vertices + intersections.
-            </td>
+    SegmentIterator last)</font></td>
+            <td>Accumulates
+the result of splitting the segments in the iterator range at their
+intersection points into the result container. Preconditions: segment
+type used by all the input structures should model segment concept.
+Postconditions: no segments intersect except at their end points. The
+index of the input segment is paired with each resultant segment that
+was split to produce it to associate the result segments with the
+inputs segments. Expected n log n runtime, worst case quadratic runtime
+wrt. vertices + intersections. </td>
           </tr>
           
           <tr>
             <td width="586"><font face="Courier New">template
-<typename </font><font face="Courier New">SegmentIterator</font><font face="Courier New">, <br />
-          typename Rectangle><b><br />
-            </b>void <span style="font-weight: bold;">envelope_segments</span><b></b>(<br />
-    </font><font face="Courier New">SegmentIterator first,<br />    SegmentIterator last,<br />
-    Rectangle* rect</font><font face="Courier New">)
+<</font><font face="Courier New">typename Rectangle,<br />
+          </font><font face="Courier New">typename </font><font face="Courier New">SegmentIterator</font><font face="Courier New">><b><br />
+            </b>void <span style="font-weight: bold;">envelope_segments</span>(<br />
+    </font><font face="Courier New">Rectangle* rect,</font><br />
+            <font face="Courier New">
+    </font><font face="Courier New">SegmentIterator first,<br />    SegmentIterator last</font><font face="Courier New">)
             </font></td>
             <td>Computes
 the bounding rectangle of the iterator range of line segments.
Modified: trunk/libs/polygon/test/gtl_boost_unit_test.cpp
==============================================================================
--- trunk/libs/polygon/test/gtl_boost_unit_test.cpp	(original)
+++ trunk/libs/polygon/test/gtl_boost_unit_test.cpp	2012-09-16 07:10:49 EDT (Sun, 16 Sep 2012)
@@ -3684,9 +3684,9 @@
     dlss.push_back(dls3);
     dlss.push_back(dls4);
     rectangle_data<int> rect;
-    envelope_segments(dlss.begin(), dlss.end(), &rect);
+    envelope_segments(rect, dlss.begin(), dlss.end());
     assert_s(area(rect) == 400.0, "envelope");
-    intersect_segments(dlss.begin(), dlss.end(), &result);
+    intersect_segments(result, dlss.begin(), dlss.end());
     dlss.swap(result);
     for (Dlss::iterator itr = dlss.begin(); itr != dlss.end(); ++itr) {
       std::cout << *itr << std::endl;
@@ -3696,7 +3696,7 @@
     dlss.push_back(dls5);
     std::cout << std::endl;
     result.clear();
-    intersect_segments(dlss.begin(), dlss.end(), &result);
+    intersect_segments(result, dlss.begin(), dlss.end());
     dlss.swap(result);
     for (Dlss::iterator itr = dlss.begin(); itr != dlss.end(); ++itr) {
       std::cout << *itr << std::endl;
@@ -3711,7 +3711,7 @@
     sarray[0] = segment_data<int>(point_data<int>(0,0), point_data<int>(10,10));
     sarray[1] = segment_data<int>(point_data<int>(10,0), point_data<int>(0,10));
     std::iterator_traits<segment_data<int>*>::value_type s = sarray[0];
-    intersect_segments(sarray, sarray+2, &segs);
+    intersect_segments(segs, sarray, sarray+2);
     std::cout << segs.size() << std::endl;
     assert_s(segs.size() == 4, "intersection3");
   }