Merge pull request #1682 from sloriot/PMP-use_readable_pmap_api

Use readable property map API
This commit is contained in:
Laurent Rineau 2016-12-02 11:33:54 +01:00
commit e559968307
4 changed files with 21 additions and 20 deletions

View File

@ -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

View File

@ -92,7 +92,7 @@ private:
matrix.add_coef(row_id, col_id, multiplier);
}
else {
typename boost::property_traits<VertexPointMap>::reference p = ppmap[v];
typename boost::property_traits<VertexPointMap>::reference p = get(ppmap, v);
x += multiplier * - to_double(p.x());
y += multiplier * - to_double(p.y());
z += multiplier * - to_double(p.z());

View File

@ -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<VertexPointMap>::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<face_descriptor>& interior_map,
bool accept_internal_facets)
{
const Point_3& vp = vpmap[vh];
const Point_3& vp = get(vpmap, vh);
Halfedge_around_target_circulator<PolygonMesh> 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);

View File

@ -103,13 +103,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.
@ -143,7 +143,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;
}