Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77942 - in sandbox/gtl: boost/polygon libs/polygon/benchmark libs/polygon/example
From: sydorchuk.andriy_at_[hidden]
Date: 2012-04-12 19:05:45


Author: asydorchuk
Date: 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
New Revision: 77942
URL: http://svn.boost.org/trac/boost/changeset/77942

Log:
Fixing concept overloaded methods.

Text files modified:
   sandbox/gtl/boost/polygon/voronoi.hpp | 4 ++--
   sandbox/gtl/boost/polygon/voronoi_builder.hpp | 20 ++++++--------------
   sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_points.cpp | 6 +++---
   sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_segments.cpp | 8 ++++----
   sandbox/gtl/libs/polygon/example/voronoi_advanced_tutorial.cpp | 2 +-
   sandbox/gtl/libs/polygon/example/voronoi_basic_tutorial.cpp | 4 ++--
   sandbox/gtl/libs/polygon/example/voronoi_visualizer.cpp | 4 ++--
   7 files changed, 20 insertions(+), 28 deletions(-)

Modified: sandbox/gtl/boost/polygon/voronoi.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/voronoi.hpp (original)
+++ sandbox/gtl/boost/polygon/voronoi.hpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -47,8 +47,8 @@
 static inline void construct_voronoi(const PC &points, const SC &segments, VD *output,
     typename enable_if<typename gtl_if<typename is_point_concept<typename geometry_concept<typename PC::value_type>::type>::type>::type>::type * = 0) {
   default_voronoi_builder builder;
- builder.insert_sites(
- points.begin(), points.end(), segments.begin(), segments.end());
+ builder.insert(points.begin(), points.end());
+ builder.insert_segments(segments.begin(), segments.end());
   builder.construct(output);
 }
 } // polygon

Modified: sandbox/gtl/boost/polygon/voronoi_builder.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/voronoi_builder.hpp (original)
+++ sandbox/gtl/boost/polygon/voronoi_builder.hpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -49,19 +49,19 @@
 
   voronoi_builder() {}
 
- void insert(const int_type& x, const int_type& y) {
+ void insert_point(const int_type& x, const int_type& y) {
     site_events_.push_back(site_event_type(x, y));
   }
 
   template <typename PointType>
   void insert(const PointType& point,
   typename enable_if<typename gtl_if<typename is_point_concept<typename geometry_concept<PointType>::type>::type>::type>::type * = 0) {
- insert(x(point), y(point));
+ insert_point(x(point), y(point));
   }
 
   template <typename PointIterator>
   void insert(PointIterator first_point, PointIterator last_point,
- typename enable_if<typename gtl_if<typename is_point_concept<typename geometry_concept<typename PointIterator::value_type>::type>::type>::type>::type * = 0) {
+ typename enable_if<typename gtl_if<typename is_point_concept<typename geometry_concept<typename std::iterator_traits<PointIterator>::value_type>::type>::type>::type>::type * = 0) {
     // Create a site event from each input point.
     for (PointIterator it = first_point; it != last_point; ++it) {
       insert(*it);
@@ -72,8 +72,8 @@
   // 1) the start point of the segment;
   // 2) the end point of the segment;
   // 3) the segment itself defined by its start point.
- void insert(const int_type& x1, const int_type& y1,
- const int_type& x2, const int_type& y2) {
+ void insert_segment(const int_type& x1, const int_type& y1,
+ const int_type& x2, const int_type& y2) {
     point_type p1(x1, y1);
     point_type p2(x2, y2);
     site_events_.push_back(site_event_type(p1));
@@ -87,7 +87,7 @@
 
   template <typename PointType>
   void insert_segment(const PointType& point1, const PointType& point2) {
- insert(point1.x(), point1.y(), point2.x(), point2.y());
+ insert_segment(point1.x(), point1.y(), point2.x(), point2.y());
   }
 
   template <typename SegmentType>
@@ -103,14 +103,6 @@
     }
   }
 
- template <typename PointIterator, typename SegmentIterator>
- void insert_sites(
- PointIterator first_point, PointIterator last_point,
- SegmentIterator first_segment, SegmentIterator last_segment) {
- insert(first_point, last_point);
- insert_segments(first_segment, last_segment);
- }
-
   // Run sweepline algorithm and fill output data structure.
   template <typename OUTPUT>
   void construct(OUTPUT *output) {

Modified: sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_points.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_points.cpp (original)
+++ sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_points.cpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -60,7 +60,7 @@
       VB_BOOST vb;
       VD_BOOST vd;
       for (int k = 0; k < NUM_POINTS[i]; ++k)
- vb.insert(static_cast<int32>(gen()), static_cast<int32>(gen()));
+ vb.insert_point(static_cast<int32>(gen()), static_cast<int32>(gen()));
       vb.construct(&vd);
     }
     double time_per_test = timer.elapsed() / NUM_RUNS[i];
@@ -77,8 +77,8 @@
     for (int j = 0; j < NUM_RUNS[i]; ++j) {
       SDT_CGAL dt;
       for (int k = 0; k < NUM_POINTS[i]; ++k) {
- dt.insert(Point_CGAL(static_cast<int32>(gen()),
- static_cast<int32>(gen())));
+ dt.insert(Point_CGAL(
+ static_cast<int32>(gen()), static_cast<int32>(gen())));
       }
     }
     double time_per_test = timer.elapsed() / NUM_RUNS[i];

Modified: sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_segments.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_segments.cpp (original)
+++ sandbox/gtl/libs/polygon/benchmark/voronoi_benchmark_segments.cpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -69,8 +69,8 @@
         int32 y1 = gen();
         int32 dx = (gen() & 1023) + 1;
         int32 dy = (gen() & 1023) + 1;
- ssd.insert(SEGMENT_POLYGON(POINT_POLYGON(x1, y1),
- POINT_POLYGON(x1 + dx, y1 + dy)));
+ ssd.insert(SEGMENT_POLYGON(
+ POINT_POLYGON(x1, y1), POINT_POLYGON(x1 + dx, y1 + dy)));
       }
       ssd.clean();
     }
@@ -93,8 +93,8 @@
         int32 y1 = gen();
         int32 dx = (gen() & 1023) + 1;
         int32 dy = (gen() & 1023) + 1;
- ssd.insert(SEGMENT_POLYGON(POINT_POLYGON(x1, y1),
- POINT_POLYGON(x1 + dx, y1 + dy)));
+ ssd.insert(SEGMENT_POLYGON(
+ POINT_POLYGON(x1, y1), POINT_POLYGON(x1 + dx, y1 + dy)));
       }
       ssd.clean();
       boost::polygon::construct_voronoi_segments(ssd, &vd);

Modified: sandbox/gtl/libs/polygon/example/voronoi_advanced_tutorial.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/example/voronoi_advanced_tutorial.cpp (original)
+++ sandbox/gtl/libs/polygon/example/voronoi_advanced_tutorial.cpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -129,7 +129,7 @@
   for (size_t i = 0; i < GENERATED_POINTS; ++i) {
     boost::int64_t x = distr(gen);
     boost::int64_t y = distr(gen);
- vb.insert(x, y);
+ vb.insert_point(x, y);
   }
 
   printf("Constructing Voronoi diagram of %d points...\n", GENERATED_POINTS);

Modified: sandbox/gtl/libs/polygon/example/voronoi_basic_tutorial.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/example/voronoi_basic_tutorial.cpp (original)
+++ sandbox/gtl/libs/polygon/example/voronoi_basic_tutorial.cpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -118,9 +118,9 @@
   voronoi_builder<int> vb;
   voronoi_diagram<double> vd;
   for (std::vector<Point>::iterator it = points.begin(); it != points.end(); ++it)
- vb.insert(it->a, it->b);
+ vb.insert_point(it->a, it->b);
   for (std::vector<Segment>::iterator it = segments.begin(); it != segments.end(); ++it)
- vb.insert(it->p0.a, it->p0.b, it->p1.a, it->p1.b);
+ vb.insert_segment(it->p0.a, it->p0.b, it->p1.a, it->p1.b);
   vb.construct(&vd);
 
   // Traversing Voronoi Graph.

Modified: sandbox/gtl/libs/polygon/example/voronoi_visualizer.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/example/voronoi_visualizer.cpp (original)
+++ sandbox/gtl/libs/polygon/example/voronoi_visualizer.cpp 2012-04-12 19:05:44 EDT (Thu, 12 Apr 2012)
@@ -50,13 +50,13 @@
     in_stream >> num_point_sites;
     for (int i = 0; i < num_point_sites; ++i) {
       in_stream >> x1 >> y1;
- vb_.insert(x1, y1);
+ vb_.insert_point(x1, y1);
       brect_.update(x1, y1);
     }
     in_stream >> num_edge_sites;
     for (int i = 0; i < num_edge_sites; ++i) {
       in_stream >> x1 >> y1 >> x2 >> y2;
- vb_.insert(x1, y1, x2, y2);
+ vb_.insert_segment(x1, y1, x2, y2);
       brect_.update(x1, y1);
       brect_.update(x2, y2);
     }


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