fix remaining point reference

This commit is contained in:
Sébastien Loriot 2017-12-12 14:41:41 +01:00
parent eac197b2cb
commit 6342f9a732
4 changed files with 46 additions and 43 deletions

View File

@ -251,8 +251,8 @@ class CatmullClark_mask_3 {
};
void edge_node(halfedge_descriptor edge, Point_3& pt) {
Point_3& p1 = get(vpm,target(edge, pmesh));
Point_3& p2 = get(vpm,source(edge, pmesh));
Point_3 p1 = get(vpm,target(edge, pmesh));
Point_3 p2 = get(vpm,source(edge, pmesh));
Point_3 f1, f2;
face_node(face(edge,pmesh), f1);
face_node(face(opposite(edge,pmesh),pmesh), f2);
@ -266,11 +266,11 @@ class CatmullClark_mask_3 {
typename boost::graph_traits<PolygonMesh>::degree_size_type n = degree(vertex,pmesh);
FT Q[] = {0.0, 0.0, 0.0}, R[] = {0.0, 0.0, 0.0};
Point_3& S = get(vpm,vertex);
Point_3 S = get(vpm,vertex);
Point_3 q;
for (int i = 0; i < n; i++, ++vcir) {
Point_3& p2 = get(vpm, target(opposite(*vcir,pmesh),pmesh));
Point_3 p2 = get(vpm, target(opposite(*vcir,pmesh),pmesh));
R[0] += (S[0]+p2[0])/2;
R[1] += (S[1]+p2[1])/2;
R[2] += (S[2]+p2[2])/2;
@ -454,15 +454,15 @@ is listed below, where `ept` returns the new point splitting
\code{.cpp}
void border_node(halfedge_descriptor edge, Point_3& ept, Point_3& vpt) {
Point_3& ep1 = get(vpm, target(edge, pmesh));
Point_3& ep2 = get(vpm, target(opposite(edge, pmesh), pmesh));
Point_3 ep1 = get(vpm, target(edge, pmesh));
Point_3 ep2 = get(vpm, target(opposite(edge, pmesh), pmesh));
ept = Point_3((ep1[0]+ep2[0])/2, (ep1[1]+ep2[1])/2, (ep1[2]+ep2[2])/2);
Halfedge_around_target_circulator<Poly> vcir(edge, pmesh);
Point_3& vp1 = get(vpm,target(opposite(*vcir, pmesh ), pmesh));
Point_3& vp0 = get(vpm, target(*vcir, pmesh));
Point_3 vp1 = get(vpm,target(opposite(*vcir, pmesh ), pmesh));
Point_3 vp0 = get(vpm, target(*vcir, pmesh));
--vcir;
Point_3& vp_1 = get(vpm, target(opposite(*vcir, pmesh), pmesh));
Point_3 vp_1 = get(vpm, target(opposite(*vcir, pmesh), pmesh));
vpt = Point_3((vp_1[0] + 6*vp0[0] + vp1[0])/8,
(vp_1[1] + 6*vp0[1] + vp1[1])/8,
(vp_1[2] + 6*vp0[2] + vp1[2])/8 );

View File

@ -28,6 +28,7 @@ class WLoop_mask_3 {
typedef typename boost::property_map<PolygonMesh, vertex_point_t>::type Vertex_pmap;
typedef typename boost::property_traits<Vertex_pmap>::value_type Point;
typedef typename boost::property_traits<Vertex_pmap>::reference Point_ref;
PolygonMesh& pmesh;
Vertex_pmap vpm;
@ -38,10 +39,10 @@ public:
{}
void edge_node(halfedge_descriptor hd, Point& pt) {
Point& p1 = get(vpm, target(hd,pmesh));
Point& p2 = get(vpm, target(opposite(hd,pmesh),pmesh));
Point& f1 = get(vpm, target(next(hd,pmesh),pmesh));
Point& f2 = get(vpm, target(next(opposite(hd,pmesh),pmesh),pmesh));
Point_ref p1 = get(vpm, target(hd,pmesh));
Point_ref p2 = get(vpm, target(opposite(hd,pmesh),pmesh));
Point_ref f1 = get(vpm, target(next(hd,pmesh),pmesh));
Point_ref f2 = get(vpm, target(next(opposite(hd,pmesh),pmesh),pmesh));
pt = Point((3*(p1[0]+p2[0])+f1[0]+f2[0])/8,
(3*(p1[1]+p2[1])+f1[1]+f2[1])/8,
@ -49,12 +50,12 @@ public:
}
void vertex_node(vertex_descriptor vd, Point& pt) {
double R[] = {0.0, 0.0, 0.0};
Point& S = get(vpm,vd);
Point_ref S = get(vpm,vd);
std::size_t n = 0;
BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_target(vd, pmesh)){
++n;
Point& p = get(vpm, target(opposite(hd,pmesh),pmesh));
Point_ref p = get(vpm, target(opposite(hd,pmesh),pmesh));
R[0] += p[0]; R[1] += p[1]; R[2] += p[2];
}
@ -72,15 +73,15 @@ public:
}
void border_node(halfedge_descriptor hd, Point& ept, Point& vpt) {
Point& ep1 = get(vpm, target(hd,pmesh));
Point& ep2 = get(vpm, target(opposite(hd,pmesh),pmesh));
Point_ref ep1 = get(vpm, target(hd,pmesh));
Point_ref ep2 = get(vpm, target(opposite(hd,pmesh),pmesh));
ept = Point((ep1[0]+ep2[0])/2, (ep1[1]+ep2[1])/2, (ep1[2]+ep2[2])/2);
Halfedge_around_target_circulator<Poly> vcir(hd,pmesh);
Point& vp1 = get(vpm, target(opposite(*vcir,pmesh),pmesh));
Point& vp0 = get(vpm, target(*vcir,pmesh));
Point_ref vp1 = get(vpm, target(opposite(*vcir,pmesh),pmesh));
Point_ref vp0 = get(vpm, target(*vcir,pmesh));
--vcir;
Point& vp_1 = get(vpm,target(opposite(*vcir,pmesh),pmesh));
Point_ref vp_1 = get(vpm,target(opposite(*vcir,pmesh),pmesh));
vpt = Point((vp_1[0] + 6*vp0[0] + vp1[0])/8,
(vp_1[1] + 6*vp0[1] + vp1[1])/8,
(vp_1[2] + 6*vp0[2] + vp1[2])/8 );

View File

@ -118,8 +118,8 @@ public:
}
void edge_node(halfedge_descriptor edge, Point& pt) {
const Point_ref p1 = get(this->vpmap, target(edge, *(this->pmesh)));
const Point_ref p2 = get(this->vpmap, source(edge, *(this->pmesh)));
Point_ref p1 = get(this->vpmap, target(edge, *(this->pmesh)));
Point_ref p2 = get(this->vpmap, source(edge, *(this->pmesh)));
pt = Point((p1[0]+p2[0])/2, (p1[1]+p2[1])/2, (p1[2]+p2[2])/2);
}
@ -200,8 +200,8 @@ public:
/// computes the Catmull-Clark edge-point `pt` of the edge `edge`.
void edge_node(halfedge_descriptor edge, Point& pt) {
const Point& p1 = get(this->vpmap,target(edge, *(this->pmesh)));
const Point& p2 = get(this->vpmap,source(edge, *(this->pmesh)));
Point_ref p1 = get(this->vpmap,target(edge, *(this->pmesh)));
Point_ref p2 = get(this->vpmap,source(edge, *(this->pmesh)));
Point f1, f2;
this->face_node(face(edge, *(this->pmesh)), f1);
this->face_node(face(opposite(edge, *(this->pmesh)), *(this->pmesh)), f2);
@ -216,11 +216,11 @@ public:
typename boost::graph_traits<Mesh>::degree_size_type n = degree(vertex, *(this->pmesh));
FT Q[] = {0.0, 0.0, 0.0}, R[] = {0.0, 0.0, 0.0};
const Point_ref S = get(this->vpmap,vertex);
Point_ref S = get(this->vpmap,vertex);
Point q;
for (typename boost::graph_traits<Mesh>::degree_size_type i = 0; i < n; i++, ++vcir) {
const Point& p2 = get(this->vpmap, target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
Point_ref p2 = get(this->vpmap, target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
R[0] += (S[0] + p2[0]) / 2;
R[1] += (S[1] + p2[1]) / 2;
R[2] += (S[2] + p2[2]) / 2;
@ -240,15 +240,15 @@ public:
/// computes the Catmull-Clark edge-point `ept` and the Catmull-Clark
/// vertex-point `vpt` of the border edge `edge`.
void border_node(halfedge_descriptor edge, Point& ept, Point& vpt) {
const Point& ep1 = get(this->vpmap,target(edge, *(this->pmesh)));
const Point& ep2 = get(this->vpmap,target(opposite(edge, *(this->pmesh)), *(this->pmesh)));
Point_ref ep1 = get(this->vpmap,target(edge, *(this->pmesh)));
Point_ref ep2 = get(this->vpmap,target(opposite(edge, *(this->pmesh)), *(this->pmesh)));
ept = Point((ep1[0]+ep2[0])/2, (ep1[1]+ep2[1])/2, (ep1[2]+ep2[2])/2);
Halfedge_around_target_circulator<Mesh> vcir(edge, *(this->pmesh));
const Point& vp1 = get(this->vpmap,target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
const Point& vp0 = get(this->vpmap, target(*vcir, *(this->pmesh)));
Point_ref vp1 = get(this->vpmap,target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
Point_ref vp0 = get(this->vpmap, target(*vcir, *(this->pmesh)));
--vcir;
const Point& vp_1 = get(this->vpmap, target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
Point_ref vp_1 = get(this->vpmap, target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
vpt = Point((vp_1[0] + 6*vp0[0] + vp1[0])/8,
(vp_1[1] + 6*vp0[1] + vp1[1])/8,
(vp_1[2] + 6*vp0[2] + vp1[2])/8 );
@ -299,6 +299,7 @@ public:
typedef typename Base::FT FT;
typedef typename Base::Point Point;
typedef typename Base::Vector Vector;
typedef typename boost::property_traits<VertexPointMap>::reference Point_ref;
#endif
typedef Halfedge_around_face_circulator<Mesh> Halfedge_around_facet_circulator;
@ -326,10 +327,10 @@ public:
/// computes the Loop edge-point `pt` of the edge `edge`.
void edge_node(halfedge_descriptor edge, Point& pt) {
const Point& p1 = get(this->vpmap,target(edge, *(this->pmesh)));
const Point& p2 = get(this->vpmap,target(opposite(edge, *(this->pmesh)), *(this->pmesh)));
const Point& f1 = get(this->vpmap,target(next(edge, *(this->pmesh)), *(this->pmesh)));
const Point& f2 = get(this->vpmap,target(next(opposite(edge, *(this->pmesh)), *(this->pmesh)), *(this->pmesh)));
Point_ref p1 = get(this->vpmap,target(edge, *(this->pmesh)));
Point_ref p2 = get(this->vpmap,target(opposite(edge, *(this->pmesh)), *(this->pmesh)));
Point_ref f1 = get(this->vpmap,target(next(edge, *(this->pmesh)), *(this->pmesh)));
Point_ref f2 = get(this->vpmap,target(next(opposite(edge, *(this->pmesh)), *(this->pmesh)), *(this->pmesh)));
pt = Point((3*(p1[0]+p2[0])+f1[0]+f2[0])/8,
(3*(p1[1]+p2[1])+f1[1]+f2[1])/8,
@ -342,10 +343,10 @@ public:
size_t n = circulator_size(vcir);
FT R[] = {0.0, 0.0, 0.0};
const Point& S = get(this->vpmap,vertex);
Point_ref S = get(this->vpmap,vertex);
for (size_t i = 0; i < n; i++, ++vcir) {
const Point& p = get(this->vpmap,target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
Point_ref p = get(this->vpmap,target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
R[0] += p[0]; R[1] += p[1]; R[2] += p[2];
}
if (n == 6) {
@ -364,15 +365,15 @@ public:
/// computes the Loop edge-point `ept` and the Loop vertex-point `vpt` of the border edge `edge`.
void border_node(halfedge_descriptor edge, Point& ept, Point& vpt) {
const Point& ep1 = get(this->vpmap,target(edge, *(this->pmesh)));
const Point& ep2 = get(this->vpmap,target(opposite(edge, *(this->pmesh)), *(this->pmesh)));
Point_ref ep1 = get(this->vpmap,target(edge, *(this->pmesh)));
Point_ref ep2 = get(this->vpmap,target(opposite(edge, *(this->pmesh)), *(this->pmesh)));
ept = Point((ep1[0]+ep2[0])/2, (ep1[1]+ep2[1])/2, (ep1[2]+ep2[2])/2);
Halfedge_around_vertex_circulator vcir(edge, *(this->pmesh));
const Point& vp1 = get(this->vpmap,target(opposite(*vcir, *(this->pmesh) ), *(this->pmesh)));
const Point& vp0 = get(this->vpmap,target(*vcir, *(this->pmesh)));
Point_ref vp1 = get(this->vpmap,target(opposite(*vcir, *(this->pmesh) ), *(this->pmesh)));
Point_ref vp0 = get(this->vpmap,target(*vcir, *(this->pmesh)));
--vcir;
const Point& vp_1 = get(this->vpmap,target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
Point_ref vp_1 = get(this->vpmap,target(opposite(*vcir, *(this->pmesh)), *(this->pmesh)));
vpt = Point((vp_1[0] + 6*vp0[0] + vp1[0])/8,
(vp_1[1] + 6*vp0[1] + vp1[1])/8,
(vp_1[2] + 6*vp0[2] + vp1[2])/8 );
@ -460,6 +461,7 @@ public:
typedef typename Base::FT FT;
typedef typename Base::Point Point;
typedef typename Base::Vector Vector;
typedef typename boost::property_traits<VertexPointMap>::reference Point_ref;
#endif
public:

View File

@ -338,7 +338,7 @@ void test_Subdivision_surface_3_SM_NP() {
// some arbitrary new coordinates (different from the internal vpm)
BOOST_FOREACH(vertex_descriptor vd, vertices(P)) {
const Point& pt = get(vpm, vd);
boost::property_traits<VPM>::reference pt = get(vpm, vd);
Vector v = pt - Point(0., 0., -3.);
put(apm, vd, pt + 0.5*v);
}