diff --git a/Packages/Partition_2/changes.txt b/Packages/Partition_2/changes.txt index bd605b80c2d..52f3b478289 100644 --- a/Packages/Partition_2/changes.txt +++ b/Packages/Partition_2/changes.txt @@ -1,3 +1,15 @@ +1.8 (12 March 2001) + + Changed Vertex_const_iterator to Vertex_iterator for Partition_vertex_map + build() function and partition_is_valid_2() in the hopes that this will + fix the problem the Windows compilers have with the call to insert in + build(). + + Removed the .C files that cannot be used with VC++ because of template + member functions. + + Fixed some warnings related to unused variables and parameters. + 1.7 (8 March 2001) Added typedefs for Traits parameters in Partitioned_polygon_2. diff --git a/Packages/Partition_2/include/CGAL/Indirect_edge_compare.C b/Packages/Partition_2/include/CGAL/Indirect_edge_compare.C deleted file mode 100644 index 227c133533c..00000000000 --- a/Packages/Partition_2/include/CGAL/Indirect_edge_compare.C +++ /dev/null @@ -1,136 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// release : $CGAL_Revision $ -// release_date : $CGAL_Date $ -// -// file : include/CGAL/Indirect_edge_compare.C -// package : $CGAL_Package: Partition_2 $ -// maintainer : Susan Hert -// chapter : Planar Polygon Partitioning -// -// revision : $Revision$ -// revision_date : $Date$ -// -// author(s) : Susan Hert -// -// coordinator : MPI (Susan Hert ) -// -// implementation: Comparison of edges represented by circulators to endpoints. -// ============================================================================ - -#include - -namespace CGAL { - -template -template -bool -Indirect_edge_compare:: larger_x_at_vertex_y( - ForwardCirculator edge_vtx_1, - ForwardCirculator vertex) const -{ - ForwardCirculator edge_vtx_2 = edge_vtx_1; - edge_vtx_2++; - // check for horizontal edge - if (_compare_y_2((*edge_vtx_1), (*edge_vtx_2)) == EQUAL) - { - // compare the smaller x and vertex x - if (_compare_x_2(*edge_vtx_1, *edge_vtx_2) == SMALLER) - return _compare_x_2(*edge_vtx_1, *vertex) == LARGER; - else - return _compare_x_2(*edge_vtx_2, *vertex) == LARGER; - } - else - { - // construct supporting line for edge - Line_2 line = _construct_line_2(*edge_vtx_1, *edge_vtx_2); - // compute x value at vertex's y value -// ??? CHANGE THIS when the function Compare_x_at_y is available -// return _compare_x_at_y(*vertex, line) == SMALLER; -// ??? - return line.x_at_y((*vertex).y()) > (*vertex).x(); - } -} - -template -template -bool -Indirect_edge_compare::operator()(ForwardCirculator p, - ForwardCirculator q) const -{ - ForwardCirculator after_p = p; - after_p++; - ForwardCirculator after_q = q; - after_q++; - if (p == after_q) - { - return larger_x_at_vertex_y(p, q); - } - else if (after_p == q) - { - return !larger_x_at_vertex_y(q, p); - } - else if (p == q) - { - return larger_x_at_vertex_y(p, after_q); - } - else if (after_p == after_q) - { - return larger_x_at_vertex_y(p, q); - } - else // neither endpoint is shared - { - // construct supporting line - Line_2 l_p = _construct_line_2(*p, *after_p); - if (l_p.is_horizontal()) - { - Line_2 l_q = _construct_line_2(*q, *after_q); - if (l_q.is_horizontal()) // shouldn't ever happen, since these - { // can't both be in sweep structure at - // the same time - return std::max((*p).x(), (*after_p).x()) > - std::max((*q).x(), (*after_q).x()); - } - else // p and after_p must both be on same side of l_q - { - return (*p).x() > l_q.x_at_y((*p).y()); - } - } - else - { - bool q_larger_x = l_p.x_at_y((*q).y()) > (*q).x(); - bool after_q_larger_x = l_p.x_at_y((*after_q).y())>(*after_q).x(); - if (q_larger_x == after_q_larger_x) - return q_larger_x; - else // one smaller and one larger - { - // construct the other line - Line_2 l_q = _construct_line_2(*q, *after_q); - if (l_q.is_horizontal()) // p is not horizontal - { - return (*q).x() > l_p.x_at_y((*q).y()); - } - else - { - bool p_larger_x = l_q.x_at_y((*p).y()) > (*p).x(); - bool after_p_larger_x = - l_q.x_at_y((*after_p).y()) > (*after_p).x(); - - CGAL_assertion (p_larger_x == after_p_larger_x); - - return !p_larger_x; - } - } - } - } -} - -} diff --git a/Packages/Partition_2/include/CGAL/Indirect_edge_compare.h b/Packages/Partition_2/include/CGAL/Indirect_edge_compare.h index f1b650f8cf2..ff0ea89d87d 100644 --- a/Packages/Partition_2/include/CGAL/Indirect_edge_compare.h +++ b/Packages/Partition_2/include/CGAL/Indirect_edge_compare.h @@ -161,15 +161,6 @@ class Indirect_edge_compare } -// -// See if the windows compilers continue to have problems if the function -// definitions are in the class -// -/* -#ifdef CGAL_CFG_NO_AUTOMATIC_TEMPLATE_INCLUSION -#include -#endif // CGAL_CFG_NO_AUTOMATIC_TEMPLATE_INCLUSION -*/ #endif // CGAL_INDIRECT_EDGE_COMPARE_H diff --git a/Packages/Partition_2/include/CGAL/Partition_vertex_map.C b/Packages/Partition_2/include/CGAL/Partition_vertex_map.C deleted file mode 100644 index 89934c9f7a0..00000000000 --- a/Packages/Partition_2/include/CGAL/Partition_vertex_map.C +++ /dev/null @@ -1,167 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// release : $CGAL_Revision $ -// release_date : $CGAL_Date $ -// -// file : include/CGAL/Partition_vertex_map.C -// package : $CGAL_Package: Partition_2 $ -// maintainer : Susan Hert -// chapter : Planar Polygon Partitioning -// -// revision : $Revision$ -// revision_date : $Date$ -// -// author(s) : Susan Hert -// -// coordinator : MPI (Susan Hert ) -// -// implementation: Map used to test for validity of polygon partition -// ============================================================================ - -#include - -namespace CGAL { - -template -template -void -Partition_vertex_map::build(InputIterator poly_first, - InputIterator poly_last) -{ - typedef typename Traits::Polygon_2::Vertex_const_iterator - Poly_vtx_const_iterator; - typedef std::pair Location_pair; - typedef Edge_list Edge_list; - typedef typename Traits::Point_2 Point_2; - typedef std::pair P_Vertex; - - - Location_pair v_loc_pair; - Location_pair begin_v_loc_pair; - Location_pair prev_v_loc_pair; - - Poly_vtx_const_iterator begin; - Poly_vtx_const_iterator end; - Poly_vtx_const_iterator v_it; - - int poly_num = 0; - for (; poly_first != poly_last; poly_first++, poly_num++) - { - begin = (*poly_first).vertices_begin(); - end = (*poly_first).vertices_end(); - begin_v_loc_pair= insert(P_Vertex(*begin, Edge_list())); - prev_v_loc_pair = begin_v_loc_pair; - v_it = begin; - for (v_it++; v_it != end; v_it++) - { - v_loc_pair = insert(P_Vertex(*v_it, Edge_list())); - insert_next_edge(prev_v_loc_pair.first, v_loc_pair.first, poly_num); - insert_prev_edge(v_loc_pair.first, prev_v_loc_pair.first, poly_num); - prev_v_loc_pair = v_loc_pair; - } - insert_next_edge(prev_v_loc_pair.first, begin_v_loc_pair.first, poly_num); - insert_prev_edge(begin_v_loc_pair.first, prev_v_loc_pair.first, poly_num); - } -} - - -template -template -OutputIterator -Partition_vertex_map::union_vertices(OutputIterator result) -{ - if (empty()) return result; - - Self_iterator first = begin(); - Self_iterator v_it = first; - Self_iterator prev_v_it; - bool inserting = false; - Self_iterator next_v_it; - - do - { - // Don't want to sort the edges for vertices of degree 2 because they - // are already in CCW order (since the partition polygons were in CCW - // order), and this is what you need when to begin the construction of - // the union polygon. - if ((*v_it).second.size() > 2) - { - (*v_it).second.sort( - CW_indirect_edge_info_compare((*v_it).first)); - } - if (!inserting) - { - if ((*v_it).second.size() == 2) - { - inserting = true; - // insert this vertex and the two around it - first = prev_v_it = (*(*v_it).second.begin()).endpoint(); -#ifdef CGAL_PARTITION_CHECK_DEBUG - std::cout << "union_vertices: inserting " - << (*prev_v_it).first << std::endl; -#endif - *result = (*prev_v_it).first; - result++; -#ifdef CGAL_PARTITION_CHECK_DEBUG - std::cout << "union_vertices: inserting " - << (*v_it).first << std::endl; -#endif - *result = (*v_it).first; - result++; - next_v_it = (*v_it).second.last_edge_info().endpoint(); -#ifdef CGAL_PARTITION_CHECK_DEBUG - std::cout << "union_vertices: inserting " - << (*next_v_it).first << std::endl; -#endif - *result = (*next_v_it).first; - result++; - } - else - { - next_v_it = v_it; - next_v_it++; - } - } - else - { - // find the previous vertex in this vertex's list - next_v_it =(*v_it).second.next_ccw_edge_info(prev_v_it).endpoint(); - if (next_v_it != first) - { -#ifdef CGAL_PARTITION_CHECK_DEBUG - std::cout << "union_vertices: inserting " - << (*next_v_it).first << std::endl; -#endif - *result = (*next_v_it).first; - result++; - } - } - prev_v_it = v_it; - v_it = next_v_it; -#ifdef CGAL_PARTITION_CHECK_DEBUG - std::cout << "union_vertices: prev_v_it " << (*prev_v_it).first - << " v_it " << (*v_it).first << " next_v_it " - << (*next_v_it).first << std::endl; -#endif - } - while (v_it != first && v_it != end()); -#ifdef CGAL_PARTITION_CHECK_DEBUG - if (v_it == first) - std::cout << "union_vertices: stopped because first was reached " - << std::endl; - else - std::cout << "union_vertices: stopped because end was reached " - << std::endl; -#endif - return result; -} - -} diff --git a/Packages/Partition_2/include/CGAL/Partition_vertex_map.h b/Packages/Partition_2/include/CGAL/Partition_vertex_map.h index a2a56a9e52f..687607c8d54 100644 --- a/Packages/Partition_2/include/CGAL/Partition_vertex_map.h +++ b/Packages/Partition_2/include/CGAL/Partition_vertex_map.h @@ -277,7 +277,7 @@ class Partition_vertex_map : public std::map, typename Traits::Less_xy_2>::iterator Self_iterator; diff --git a/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.C b/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.C deleted file mode 100644 index 92777806d53..00000000000 --- a/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.C +++ /dev/null @@ -1,193 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// release : $CGAL_Revision $ -// release_date : $CGAL_Date $ -// -// file : include/CGAL/Partitioned_polygon_2.C -// package : $CGAL_Package: Partition_2 $ -// maintainer : Susan Hert -// chapter : Planar Polygon Partitioning -// -// revision : $Revision$ -// revision_date : $Date$ -// -// author(s) : Susan Hert -// -// coordinator : MPI (Susan Hert ) -// -// implementation: Polygon with diagonals used to represent a partitioning -// ============================================================================ - -#include - -namespace CGAL { - -template -void -Partitioned_polygon_2::prune_diagonals() -{ - Circulator first(begin(), end(), begin()); - Circulator c = first; - typedef Partition_vertex::Diagonal_iterator Diagonal_iterator; - - Diagonal_iterator d; -#ifdef CGAL_PARTITIONED_POLY_DEBUG - std::cout << "pruning diagonals ..." << std::endl; -#endif - do { - d = (*c).diagonals_begin(); - while (d != (*c).diagonals_end()) { - if (!diagonal_is_necessary(c, *d)) - { -#ifdef CGAL_PARTITIONED_POLY_DEBUG - std::cout << " removing from " << *c << " to " << **d - << std::endl; -#endif - (**d).diagonal_erase(c); - d = (*c).diagonal_erase(d); - } - else - { - d++; - } - } -#ifdef CGAL_PARTITIONED_POLY_DEBUG - (*c).print_diagonals(); -#endif - (*c).reset_current_diagonal(); - } - while (++c != first); -} - -// the pruning is probably no longer necessary -template -template -OutputIterator -Partitioned_polygon_2::partition(OutputIterator result, bool prune) -{ - // walk through each vertex and sort the diagonals - Circulator first(begin(), end()); - Circulator c = first; - Circulator next; - Circulator prev = c; - prev--; - do - { - next = c; - next++; - (*c).sort_diagonals(prev, next); -#ifdef CGAL_PARTITIONED_POLY_DEBUG - (*c).print_diagonals(); -#endif - prev = c; - } - while (++c != first); - - // now remove any diagonals that do not cut a reflex angle at one end - if (prune) prune_diagonals(); - -#ifdef CGAL_PARTITIONED_POLY_DEBUG - c = first; - do - { - (*c).print_diagonals(); - } - while (++c != first); -#endif - - make_polygon(first, result); - return result; -} - -template -template -Partitioned_polygon_2::Circulator -Partitioned_polygon_2::make_polygon( - Partitioned_polygon_2::Circulator start, - OutputIterator& result) -{ - Subpolygon_2 new_polygon; - Circulator next = start; - do - { - new_polygon.push_back(*next); -#ifdef CGAL_PARTITIONED_POLY_DEBUG - std::cout << "adding vertex " << *next << std::endl; -#endif - Circulator diag; - if ((*next).has_unused_diagonals()) - { - diag = (*next).current_diagonal(); -#ifdef CGAL_PARTITIONED_POLY_DEBUG - std::cout << "diagonal endpoint: " << *diag << std::endl; -#endif - (*next).advance_diagonal(); - if (diag == start) - { - *result = new_polygon; - result++; - return next; - } - else - { - next = make_polygon(next, result); - } - } - else next++; - } while (next != start); - *result = new_polygon; - result++; - return next; - // if there are no diagonals at this vertex - // push on the vertex - // else if the first diagonal closes the polygon - // close the polygon - // return the current vertex (NOT the other end of the diagonal) - // else - // remove the first diagonal - // recur, starting a new polygon at this vertex and return the - // vertex where the new polygon ended - // continue from the last vertex of the new polygon -} - -template -bool -Partitioned_polygon_2::cuts_reflex_angle( - Partitioned_polygon_2::Circulator vertex_ref, - Partitioned_polygon_2::Circulator diag_endpoint) -{ - Circulator prev = vertex_ref; prev--; - Circulator next = vertex_ref; next++; - - typedef Partition_vertex::Diagonal_iterator Diagonal_iterator; - - // find diag_endpoint in vertex_ref's list of diagonals - Diagonal_iterator d_it; - for (d_it = (*vertex_ref).diagonals_begin(); - d_it != (*vertex_ref).diagonals_end() && diag_endpoint != *d_it; - d_it++) - { - prev = *d_it; - } - Diagonal_iterator next_d_it = d_it; - next_d_it++; - if (next_d_it == (*vertex_ref).diagonals_end()) - { - next = vertex_ref; - next++; - } - else - next = *next_d_it; - - return _rightturn(*prev, *vertex_ref, *next); -} - -} diff --git a/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.h b/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.h index 73e12cabc23..b4f1fbdd5df 100644 --- a/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.h +++ b/Packages/Partition_2/include/CGAL/Partitioned_polygon_2.h @@ -391,10 +391,5 @@ private: } -/* -#ifdef CGAL_CFG_NO_AUTOMATIC_TEMPLATE_INCLUSION -#include -#endif // CGAL_CFG_NO_AUTOMATIC_TEMPLATE_INCLUSION -*/ #endif // CGAL_PARTITIONED_POLYGON_2_H diff --git a/Packages/Partition_2/include/CGAL/partition_greene_approx_convex_2.h b/Packages/Partition_2/include/CGAL/partition_greene_approx_convex_2.h index 5386ab43a3b..5e7809bdb30 100644 --- a/Packages/Partition_2/include/CGAL/partition_greene_approx_convex_2.h +++ b/Packages/Partition_2/include/CGAL/partition_greene_approx_convex_2.h @@ -300,8 +300,7 @@ void stack_extend(Polygon& polygon, #endif } else - change_top_chain(polygon, point_ref, stack, top_chain, bottom_chain, - result, traits); + change_top_chain(polygon, point_ref, stack, top_chain, result, traits); } template & stack, Circ_pair< BidirectionalCirculator >& top_chain, - Circ_pair< BidirectionalCirculator >& bottom_chain, OutputIterator& result, const Traits& traits) { BidirectionalCirculator next_point_ref = new_point_ref; @@ -548,7 +546,7 @@ void make_polygons_from_stack(Polygon& polygon, Circ_pair< BidirectionalCirculator >& stack, Circ_pair< BidirectionalCirculator >& bottom_chain, Circ_pair< BidirectionalCirculator >& top_chain, - OutputIterator& result, const Traits& traits) + OutputIterator& result, const Traits& ) { bool update_required; // make polygons by connecting the high point to every point on the stack @@ -770,7 +768,7 @@ void ga_convex_decomposition(ForwardIterator first, ForwardIterator beyond, bottom_chain, result, traits); else if (is_adjacent_to(point_ref, top_chain.front())) change_top_chain(polygon, point_ref, stack, top_chain, - bottom_chain, result, traits); + result, traits); else change_bottom_chain(polygon, point_ref, stack, bottom_chain, top_chain, result, traits); diff --git a/Packages/Partition_2/include/CGAL/partition_is_valid_2.h b/Packages/Partition_2/include/CGAL/partition_is_valid_2.h index eafa43a5114..2f2e4218122 100644 --- a/Packages/Partition_2/include/CGAL/partition_is_valid_2.h +++ b/Packages/Partition_2/include/CGAL/partition_is_valid_2.h @@ -150,13 +150,13 @@ partition_is_valid_2 (InputIterator point_first, InputIterator point_last, { if (poly_first == poly_last) return (point_first == point_last); - typedef typename Traits::Polygon_2::Vertex_const_iterator - Poly_vtx_const_iterator; + typedef typename Traits::Polygon_2::Vertex_iterator + Poly_vtx_iterator; typedef typename Traits::Point_2 Point_2; typedef Partition_vertex_map P_Vertex_map; typedef typename Traits::Is_valid Is_valid; - Poly_vtx_const_iterator begin, end; + Poly_vtx_iterator vtx_begin, vtx_end; Is_valid is_valid = traits.is_valid_object(traits); @@ -174,15 +174,15 @@ partition_is_valid_2 (InputIterator point_first, InputIterator point_last, int poly_num = 0; for (; poly_first != poly_last; poly_first++, poly_num++) { - begin = (*poly_first).vertices_begin(); - end = (*poly_first).vertices_end(); + vtx_begin = (*poly_first).vertices_begin(); + vtx_end = (*poly_first).vertices_end(); #ifdef CGAL_PARTITION_CHECK_DEBUG std::cout << "Polygon " << poly_num << " is " << std::endl; std::cout << *poly_first << std::endl; #endif CGAL_partition_assertion ( - orientation_2(begin, end, traits) == COUNTERCLOCKWISE); - if (!is_valid(begin, end)) + orientation_2(vtx_begin, vtx_end, traits) == COUNTERCLOCKWISE); + if (!is_valid(vtx_begin, vtx_end)) { #ifdef CGAL_PARTITION_CHECK_DEBUG std::cout << "It does NOT have the tested property." << std::endl; @@ -251,7 +251,7 @@ convex_partition_is_valid_2(InputIterator point_first, InputIterator point_last, ForwardIterator poly_first, ForwardIterator poly_last, - const Traits& traits) + const Traits& ) { typedef typename Traits::Is_convex_2 Is_convex_2; Partition_is_valid_traits_2 validity_traits; @@ -292,7 +292,7 @@ y_monotone_partition_is_valid_2(InputIterator point_first, InputIterator point_last, ForwardIterator poly_first, ForwardIterator poly_last, - const Traits& traits) + const Traits& ) { typedef typename Traits::Is_y_monotone_2 Is_y_monotone_2; diff --git a/Packages/Partition_2/include/CGAL/polygon_function_objects.h b/Packages/Partition_2/include/CGAL/polygon_function_objects.h index 4a267d0b981..623bc933b1c 100644 --- a/Packages/Partition_2/include/CGAL/polygon_function_objects.h +++ b/Packages/Partition_2/include/CGAL/polygon_function_objects.h @@ -38,7 +38,7 @@ class Is_vacuously_valid { public: - Is_vacuously_valid(Traits t) {} + Is_vacuously_valid(Traits ) {} template bool operator()(ForwardIterator, ForwardIterator) diff --git a/Packages/Partition_2/version b/Packages/Partition_2/version index 5dc9a6b9b04..2a0bd0c3c44 100644 --- a/Packages/Partition_2/version +++ b/Packages/Partition_2/version @@ -1 +1 @@ -1.7 ( 8 Mar 2001) +1.8 ( 12 Mar 2001)