From b34d8cd6b8a1e7a6b9eff4614c59d3698e20f150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 11 Nov 2016 10:03:49 +0100 Subject: [PATCH] use readable property map API operator[]() is only required in Lvalue property map --- .../Triangulate_hole_polygon_mesh.h | 4 +-- .../internal/fair_impl.h | 2 +- .../internal/refine_impl.h | 25 ++++++++++--------- .../triangulate_faces.h | 10 ++++---- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h index cfe4867db4c..6fe011186be 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h @@ -117,8 +117,8 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh, int id = 0; Hedge_around_face_circulator circ(border_halfedge,pmesh), done(circ); do{ - P.push_back(vpmap[target(*circ, pmesh)]); - Q.push_back(vpmap[target(next(opposite(next(*circ,pmesh),pmesh),pmesh),pmesh)]); + P.push_back(get(vpmap, target(*circ, pmesh))); + Q.push_back(get(vpmap, target(next(opposite(next(*circ,pmesh),pmesh),pmesh),pmesh))); P_edges.push_back(*circ); if(!vertex_map.insert(std::make_pair(target(*circ,pmesh), id++)).second) { #ifndef CGAL_TEST_SUITE diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h index bb2e8b2c0ed..7464309111e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h @@ -92,7 +92,7 @@ private: matrix.add_coef(row_id, col_id, multiplier); } else { - typename boost::property_traits::reference p = ppmap[v]; + typename boost::property_traits::reference p = get(ppmap, v); x += multiplier * - to_double(p.x()); y += multiplier * - to_double(p.y()); z += multiplier * - to_double(p.z()); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index 27ded6db95b..f45f7c1eebd 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -68,8 +68,8 @@ private: } while(++v_cir != v_end); // also eliminate collinear triangle generation - if( CGAL::collinear(vpmap[v_tip_0], vpmap[v_tip_1], vpmap[target(h, pmesh)]) || - CGAL::collinear(vpmap[v_tip_0], vpmap[v_tip_1], vpmap[target(opposite(h, pmesh),pmesh)]) ) { + if( CGAL::collinear(get(vpmap, v_tip_0), get(vpmap, v_tip_1), get(vpmap, target(h, pmesh))) || + CGAL::collinear(get(vpmap, v_tip_0), get(vpmap, v_tip_1), get(vpmap, target(opposite(h, pmesh),pmesh))) ) { return false; } @@ -78,10 +78,11 @@ private: bool relax(halfedge_descriptor h) { - const Point_3& p = vpmap[target(h,pmesh)]; - const Point_3& q = vpmap[target(opposite(h,pmesh),pmesh)]; - const Point_3& r = vpmap[target(next(h,pmesh),pmesh)]; - const Point_3& s = vpmap[target(next(opposite(h,pmesh),pmesh),pmesh)]; + typedef typename boost::property_traits::reference Point_3_ref; + Point_3_ref p = get(vpmap, target(h,pmesh)); + Point_3_ref q = get(vpmap, target(opposite(h,pmesh),pmesh)); + Point_3_ref r = get(vpmap, target(next(h,pmesh),pmesh)); + Point_3_ref s = get(vpmap, target(next(opposite(h,pmesh),pmesh),pmesh)); if( (CGAL::ON_UNBOUNDED_SIDE != CGAL::side_of_bounded_sphere(p,q,r,s)) || (CGAL::ON_UNBOUNDED_SIDE != CGAL::side_of_bounded_sphere(p,q,s,r)) ) { @@ -111,11 +112,11 @@ private: vertex_descriptor vi = target(halfedge(fd,pmesh),pmesh); vertex_descriptor vj = target(next(halfedge(fd,pmesh),pmesh),pmesh); vertex_descriptor vk = target(prev(halfedge(fd,pmesh),pmesh),pmesh); - Point_3 c = CGAL::centroid(vpmap[vi], vpmap[vj], vpmap[vk]); + Point_3 c = CGAL::centroid(get(vpmap,vi), get(vpmap,vj), get(vpmap,vk)); double sac = (scale_attribute[vi] + scale_attribute[vj] + scale_attribute[vk])/3.0; - double dist_c_vi = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c,vpmap[vi]))); - double dist_c_vj = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, vpmap[vj]))); - double dist_c_vk = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, vpmap[vk]))); + double dist_c_vi = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, get(vpmap, vi)))); + double dist_c_vj = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, get(vpmap, vj)))); + double dist_c_vk = to_double(CGAL::approximate_sqrt(CGAL::squared_distance(c, get(vpmap, vk)))); if((alpha * dist_c_vi > sac) && (alpha * dist_c_vj > sac) && (alpha * dist_c_vk > sac) && @@ -205,7 +206,7 @@ private: const std::set& interior_map, bool accept_internal_facets) { - const Point_3& vp = vpmap[vh]; + const Point_3& vp = get(vpmap, vh); Halfedge_around_target_circulator circ(halfedge(vh,pmesh),pmesh), done(circ); int deg = 0; double sum = 0; @@ -217,7 +218,7 @@ private: { continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation } - const Point_3& vq = vpmap[target(opposite(*circ,pmesh),pmesh)]; + const Point_3& vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); sum += to_double(CGAL::approximate_sqrt(CGAL::squared_distance(vp, vq))); ++deg; } while(++circ != done); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 76687bfc123..49719380dc3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -104,13 +104,13 @@ public: { halfedge_descriptor v0, v1, v2, v3; v0 = halfedge(f, pmesh); - Point_ref p0 = _vpmap[target(v0, pmesh)]; + Point_ref p0 = get(_vpmap, target(v0, pmesh)); v1 = next(v0, pmesh); - Point_ref p1 = _vpmap[target(v1, pmesh)]; + Point_ref p1 = get(_vpmap, target(v1, pmesh)); v2 = next(v1, pmesh); - Point_ref p2 = _vpmap[target(v2, pmesh)]; + Point_ref p2 = get(_vpmap, target(v2, pmesh)); v3 = next(v2, pmesh); - Point_ref p3 = _vpmap[target(v3, pmesh)]; + Point_ref p3 = get(_vpmap, target(v3, pmesh)); /* Chooses the diagonal that will split the quad in two triangles that maximize * the scalar product of of the un-normalized normals of the two triangles. @@ -144,7 +144,7 @@ public: Tr_Vertex_handle previous, first; do { - Tr_Vertex_handle vh = cdt.insert(_vpmap[target(h, pmesh)]); + Tr_Vertex_handle vh = cdt.insert(get(_vpmap, target(h, pmesh))); if (first == Tr_Vertex_handle()) { first = vh; }