Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77131 - in sandbox/gtl: boost/polygon libs/polygon/test libs/polygon/voronoi_example
From: sydorchuk.andriy_at_[hidden]
Date: 2012-02-27 18:39:04


Author: asydorchuk
Date: 2012-02-27 18:39:03 EST (Mon, 27 Feb 2012)
New Revision: 77131
URL: http://svn.boost.org/trac/boost/changeset/77131

Log:
Updating voronoi diagram interface (renaming/refactoring) before adding documentation pages for it.
Updating test and visualizer.
Text files modified:
   sandbox/gtl/boost/polygon/voronoi_diagram.hpp | 239 ++++++++++++++++++---------------------
   sandbox/gtl/libs/polygon/test/voronoi_builder_test.cpp | 94 +++++++--------
   sandbox/gtl/libs/polygon/test/voronoi_test_helper.hpp | 28 ++--
   sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp | 62 +++++-----
   4 files changed, 201 insertions(+), 222 deletions(-)

Modified: sandbox/gtl/boost/polygon/voronoi_diagram.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/voronoi_diagram.hpp (original)
+++ sandbox/gtl/boost/polygon/voronoi_diagram.hpp 2012-02-27 18:39:03 EST (Mon, 27 Feb 2012)
@@ -330,10 +330,10 @@
             }
         } ctype_converter_type;
         typedef detail::point_2d<coordinate_type> point_type;
- typedef bounding_rectangle<coordinate_type> bounding_rectangle_type;
- typedef voronoi_cell<coordinate_type> voronoi_cell_type;
- typedef voronoi_vertex<coordinate_type> voronoi_vertex_type;
- typedef voronoi_edge<coordinate_type> voronoi_edge_type;
+ typedef bounding_rectangle<coordinate_type> brect_type;
+ typedef voronoi_cell<coordinate_type> cell_type;
+ typedef voronoi_vertex<coordinate_type> vertex_type;
+ typedef voronoi_edge<coordinate_type> edge_type;
         typedef class {
         public:
             enum { ULPS = 128 };
@@ -381,83 +381,70 @@
         typedef typename TRAITS::coordinate_type coordinate_type;
         typedef typename TRAITS::ctype_converter_type ctype_converter_type;
         typedef typename TRAITS::point_type point_type;
- typedef typename TRAITS::bounding_rectangle_type
- bounding_rectangle_type;
- typedef typename TRAITS::voronoi_cell_type voronoi_cell_type;
- typedef typename TRAITS::voronoi_vertex_type voronoi_vertex_type;
- typedef typename TRAITS::voronoi_edge_type voronoi_edge_type;
+ typedef typename TRAITS::brect_type brect_type;
+ typedef typename TRAITS::cell_type cell_type;
+ typedef typename TRAITS::vertex_type vertex_type;
+ typedef typename TRAITS::edge_type edge_type;
         typedef typename TRAITS::vertex_equality_predicate_type
             vertex_equality_predicate_type;
 
- typedef std::vector<voronoi_cell_type> voronoi_cells_type;
- typedef typename voronoi_cells_type::iterator
- voronoi_cell_iterator_type;
- typedef typename voronoi_cells_type::const_iterator
- voronoi_cell_const_iterator_type;
-
- typedef std::list<voronoi_vertex_type> voronoi_vertices_type;
- typedef typename voronoi_vertices_type::iterator
- voronoi_vertex_iterator_type;
- typedef typename voronoi_vertices_type::const_iterator
- voronoi_vertex_const_iterator_type;
-
- typedef std::list<voronoi_edge_type> voronoi_edges_type;
- typedef typename voronoi_edges_type::iterator
- voronoi_edge_iterator_type;
- typedef typename voronoi_edges_type::const_iterator
- voronoi_edge_const_iterator_type;
+ typedef std::vector<cell_type> cell_container_type;
+ typedef typename cell_container_type::iterator cell_iterator;
+ typedef typename cell_container_type::const_iterator const_cell_iterator;
+
+ typedef std::list<vertex_type> vertex_container_type;
+ typedef typename vertex_container_type::iterator vertex_iterator;
+ typedef typename vertex_container_type::const_iterator const_vertex_iterator;
+
+ typedef std::list<edge_type> edge_container_type;
+ typedef typename edge_container_type::iterator edge_iterator;
+ typedef typename edge_container_type::const_iterator const_edge_iterator;
 
         voronoi_diagram() :
- num_cell_records_(0),
- num_edge_records_(0),
- num_vertex_records_(0) {}
+ num_cells_(0),
+ num_edges_(0),
+ num_vertices_(0) {}
+
+ void reserve(int num_sites) {
+ cells_.reserve(num_sites);
+ }
 
         void clear() {
- voronoi_cells_type().swap(cell_records_);
- vertex_records_.clear();
- edge_records_.clear();
+ cells_.clear();
+ vertices_.clear();
+ edges_.clear();
 
- num_cell_records_ = 0;
- num_edge_records_ = 0;
- num_vertex_records_ = 0;
+ num_cells_ = 0;
+ num_edges_ = 0;
+ num_vertices_ = 0;
         }
 
- const bounding_rectangle_type &bounding_rectangle() const {
+ const brect_type &bounding_rectangle() const {
             return voronoi_rect_;
         }
 
- const voronoi_cells_type &cell_records() const {
- return cell_records_;
+ const cell_container_type &cells() const {
+ return cells_;
         }
 
- const voronoi_vertices_type &vertex_records() const {
- return vertex_records_;
+ const vertex_container_type &vertices() const {
+ return vertices_;
         }
 
- const voronoi_edges_type &edge_records() const {
- return edge_records_;
+ const edge_container_type &edges() const {
+ return edges_;
         }
 
- int num_cell_records() const {
- return num_cell_records_;
+ unsigned int num_cells() const {
+ return num_cells_;
         }
 
- int num_edge_records() const {
- return num_edge_records_;
+ unsigned int num_edges() const {
+ return num_edges_;
         }
 
- int num_vertex_records() const {
- return num_vertex_records_;
- }
-
- void reserve(int num_sites) {
- // Resize cell vector to avoid reallocations.
- cell_records_.reserve(num_sites);
-
- // Init counters.
- num_cell_records_ = 0;
- num_edge_records_ = 0;
- num_vertex_records_ = 0;
+ unsigned int num_vertices() const {
+ return num_vertices_;
         }
 
         // Update the voronoi output in case of a single point input.
@@ -465,10 +452,10 @@
         void process_single_site(const SEvent &site) {
             // Update bounding rectangle.
             point_type p = prepare_point(site.point0());
- voronoi_rect_ = bounding_rectangle_type(p);
+ voronoi_rect_ = brect_type(p);
 
             // Update cell records.
- cell_records_.push_back(voronoi_cell_type(p, NULL));
+ cells_.push_back(cell_type(p, NULL));
         }
 
         // Insert a new half-edge into the output data structure.
@@ -482,34 +469,34 @@
             int site_index2 = site2.index();
 
             // Create a new half-edge that belongs to the first site.
- edge_records_.push_back(voronoi_edge_type());
- voronoi_edge_type &edge1 = edge_records_.back();
+ edges_.push_back(edge_type());
+ edge_type &edge1 = edges_.back();
 
             // Create a new half-edge that belongs to the second site.
- edge_records_.push_back(voronoi_edge_type());
- voronoi_edge_type &edge2 = edge_records_.back();
+ edges_.push_back(edge_type());
+ edge_type &edge2 = edges_.back();
 
             // Add the initial cell during the first edge insertion.
- if (cell_records_.empty()) {
+ if (cells_.empty()) {
                 process_single_site(site1);
- cell_records_.back().incident_edge(&edge1);
+ cells_.back().incident_edge(&edge1);
             }
- cell_records_[site_index1].inc_num_incident_edges();
+ cells_[site_index1].inc_num_incident_edges();
 
             // Update the bounding rectangle.
             voronoi_rect_.update(prepare_point(site2.point0()));
 
             // The second site represents a new site during site event
             // processing. Add a new cell to the cell records.
- cell_records_.push_back(voronoi_cell_type(
+ cells_.push_back(cell_type(
                 prepare_point(site2.point0()),
                 prepare_point(site2.point1()),
                 &edge2));
- cell_records_.back().inc_num_incident_edges();
+ cells_.back().inc_num_incident_edges();
 
             // Set up pointers to cells.
- edge1.cell(&cell_records_[site_index1]);
- edge2.cell(&cell_records_[site_index2]);
+ edge1.cell(&cells_[site_index1]);
+ edge2.cell(&cells_[site_index2]);
 
             // Set up twin pointers.
             edge1.twin(&edge2);
@@ -531,32 +518,29 @@
                               const CEvent &circle,
                               void *data12,
                               void *data23) {
- voronoi_edge_type *edge12 =
- static_cast<voronoi_edge_type*>(data12);
- voronoi_edge_type *edge23 =
- static_cast<voronoi_edge_type*>(data23);
+ edge_type *edge12 = static_cast<edge_type*>(data12);
+ edge_type *edge23 = static_cast<edge_type*>(data23);
 
             // Add a new voronoi vertex.
             coordinate_type x = convert_(circle.x());
             coordinate_type y = convert_(circle.y());
- vertex_records_.push_back(
- voronoi_vertex_type(point_type(x, y), edge12));
- voronoi_vertex_type &new_vertex = vertex_records_.back();
+ vertices_.push_back(vertex_type(point_type(x, y), edge12));
+ vertex_type &new_vertex = vertices_.back();
 
             // Update vertex pointers of the old edges.
             edge12->vertex0(&new_vertex);
             edge23->vertex0(&new_vertex);
 
             // Add a new half-edge.
- edge_records_.push_back(voronoi_edge_type());
- voronoi_edge_type &new_edge1 = edge_records_.back();
- new_edge1.cell(&cell_records_[site1.index()]);
+ edges_.push_back(edge_type());
+ edge_type &new_edge1 = edges_.back();
+ new_edge1.cell(&cells_[site1.index()]);
             new_edge1.cell()->inc_num_incident_edges();
 
             // Add a new half-edge.
- edge_records_.push_back(voronoi_edge_type());
- voronoi_edge_type &new_edge2 = edge_records_.back();
- new_edge2.cell(&cell_records_[site3.index()]);
+ edges_.push_back(edge_type());
+ edge_type &new_edge2 = edges_.back();
+ new_edge2.cell(&cells_[site3.index()]);
             new_edge2.cell()->inc_num_incident_edges();
 
             // Update twin pointers.
@@ -580,31 +564,31 @@
 
         // Remove zero-length edges from the voronoi output.
         void clean() {
- voronoi_edge_iterator_type edge_it1;
- voronoi_edge_iterator_type edge_it = edge_records_.begin();
- num_cell_records_ = cell_records_.size();
+ edge_iterator edge_it1;
+ edge_iterator edge_it = edges_.begin();
+ num_cells_ = cells_.size();
 
             // All the initial sites are colinear.
- if (vertex_records_.empty()) {
+ if (vertices_.empty()) {
                 // Update edges counter.
- num_edge_records_ = num_cell_records_ - 1;
+ num_edges_ = num_cells_ - 1;
 
                 // Return if there are no edges.
- if (edge_it == edge_records_.end())
+ if (edge_it == edges_.end())
                     return;
 
                 // Update prev/next pointers of the edges. Those edges won't
                 // have any common endpoints, cause they are infinite.
                 // But still they follow each other using CCW ordering.
- voronoi_edge_type *edge1 = &(*edge_it);
+ edge_type *edge1 = &(*edge_it);
                 edge1->next(edge1);
                 edge1->prev(edge1);
                 ++edge_it;
                 edge1 = &(*edge_it);
                 ++edge_it;
 
- while (edge_it != edge_records_.end()) {
- voronoi_edge_type *edge2 = &(*edge_it);
+ while (edge_it != edges_.end()) {
+ edge_type *edge2 = &(*edge_it);
                     ++edge_it;
 
                     edge1->next(edge2);
@@ -624,18 +608,18 @@
             // Iterate over all the edges and remove degeneracies
             // (zero-length edges). Edge is considered to be zero-length
             // if both its endpoints lie within some epsilon-rectangle.
- while (edge_it != edge_records_.end()) {
+ while (edge_it != edges_.end()) {
                 edge_it1 = edge_it;
                 std::advance(edge_it, 2);
 
                 // Degenerate edges exist only among finite edges.
                 if (!edge_it1->vertex0() || !edge_it1->vertex1()) {
- ++num_edge_records_;
+ ++num_edges_;
                     continue;
                 }
 
- const voronoi_vertex_type *v1 = edge_it1->vertex0();
- const voronoi_vertex_type *v2 = edge_it1->vertex1();
+ const vertex_type *v1 = edge_it1->vertex0();
+ const vertex_type *v2 = edge_it1->vertex1();
 
                 // Make epsilon robust check.
                 if (vertex_equality_predicate_(v1->vertex(), v2->vertex())) {
@@ -679,31 +663,31 @@
                     }
 
                     // Remove zero-length edge.
- edge_records_.erase(edge_it1, edge_it);
+ edges_.erase(edge_it1, edge_it);
                 } else {
                     // Count not degenerate edge.
- ++num_edge_records_;
+ ++num_edges_;
                 }
             }
 
             // Remove degenerate voronoi vertices with zero incident edges.
- for (voronoi_vertex_iterator_type vertex_it =
- vertex_records_.begin();
- vertex_it != vertex_records_.end();) {
+ for (vertex_iterator vertex_it =
+ vertices_.begin();
+ vertex_it != vertices_.end();) {
                 if (vertex_it->incident_edge() == NULL) {
- vertex_it = vertex_records_.erase(vertex_it);
+ vertex_it = vertices_.erase(vertex_it);
                 } else {
                     ++vertex_it;
- ++num_vertex_records_;
+ ++num_vertices_;
                 }
             }
 
             // Update prev/next pointers for the ray-edges.
- for (voronoi_cell_iterator_type cell_it = cell_records_.begin();
- cell_it != cell_records_.end(); ++cell_it) {
+ for (cell_iterator cell_it = cells_.begin();
+ cell_it != cells_.end(); ++cell_it) {
                 // Move to the previous edge while
                 // it is possible in the CW direction.
- voronoi_edge_type *cur_edge = cell_it->incident_edge();
+ edge_type *cur_edge = cell_it->incident_edge();
                 if (cur_edge) {
                     while (cur_edge->prev() != NULL) {
                         cur_edge = cur_edge->prev();
@@ -719,8 +703,7 @@
 
                     // Set up prev/next half-edge pointers for the ray-edges.
                     if (cur_edge->prev() == NULL) {
- voronoi_edge_type *last_edge =
- cell_it->incident_edge();
+ edge_type *last_edge = cell_it->incident_edge();
                         while (last_edge->next() != NULL)
                             last_edge = last_edge->next();
                         last_edge->next(cur_edge);
@@ -744,29 +727,29 @@
         }
 
         // Remove degenerate edge.
- void remove_edge(voronoi_edge_type *edge) {
- voronoi_vertex_type *vertex1 = edge->vertex0();
- voronoi_vertex_type *vertex2 = edge->vertex1();
+ void remove_edge(edge_type *edge) {
+ vertex_type *vertex1 = edge->vertex0();
+ vertex_type *vertex2 = edge->vertex1();
 
             // Update number of incident edges.
             vertex1->num_incident_edges(vertex1->num_incident_edges() +
                                         vertex2->num_incident_edges() - 2);
 
             // Update the endpoints of the incident edges to the second vertex.
- voronoi_edge_type *updated_edge = edge->twin()->rot_next();
+ edge_type *updated_edge = edge->twin()->rot_next();
             while (updated_edge != edge->twin()) {
                 updated_edge->vertex0(vertex1);
                 updated_edge = updated_edge->rot_next();
             }
 
- voronoi_edge_type *edge1 = edge;
- voronoi_edge_type *edge2 = edge->twin();
+ edge_type *edge1 = edge;
+ edge_type *edge2 = edge->twin();
 
- voronoi_edge_type *edge1_rot_prev = edge1->rot_prev();
- voronoi_edge_type *edge1_rot_next = edge1->rot_next();
+ edge_type *edge1_rot_prev = edge1->rot_prev();
+ edge_type *edge1_rot_next = edge1->rot_next();
 
- voronoi_edge_type *edge2_rot_prev = edge2->rot_prev();
- voronoi_edge_type *edge2_rot_next = edge2->rot_next();
+ edge_type *edge2_rot_prev = edge2->rot_prev();
+ edge_type *edge2_rot_next = edge2->rot_next();
 
             // Update prev/next pointers for the incident edges.
             edge1_rot_next->twin()->next(edge2_rot_prev);
@@ -780,21 +763,21 @@
                 vertex1->incident_edge(edge->rot_prev());
             }
 
- // Set the incident edge point of the second vertex to NULL value.
+ // Set the incident edge pointer of the second vertex to NULL value.
             if (vertex1 != vertex2) {
                 vertex2->incident_edge(NULL);
             }
         }
 
- voronoi_cells_type cell_records_;
- voronoi_vertices_type vertex_records_;
- voronoi_edges_type edge_records_;
-
- int num_cell_records_;
- int num_edge_records_;
- int num_vertex_records_;
+ cell_container_type cells_;
+ vertex_container_type vertices_;
+ edge_container_type edges_;
+
+ unsigned int num_cells_;
+ unsigned int num_edges_;
+ unsigned int num_vertices_;
 
- bounding_rectangle_type voronoi_rect_;
+ brect_type voronoi_rect_;
         ctype_converter_type convert_;
         vertex_equality_predicate_type vertex_equality_predicate_;
 

Modified: sandbox/gtl/libs/polygon/test/voronoi_builder_test.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/test/voronoi_builder_test.cpp (original)
+++ sandbox/gtl/libs/polygon/test/voronoi_builder_test.cpp 2012-02-27 18:39:03 EST (Mon, 27 Feb 2012)
@@ -22,42 +22,39 @@
 typedef boost::mpl::list<int> test_types;
 
 #define CHECK_EQUAL_POINTS(p1, p2) \
- BOOST_CHECK_EQUAL(p1.x() == static_cast<T>(p2.x()), true); \
- BOOST_CHECK_EQUAL(p1.y() == static_cast<T>(p2.y()), true)
+ BOOST_CHECK(p1.x() == static_cast<T>(p2.x())); \
+ BOOST_CHECK(p1.y() == static_cast<T>(p2.y()))
 
 #define CHECK_BRECT(brect, xmin, ymin, xmax, ymax) \
- BOOST_CHECK_EQUAL(brect.x_min() == static_cast<coordinate_type>(xmin), true); \
- BOOST_CHECK_EQUAL(brect.y_min() == static_cast<coordinate_type>(ymin), true); \
- BOOST_CHECK_EQUAL(brect.x_max() == static_cast<coordinate_type>(xmax), true); \
- BOOST_CHECK_EQUAL(brect.y_max() == static_cast<coordinate_type>(ymax), true)
+ BOOST_CHECK(brect.x_min() == static_cast<coordinate_type>(xmin)); \
+ BOOST_CHECK(brect.y_min() == static_cast<coordinate_type>(ymin)); \
+ BOOST_CHECK(brect.x_max() == static_cast<coordinate_type>(xmax)); \
+ BOOST_CHECK(brect.y_max() == static_cast<coordinate_type>(ymax))
 
 #define CHECK_OUTPUT_SIZE(output, cells, vertices, edges) \
- BOOST_CHECK_EQUAL(output.cell_records().size() == static_cast<unsigned int>(cells), true); \
- BOOST_CHECK_EQUAL(output.num_cell_records() == cells, true); \
- BOOST_CHECK_EQUAL(output.vertex_records().size() == static_cast<unsigned int>(vertices), true); \
- BOOST_CHECK_EQUAL(output.num_vertex_records() == vertices, true); \
- BOOST_CHECK_EQUAL(output.edge_records().size() == static_cast<unsigned int>(edges << 1), true); \
- BOOST_CHECK_EQUAL(output.num_edge_records() == edges, true)
+ BOOST_CHECK(output.num_cells() == cells); \
+ BOOST_CHECK(output.num_vertices() == vertices); \
+ BOOST_CHECK(output.num_edges() == edges)
 
 #define VERIFY_OUTPUT(output) \
- BOOST_CHECK_EQUAL(voronoi_test_helper::verify_output(output, \
- voronoi_test_helper::HALF_EDGE_ORIENTATION), true); \
- BOOST_CHECK_EQUAL(voronoi_test_helper::verify_output(output, \
- voronoi_test_helper::CELL_CONVEXITY), true); \
- BOOST_CHECK_EQUAL(voronoi_test_helper::verify_output(output, \
- voronoi_test_helper::INCIDENT_EDGES_CCW_ORDER), true); \
- BOOST_CHECK_EQUAL(voronoi_test_helper::verify_output(output, \
- voronoi_test_helper::NO_HALF_EDGE_INTERSECTIONS), true)
+ BOOST_CHECK(voronoi_test_helper::verify_output(output, \
+ voronoi_test_helper::HALF_EDGE_ORIENTATION)); \
+ BOOST_CHECK(voronoi_test_helper::verify_output(output, \
+ voronoi_test_helper::CELL_CONVEXITY)); \
+ BOOST_CHECK(voronoi_test_helper::verify_output(output, \
+ voronoi_test_helper::INCIDENT_EDGES_CCW_ORDER)); \
+ BOOST_CHECK(voronoi_test_helper::verify_output(output, \
+ voronoi_test_helper::NO_HALF_EDGE_INTERSECTIONS))
 
 #define VERIFY_NO_HALF_EDGE_INTERSECTIONS(output) \
- BOOST_CHECK_EQUAL(voronoi_test_helper::verify_output(output, \
- voronoi_test_helper::NO_HALF_EDGE_INTERSECTIONS), true)
+ BOOST_CHECK(voronoi_test_helper::verify_output(output, \
+ voronoi_test_helper::NO_HALF_EDGE_INTERSECTIONS))
 
 typedef voronoi_diagram<double> vd_type;
 typedef vd_type::coordinate_type coordinate_type;
-typedef vd_type::voronoi_edge_type voronoi_edge_type;
-typedef vd_type::voronoi_cell_const_iterator_type voronoi_cell_const_iterator_type;
-typedef vd_type::voronoi_vertex_const_iterator_type voronoi_vertex_const_iterator_type;
+typedef vd_type::edge_type voronoi_edge_type;
+typedef vd_type::const_cell_iterator const_cell_iterator;
+typedef vd_type::const_vertex_iterator const_vertex_iterator;
 
 // Sites: (0, 0).
 BOOST_AUTO_TEST_CASE_TEMPLATE(single_site_test, T, test_types) {
@@ -68,11 +65,12 @@
     VERIFY_OUTPUT(test_output);
 
     CHECK_BRECT(test_output.bounding_rectangle(), 0, 0, 0, 0);
+ BOOST_CHECK(test_output.cells().size() == 1);
     CHECK_OUTPUT_SIZE(test_output, 1, 0, 0);
 
- voronoi_cell_const_iterator_type it = test_output.cell_records().begin();
- BOOST_CHECK_EQUAL(it->num_incident_edges(), 0);
- BOOST_CHECK_EQUAL(it->incident_edge() == NULL, true);
+ const_cell_iterator it = test_output.cells().begin();
+ BOOST_CHECK(it->num_incident_edges() == 0);
+ BOOST_CHECK(it->incident_edge() == NULL);
 }
 
 // Sites: (0, 0), (0, 1).
@@ -87,7 +85,7 @@
     CHECK_BRECT(test_output.bounding_rectangle(), 0, 0, 0, 1);
     CHECK_OUTPUT_SIZE(test_output, 2, 0, 1);
 
- voronoi_cell_const_iterator_type cell_it = test_output.cell_records().begin();
+ const_cell_iterator cell_it = test_output.cells().begin();
     BOOST_CHECK_EQUAL(cell_it->num_incident_edges(), 1);
     cell_it++;
     BOOST_CHECK_EQUAL(cell_it->num_incident_edges(), 1);
@@ -122,7 +120,7 @@
     CHECK_BRECT(test_output.bounding_rectangle(), 0, 0, 2, 2);
     CHECK_OUTPUT_SIZE(test_output, 3, 0, 2);
 
- voronoi_cell_const_iterator_type cell_it = test_output.cell_records().begin();
+ const_cell_iterator cell_it = test_output.cells().begin();
     BOOST_CHECK_EQUAL(cell_it->num_incident_edges(), 1);
     const voronoi_edge_type *edge1_1 = cell_it->incident_edge();
     const voronoi_edge_type *edge1_2 = edge1_1->twin();
@@ -163,7 +161,7 @@
     CHECK_BRECT(test_output.bounding_rectangle(), 0, 0, 2, 4);
     CHECK_OUTPUT_SIZE(test_output, 3, 1, 3);
 
- voronoi_vertex_const_iterator_type it = test_output.vertex_records().begin();
+ const_vertex_iterator it = test_output.vertices().begin();
     BOOST_CHECK_EQUAL(it->vertex().x() == static_cast<coordinate_type>(0.25) &&
                       it->vertex().y() == static_cast<coordinate_type>(2.0), true);
 
@@ -215,7 +213,7 @@
     CHECK_BRECT(test_output.bounding_rectangle(), 0, 0, 2, 4);
     CHECK_OUTPUT_SIZE(test_output, 3, 1, 3);
 
- voronoi_vertex_const_iterator_type it = test_output.vertex_records().begin();
+ const_vertex_iterator it = test_output.vertices().begin();
     BOOST_CHECK_EQUAL(it->vertex().x() == static_cast<coordinate_type>(1.75) &&
                       it->vertex().y() == static_cast<coordinate_type>(2.0), true);
 
@@ -270,7 +268,7 @@
     CHECK_OUTPUT_SIZE(test_output, 4, 1, 4);
 
     // Check voronoi vertex.
- voronoi_vertex_const_iterator_type it = test_output.vertex_records().begin();
+ const_vertex_iterator it = test_output.vertices().begin();
     BOOST_CHECK_EQUAL(it->vertex().x() == static_cast<coordinate_type>(0.5) &&
                       it->vertex().y() == static_cast<coordinate_type>(0.5), true);
 
@@ -338,9 +336,9 @@
         construct_voronoi_points(point_vec_large, &test_output_large);
         VERIFY_OUTPUT(test_output_small);
         VERIFY_OUTPUT(test_output_large);
- int num_cells = grid_size[k] * grid_size[k];
- int num_vertices = num_cells - 2 * grid_size[k] + 1;
- int num_edges = 2 * num_cells - 2 * grid_size[k];
+ unsigned int num_cells = grid_size[k] * grid_size[k];
+ unsigned int num_vertices = num_cells - 2 * grid_size[k] + 1;
+ unsigned int num_edges = 2 * num_cells - 2 * grid_size[k];
         CHECK_OUTPUT_SIZE(test_output_small, num_cells, num_vertices, num_edges);
         CHECK_OUTPUT_SIZE(test_output_large, num_cells, num_vertices, num_edges);
     }
@@ -374,12 +372,12 @@
             construct_voronoi_points(point_vec_large, &test_output_large);
             VERIFY_OUTPUT(test_output_small);
             VERIFY_OUTPUT(test_output_large);
- BOOST_CHECK_EQUAL(test_output_small.num_cell_records(),
- test_output_large.num_cell_records());
- BOOST_CHECK_EQUAL(test_output_small.num_vertex_records(),
- test_output_large.num_vertex_records());
- BOOST_CHECK_EQUAL(test_output_small.num_edge_records(),
- test_output_large.num_edge_records());
+ BOOST_CHECK_EQUAL(test_output_small.num_cells(),
+ test_output_large.num_cells());
+ BOOST_CHECK_EQUAL(test_output_small.num_vertices(),
+ test_output_large.num_vertices());
+ BOOST_CHECK_EQUAL(test_output_small.num_edges(),
+ test_output_large.num_edges());
         }
     }
 }
@@ -553,9 +551,9 @@
         construct_voronoi_segments(segments_large, &test_output_large);
         VERIFY_NO_HALF_EDGE_INTERSECTIONS(test_output_small);
         VERIFY_NO_HALF_EDGE_INTERSECTIONS(test_output_large);
- BOOST_CHECK_EQUAL(test_output_small.num_cell_records(), test_output_large.num_cell_records());
- BOOST_CHECK_EQUAL(test_output_small.num_vertex_records(), test_output_large.num_vertex_records());
- BOOST_CHECK_EQUAL(test_output_small.num_edge_records(), test_output_large.num_edge_records());
+ BOOST_CHECK_EQUAL(test_output_small.num_cells(), test_output_large.num_cells());
+ BOOST_CHECK_EQUAL(test_output_small.num_vertices(), test_output_large.num_vertices());
+ BOOST_CHECK_EQUAL(test_output_small.num_edges(), test_output_large.num_edges());
     }
 }
 #endif
@@ -641,9 +639,9 @@
             construct_voronoi_segments(segments_large, &test_output_large);
             VERIFY_NO_HALF_EDGE_INTERSECTIONS(test_output_small);
             VERIFY_NO_HALF_EDGE_INTERSECTIONS(test_output_large);
- BOOST_CHECK_EQUAL(test_output_small.num_cell_records(), test_output_large.num_cell_records());
- BOOST_CHECK_EQUAL(test_output_small.num_vertex_records(), test_output_large.num_vertex_records());
- BOOST_CHECK_EQUAL(test_output_small.num_edge_records(), test_output_large.num_edge_records());
+ BOOST_CHECK_EQUAL(test_output_small.num_cells(), test_output_large.num_cells());
+ BOOST_CHECK_EQUAL(test_output_small.num_vertices(), test_output_large.num_vertices());
+ BOOST_CHECK_EQUAL(test_output_small.num_edges(), test_output_large.num_edges());
         }
     }
 }

Modified: sandbox/gtl/libs/polygon/test/voronoi_test_helper.hpp
==============================================================================
--- sandbox/gtl/libs/polygon/test/voronoi_test_helper.hpp (original)
+++ sandbox/gtl/libs/polygon/test/voronoi_test_helper.hpp 2012-02-27 18:39:03 EST (Mon, 27 Feb 2012)
@@ -38,9 +38,9 @@
 template <typename Output>
 bool verify_half_edge_orientation(const Output &output) {
     typedef typename Output::point_type point_type;
- typename Output::voronoi_edge_const_iterator_type edge_it;
- for (edge_it = output.edge_records().begin();
- edge_it != output.edge_records().end(); edge_it++) {
+ typename Output::const_edge_iterator edge_it;
+ for (edge_it = output.edges().begin();
+ edge_it != output.edges().end(); edge_it++) {
         if (edge_it->is_bounded()) {
             const point_type &site_point = edge_it->cell()->point0();
             const point_type &start_point = edge_it->vertex0()->vertex();
@@ -55,10 +55,10 @@
 template <typename Output>
 bool verify_cell_convexity(const Output &output) {
     typedef typename Output::point_type point_type;
- typename Output::voronoi_cell_const_iterator_type cell_it;
- for (cell_it = output.cell_records().begin();
- cell_it != output.cell_records().end(); cell_it++) {
- const typename Output::voronoi_edge_type *edge = cell_it->incident_edge();
+ typename Output::const_cell_iterator cell_it;
+ for (cell_it = output.cells().begin();
+ cell_it != output.cells().end(); cell_it++) {
+ const typename Output::edge_type *edge = cell_it->incident_edge();
         if (edge)
             do {
                 if (edge->next()->prev() != edge)
@@ -84,10 +84,10 @@
 template <typename Output>
 bool verify_incident_edges_ccw_order(const Output &output) {
     typedef typename Output::point_type point_type;
- typedef typename Output::voronoi_edge_type voronoi_edge_type;
- typename Output::voronoi_vertex_const_iterator_type vertex_it;
- for (vertex_it = output.vertex_records().begin();
- vertex_it != output.vertex_records().end(); vertex_it++) {
+ typedef typename Output::edge_type voronoi_edge_type;
+ typename Output::const_vertex_iterator vertex_it;
+ for (vertex_it = output.vertices().begin();
+ vertex_it != output.vertices().end(); vertex_it++) {
         if (vertex_it->num_incident_edges() < 3)
             continue;
         const voronoi_edge_type *edge = vertex_it->incident_edge();
@@ -123,9 +123,9 @@
     typedef typename Output::point_type point_type;
     cmp<point_type> comparator;
     std::map< point_type, std::vector<point_type>, cmp<point_type> > edge_map;
- typename Output::voronoi_edge_const_iterator_type edge_it;
- for (edge_it = output.edge_records().begin();
- edge_it != output.edge_records().end(); edge_it++) {
+ typename Output::const_edge_iterator edge_it;
+ for (edge_it = output.edges().begin();
+ edge_it != output.edges().end(); edge_it++) {
         if (edge_it->is_bounded()) {
             const point_type &vertex0 = edge_it->vertex0()->vertex();
             const point_type &vertex1 = edge_it->vertex1()->vertex();

Modified: sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp (original)
+++ sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp 2012-02-27 18:39:03 EST (Mon, 27 Feb 2012)
@@ -68,8 +68,8 @@
                         (brect_.y_min() + brect_.y_max()) * 0.5);
 
     exterior_edges_set_.clear();
- for (voronoi_edge_const_iterator_type it = vd_.edge_records().begin();
- it != vd_.edge_records().end(); ++it) {
+ for (const_edge_iterator it = vd_.edges().begin();
+ it != vd_.edges().end(); ++it) {
       if (!it->is_bounded()) {
         remove_exterior(&(*it));
       }
@@ -101,12 +101,11 @@
 
     // Draw voronoi sites.
     {
- const voronoi_cells_type &cells = vd_.cell_records();
- voronoi_cell_const_iterator_type it;
       glColor3f(0.0f, 0.5f, 1.0f);
       glPointSize(9);
       glBegin(GL_POINTS);
- for (it = cells.begin(); it != cells.end(); ++it) {
+ for (const_cell_iterator it = vd_.cells().begin();
+ it != vd_.cells().end(); ++it) {
         if (!it->contains_segment()) {
           glVertex2f(it->point0().x() - shift_.x(),
                      it->point0().y() - shift_.y());
@@ -116,7 +115,8 @@
       glPointSize(6);
       glLineWidth(2.7f);
       glBegin(GL_LINES);
- for (it = cells.begin(); it != cells.end(); ++it) {
+ for (const_cell_iterator it = vd_.cells().begin();
+ it != vd_.cells().end(); ++it) {
         if (it->contains_segment()) {
           glVertex2f(it->point0().x() - shift_.x(),
                      it->point0().y() - shift_.y());
@@ -128,27 +128,25 @@
       glLineWidth(1.0);
     }
 
- //// Draw voronoi vertices.
- //{
- // const voronoi_vertices_type &vertices = vd_.vertex_records();
- // voronoi_vertex_const_iterator_type it;
- // glColor3f(0.0f, 0.0f, 0.0f);
- // glBegin(GL_POINTS);
- // for (it = vertices.begin(); it != vertices.end(); ++it) {
- // glVertex2f(it->vertex().x() - shift_.x(),
- // it->vertex().y() - shift_.y());
- // }
- // glEnd();
- //}
+ // Draw voronoi vertices.
+ /*{
+ glColor3f(0.0f, 0.0f, 0.0f);
+ glBegin(GL_POINTS);
+ for (const_vertex_iterator it = vd_.vertices().begin();
+ it != vd_.vertices().end(); ++it) {
+ glVertex2f(it->vertex().x() - shift_.x(),
+ it->vertex().y() - shift_.y());
+ }
+ glEnd();
+ }*/
 
     // Draw voronoi edges.
     {
- const voronoi_edges_type &edges = vd_.edge_records();
- voronoi_edge_const_iterator_type it;
       glColor3f(0.0f, 0.0f, 0.0f);
       glLineWidth(1.7f);
       glBegin(GL_LINES);
- for (it = edges.begin(); it != edges.end(); ++it) {
+ for (const_edge_iterator it = vd_.edges().begin();
+ it != vd_.edges().end(); ++it) {
         if (primary_edges_only_ && !it->is_primary()) {
           continue;
         }
@@ -180,25 +178,25 @@
   typedef double coordinate_type;
   typedef detail::point_2d<double> point_type;
   typedef voronoi_diagram<double> VD;
- typedef VD::voronoi_edge_type voronoi_edge_type;
- typedef VD::voronoi_cells_type voronoi_cells_type;
- typedef VD::voronoi_vertices_type voronoi_vertices_type;
- typedef VD::voronoi_edges_type voronoi_edges_type;
- typedef VD::voronoi_cell_const_iterator_type voronoi_cell_const_iterator_type;
- typedef VD::voronoi_vertex_const_iterator_type voronoi_vertex_const_iterator_type;
- typedef VD::voronoi_edge_const_iterator_type voronoi_edge_const_iterator_type;
+ typedef VD::edge_type edge_type;
+ typedef VD::cell_container_type cell_container_type;
+ typedef VD::cell_container_type vertex_container_type;
+ typedef VD::edge_container_type edge_container_type;
+ typedef VD::const_cell_iterator const_cell_iterator;
+ typedef VD::const_vertex_iterator const_vertex_iterator;
+ typedef VD::const_edge_iterator const_edge_iterator;
 
- void remove_exterior(const VD::voronoi_edge_type* edge) {
+ void remove_exterior(const VD::edge_type* edge) {
     if (exterior_edges_set_.count(edge)) {
       return;
     }
     exterior_edges_set_.insert(edge);
     exterior_edges_set_.insert(edge->twin());
- const voronoi_diagram<double>::voronoi_vertex_type* v = edge->vertex1();
+ const voronoi_diagram<double>::vertex_type* v = edge->vertex1();
     if (v == NULL || !edge->is_primary()) {
       return;
     }
- const voronoi_diagram<double>::voronoi_edge_type* e = v->incident_edge();
+ const voronoi_diagram<double>::edge_type* e = v->incident_edge();
     do {
       remove_exterior(e);
       e = e->rot_next();
@@ -218,7 +216,7 @@
   point_type shift_;
   default_voronoi_builder vb_;
   voronoi_diagram<coordinate_type> vd_;
- std::set<const voronoi_edge_type*> exterior_edges_set_;
+ std::set<const edge_type*> exterior_edges_set_;
   bool primary_edges_only_;
   bool internal_edges_only_;
 };


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