From cd75d442043c1a71a78292aa726f6f601d99e507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 17 Jan 2017 17:01:15 +0100 Subject: [PATCH] Misc cleaning --- .../include/CGAL/Subdivision_mask_3.h | 10 ++--- .../include/CGAL/Subdivision_method_3.h | 6 +-- .../include/CGAL/Subdivision_method_impl_3.h | 37 +++++++++---------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/Subdivision_method_3/include/CGAL/Subdivision_mask_3.h b/Subdivision_method_3/include/CGAL/Subdivision_mask_3.h index d2e34ad4ce7..3e38e97c90c 100644 --- a/Subdivision_method_3/include/CGAL/Subdivision_mask_3.h +++ b/Subdivision_method_3/include/CGAL/Subdivision_mask_3.h @@ -1,6 +1,6 @@ // ====================================================================== // -// Copyright (c) 2005-20176 GeometryFactory (France). All Rights Reserved. +// Copyright (c) 2005-2017 GeometryFactory (France). All Rights Reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as @@ -21,8 +21,8 @@ // // ====================================================================== -#ifndef CGAL_POLYHEDRON_SUBDIVISION_STENCILS_H_01292002 -#define CGAL_POLYHEDRON_SUBDIVISION_STENCILS_H_01292002 +#ifndef CGAL_POLYHEDRON_SUBDIVISION_STENCILS_H +#define CGAL_POLYHEDRON_SUBDIVISION_STENCILS_H #include #include @@ -382,7 +382,7 @@ public: }; // ====================================================================== -// The geometry mask of Sqrt(3) subdivision +/// The geometry mask of Sqrt(3) subdivision template ::type > class Sqrt3_mask_3 : public Linear_mask_3 { typedef Linear_mask_3 Base; @@ -459,4 +459,4 @@ public: } //namespace CGAL -#endif //CGAL_POLYHEDRON_SUBDIVISION_STENCILS_H_01292002 +#endif //CGAL_POLYHEDRON_SUBDIVISION_STENCILS_H diff --git a/Subdivision_method_3/include/CGAL/Subdivision_method_3.h b/Subdivision_method_3/include/CGAL/Subdivision_method_3.h index c0578649268..60a4f2ca957 100644 --- a/Subdivision_method_3/include/CGAL/Subdivision_method_3.h +++ b/Subdivision_method_3/include/CGAL/Subdivision_method_3.h @@ -21,8 +21,8 @@ // // ====================================================================== -#ifndef CGAL_POLYHEDRON_SUBDIVISION_H_01292002 -#define CGAL_POLYHEDRON_SUBDIVISION_H_01292002 +#ifndef CGAL_POLYHEDRON_SUBDIVISION_H +#define CGAL_POLYHEDRON_SUBDIVISION_H #include @@ -219,4 +219,4 @@ namespace Subdivision_method_3 { } //namespace CGAL -#endif //CGAL_POLYHEDRON_SUBDIVISION_H_01292002 +#endif //CGAL_POLYHEDRON_SUBDIVISION_H diff --git a/Subdivision_method_3/include/CGAL/Subdivision_method_impl_3.h b/Subdivision_method_3/include/CGAL/Subdivision_method_impl_3.h index 3310538c02e..77c9d1b6adf 100644 --- a/Subdivision_method_3/include/CGAL/Subdivision_method_impl_3.h +++ b/Subdivision_method_3/include/CGAL/Subdivision_method_impl_3.h @@ -49,15 +49,15 @@ namespace Private { template void PQQ_1step(Poly& p, VertexPointMap vpm, Mask mask) { - typedef Polyhedron_decorator_3 PD; + typedef Polyhedron_decorator_3 PD; - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef typename boost::graph_traits::vertex_iterator vertex_iterator; typedef typename boost::graph_traits::edge_iterator edge_iterator; - typedef typename boost::graph_traits::face_iterator face_iterator; + typedef typename boost::graph_traits::face_iterator face_iterator; typedef Halfedge_around_face_circulator Halfedge_around_facet_circulator; @@ -165,6 +165,7 @@ namespace Private { for (size_t i = 0; i < num_vertex; i++, ++vitr) put(vpm, *vitr, vertex_point_buffer[i]); + CGAL_postcondition(p.is_valid()); delete []vertex_point_buffer; } @@ -174,13 +175,13 @@ namespace Private { typedef Polyhedron_decorator_3 PD; - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef typename boost::graph_traits::vertex_iterator vertex_iterator; typedef typename boost::graph_traits::edge_iterator edge_iterator; - typedef typename boost::graph_traits::face_iterator face_iterator; + typedef typename boost::graph_traits::face_iterator face_iterator; typedef Halfedge_around_face_circulator Halfedge_around_face_circulator; @@ -301,7 +302,7 @@ namespace Private { } Point* point_buffer = new Point[num_e*2]; - // build the point_buffer + // Build the point_buffer vertex_iterator vitr, vitr_end; boost::tie(vitr,vitr_end) = vertices(p); int pi = 0; @@ -313,8 +314,7 @@ namespace Private { } } - // If Polyhedron is using vector, we need to reserve the memory to prevent - // the CGAL_assertion. This function for polyhedron using list is VOID. + // Reserve to avoid rellocations during insertions p.reserve(num_v+num_e+num_f, 2*num_e, (2+4+2)*num_e); // Build the connectivity using insert_vertex() and insert_edge() @@ -343,9 +343,10 @@ namespace Private { halfedge_descriptor e2 = opposite(*vcir,p); PD::insert_edge(p, e1, e2); } - } else ++vcir; + } else { + ++vcir; + } } - //p.erase_center_vertex(vh->vertex_begin()); } edge_iterator eitr = edges(p).first; @@ -365,21 +366,17 @@ namespace Private { PD::insert_edge(p, prev(prev(eh,p),p), eh); } } - // after this point, the original border edges are in front! - //eitr = edges(p).first; - //for (size_t i = 0; i < num_be; ++i) { - //halfedge_descriptor eh = halfedge(*eitr,p); - //++eitr; + + // After this point, the original border edges are in front! BOOST_FOREACH(halfedge_descriptor eeh, border_halfedges){ halfedge_descriptor eh = eeh; if (is_border(eh,p)){ eh = opposite(eh,p); } - assert(is_border(eh,p)); + halfedge_descriptor ehe = eh; eh = opposite(prev(eh,p),p); while (! is_border(eh,p)) { - std::cerr << "before remove_face"<< std::endl; Euler::remove_face(ehe,p); ehe = eh; eh = opposite(prev(eh,p),p); @@ -569,7 +566,7 @@ namespace Private { // reserve enough size for the new points typename boost::graph_traits::faces_size_type new_pts_size = num_f; if(refine_border) { - BOOST_FOREACH(edge_descriptor ed, CGAL::edges(p)){ + BOOST_FOREACH(edge_descriptor ed, edges(p)){ if(is_border(ed, p)) ++new_pts_size; }