diff --git a/vcg/complex/algorithms/inertia.h b/vcg/complex/algorithms/inertia.h index 868b90fe..2e8cfcaf 100644 --- a/vcg/complex/algorithms/inertia.h +++ b/vcg/complex/algorithms/inertia.h @@ -345,9 +345,9 @@ static void Covariance(const MeshType & m, vcg::Point3 & bary, vcg:: for(fi = m.face.begin(); fi != m.face.end(); ++fi) if(!(*fi).IsD()) { - const CoordType &P0 = (*fi).P(0); - const CoordType &P1 = (*fi).P(1); - const CoordType &P2 = (*fi).P(2); + const CoordType &P0 = (*fi).cP(0); + const CoordType &P1 = (*fi).cP(1); + const CoordType &P2 = (*fi).cP(2); CoordType n = ((P1-P0)^(P2-P0)); const float da = n.Norm(); n/=da*da; diff --git a/vcg/complex/algorithms/parametrization/distortion.h b/vcg/complex/algorithms/parametrization/distortion.h index 360c4995..dafa067b 100644 --- a/vcg/complex/algorithms/parametrization/distortion.h +++ b/vcg/complex/algorithms/parametrization/distortion.h @@ -49,9 +49,9 @@ namespace vcg { uv1=f->cWT(1).P(); uv2=f->cWT(2).P(); } else { - uv0=f->V(0)->T().P(); - uv1=f->V(1)->T().P(); - uv2=f->V(2)->T().P(); + uv0=f->cV(0)->T().P(); + uv1=f->cV(1)->T().P(); + uv2=f->cV(2)->T().P(); } ScalarType AreaUV=((uv1-uv0)^(uv2-uv0))/2.0; return AreaUV; @@ -60,7 +60,7 @@ namespace vcg { static ScalarType EdgeLenght3D(const FaceType *f,int e) { assert((e>=0)&&(e<3)); - ScalarType length=(f->P0(e)-f->P1(e)).Norm(); + ScalarType length=(f->cP0(e)-f->cP1(e)).Norm(); return (length); } @@ -117,9 +117,9 @@ namespace vcg { static ScalarType AngleRad3D(const FaceType *f,int e) { assert((e>=0)&&(e<3)); - CoordType p0=f->P((e+2)%3); - CoordType p1=f->P(e); - CoordType p2=f->P((e+1)%3); + CoordType p0=f->cP((e+2)%3); + CoordType p1=f->cP(e); + CoordType p2=f->cP((e+1)%3); typedef typename CoordType::ScalarType ScalarType; CoordType dir0=p2-p1; CoordType dir1=p0-p1; @@ -134,9 +134,9 @@ namespace vcg { uv1=f->cWT((e+0)%3).P(); uv2=f->cWT((e+1)%3).P(); } else { - uv0=f->V2(e)->T().P(); - uv1=f->V0(e)->T().P(); - uv2=f->V1(e)->T().P(); + uv0=f->cV2(e)->T().P(); + uv1=f->cV0(e)->T().P(); + uv2=f->cV1(e)->T().P(); } vcg::Point2 dir0=uv2-uv1; vcg::Point2 dir1=uv0-uv1; diff --git a/vcg/complex/complex.h b/vcg/complex/complex.h index bd857fbd..01ca188c 100644 --- a/vcg/complex/complex.h +++ b/vcg/complex/complex.h @@ -410,12 +410,12 @@ template inline int & IMark(MeshType & m){return m.imark;} /** \brief Check if the vertex incremental mark matches the one of the mesh. @param m the mesh containing the element @param v Vertex pointer */ -template inline bool IsMarked(MeshType & m, typename MeshType::ConstVertexPointer v ) { return v->IMark() == m.imark; } +template inline bool IsMarked(MeshType & m, typename MeshType::ConstVertexPointer v ) { return v->cIMark() == m.imark; } /** \brief Check if the face incremental mark matches the one of the mesh. @param m the mesh containing the element @param f Face pointer */ -template inline bool IsMarked( MeshType & m,typename MeshType::ConstFacePointer f ) { return f->IMark() == m.imark; } +template inline bool IsMarked( MeshType & m,typename MeshType::ConstFacePointer f ) { return f->cIMark() == m.imark; } /** \brief Set the vertex incremental mark of the vertex to the one of the mesh. @param m the mesh containing the element diff --git a/vcg/simplex/face/distance.h b/vcg/simplex/face/distance.h index 3a553353..bdaf94c6 100644 --- a/vcg/simplex/face/distance.h +++ b/vcg/simplex/face/distance.h @@ -69,21 +69,21 @@ namespace vcg { b0 = f.cEdge(1)[1]*(p[2] - f.cP(1)[2]) - f.cEdge(1)[2]*(p[1] - f.cP(1)[1]); if(b0<=0) { - b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); + b0 = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); if(dist>b0) { dist = b0; return true; } else return false; } b1 = f.cEdge(2)[1]*(p[2] - f.cP(2)[2]) - f.cEdge(2)[2]*(p[1] - f.cP(2)[1]); if(b1<=0) { - b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + b1 = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); if(dist>b1) { dist = b1; return true; } else return false; } b2 = f.cEdge(0)[1]*(p[2] - f.cP(0)[2]) - f.cEdge(0)[2]*(p[1] - f.cP(0)[1]); if(b2<=0) { - b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + b2 = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); if(dist>b2) { dist = b2; return true; } else return false; } @@ -92,10 +92,10 @@ namespace vcg { if( (b=std::min(b0,std::min(b1,b2)) ) < EPS*DoubleArea(f)) { ScalarType bt; - if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); - else if(b==b1) bt = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + if(b==b0) bt = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); + else if(b==b1) bt = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); else { assert(b==b2); - bt = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + bt = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); } if(dist>bt) { dist = bt; return true; } else return false; @@ -106,31 +106,31 @@ namespace vcg { b0 = f.cEdge(1)[2]*(p[0] - f.cP(1)[0]) - f.cEdge(1)[0]*(p[2] - f.cP(1)[2]); if(b0<=0) { - b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); + b0 = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); if(dist>b0) { dist = b0; return true; } else return false; } b1 = f.cEdge(2)[2]*(p[0] - f.cP(2)[0]) - f.cEdge(2)[0]*(p[2] - f.cP(2)[2]); if(b1<=0) { - b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + b1 = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); if(dist>b1) { dist = b1; return true; } else return false; } b2 = f.cEdge(0)[2]*(p[0] - f.cP(0)[0]) - f.cEdge(0)[0]*(p[2] - f.cP(0)[2]); if(b2<=0) { - b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + b2 = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); if(dist>b2) { dist = b2; return true; } else return false; } if( (b=math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; - if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); - else if(b==b1) bt = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + if(b==b0) bt = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); + else if(b==b1) bt = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); else { assert(b==b2); - bt = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + bt = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); } if(dist>bt) { dist = bt; return true; } else return false; @@ -141,31 +141,31 @@ namespace vcg { b0 = f.cEdge(1)[0]*(p[1] - f.cP(1)[1]) - f.cEdge(1)[1]*(p[0] - f.cP(1)[0]); if(b0<=0) { - b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); + b0 = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); if(dist>b0) { dist = b0; return true; } else return false; } b1 = f.cEdge(2)[0]*(p[1] - f.cP(2)[1]) - f.cEdge(2)[1]*(p[0] - f.cP(2)[0]); if(b1<=0) { - b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + b1 = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); if(dist>b1) { dist = b1; return true; } else return false; } b2 = f.cEdge(0)[0]*(p[1] - f.cP(0)[1]) - f.cEdge(0)[1]*(p[0] - f.cP(0)[0]); if(b2<=0) { - b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + b2 = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); if(dist>b2) { dist = b2; return true; } else return false; } if( (b=math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; - if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); - else if(b==b1) bt = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + if(b==b0) bt = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); + else if(b==b1) bt = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); else { assert(b==b2); - bt = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + bt = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); } if(dist>bt) { dist = bt; return true; } @@ -320,21 +320,21 @@ namespace vcg { b0 = fEdge[1][1]*(p[2] - f.cP(1)[2]) - fEdge[1][2]*(p[1] - f.cP(1)[1]); if(b0<=0) { - b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); + b0 = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); if(dist>b0) { dist = b0; return true; } else return false; } b1 = fEdge[2][1]*(p[2] - f.cP(2)[2]) - fEdge[2][2]*(p[1] - f.cP(2)[1]); if(b1<=0) { - b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + b1 = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); if(dist>b1) { dist = b1; return true; } else return false; } b2 = fEdge[0][1]*(p[2] - f.cP(0)[2]) - fEdge[0][2]*(p[1] - f.cP(0)[1]); if(b2<=0) { - b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + b2 = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); if(dist>b2) { dist = b2; return true; } else return false; } @@ -348,9 +348,9 @@ namespace vcg { if( (b=vcg::math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; - if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); - else if(b==b1) bt = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); - else if(b==b2) bt = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + if(b==b0) bt = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); + else if(b==b1) bt = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); + else if(b==b2) bt = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); //printf("Warning area:%g %g %g %g thr:%g bt:%g\n",Area(), b0,b1,b2,EPSILON*Area(),bt); if(dist>bt) { dist = bt; return true; } else return false; @@ -364,30 +364,30 @@ namespace vcg { b0 = fEdge[1][2]*(p[0] - f.cP(1)[0]) - fEdge[1][0]*(p[2] - f.cP(1)[2]); if(b0<=0) { - b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); + b0 = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); if(dist>b0) { dist = b0; return true; } else return false; } b1 = fEdge[2][2]*(p[0] - f.cP(2)[0]) - fEdge[2][0]*(p[2] - f.cP(2)[2]); if(b1<=0) { - b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + b1 = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); if(dist>b1) { dist = b1; return true; } else return false; } b2 = fEdge[0][2]*(p[0] - f.cP(0)[0]) - fEdge[0][0]*(p[2] - f.cP(0)[2]); if(b2<=0) { - b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + b2 = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); if(dist>b2) { dist = b2; return true; } else return false; } if( (b=vcg::math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; - if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); - else if(b==b1) bt = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); - else if(b==b2) bt = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + if(b==b0) bt = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); + else if(b==b1) bt = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); + else if(b==b2) bt = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); //printf("Warning area:%g %g %g %g thr:%g bt:%g\n",Area(), b0,b1,b2,EPSILON*Area(),bt); if(dist>bt) { dist = bt; return true; } else return false; @@ -401,30 +401,30 @@ namespace vcg { b0 = fEdge[1][0]*(p[1] - f.cP(1)[1]) - fEdge[1][1]*(p[0] - f.cP(1)[0]); if(b0<=0) { - b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); + b0 = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); if(dist>b0) { dist = b0; return true; } else return false; } b1 = fEdge[2][0]*(p[1] - f.cP(2)[1]) - fEdge[2][1]*(p[0] - f.cP(2)[0]); if(b1<=0) { - b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); + b1 = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); if(dist>b1) { dist = b1; return true; } else return false; } b2 = fEdge[0][0]*(p[1] - f.cP(0)[1]) - fEdge[0][1]*(p[0] - f.cP(0)[0]); if(b2<=0) { - b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + b2 = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); if(dist>b2) { dist = b2; return true; } else return false; } if( (b=vcg::math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; - if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); - else if(b==b1) bt = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); - else if(b==b2) bt = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); + if(b==b0) bt = PSDist(q,f.cV(1)->cP(),f.cV(2)->cP(),p); + else if(b==b1) bt = PSDist(q,f.cV(2)->cP(),f.cV(0)->cP(),p); + else if(b==b2) bt = PSDist(q,f.cV(0)->cP(),f.cV(1)->cP(),p); //printf("Warning area:%g %g %g %g thr:%g bt:%g\n",Area(), b0,b1,b2,EPSILON*Area(),bt); if(dist>bt) { dist = bt; return true; } diff --git a/vcg/simplex/vertex/distance.h b/vcg/simplex/vertex/distance.h index f3e437d1..66700b43 100644 --- a/vcg/simplex/vertex/distance.h +++ b/vcg/simplex/vertex/distance.h @@ -62,12 +62,12 @@ template const Point3 fp = Point3::Construct(p); typename VERTEXTYPE::ScalarType md; // distance between v and fp - md = (v.P() - fp).Norm(); + md = (v.cP() - fp).Norm(); if (md <= minDist) { minDist = (SCALARTYPE)(md); // minDist is updated to the closest distance - q = v.P(); // q is the current closest point + q = v.cP(); // q is the current closest point return true; } diff --git a/vcg/space/intersection3.h b/vcg/space/intersection3.h index 449d54a2..ad9aae22 100644 --- a/vcg/space/intersection3.h +++ b/vcg/space/intersection3.h @@ -282,12 +282,13 @@ namespace vcg { Segment3 & sg) { typedef typename TRIANGLETYPE::ScalarType T; - if(IntersectionPlaneSegment(pl,Segment3(tr.P(0),tr.P(1)),sg.P0())){ - if(IntersectionPlaneSegment(pl,Segment3(tr.P(0),tr.P(2)),sg.P1())) + if(IntersectionPlaneSegment(pl,Segment3(tr.cP(0),tr.cP(1)),sg.P0())) + { + if(IntersectionPlaneSegment(pl,Segment3(tr.cP(0),tr.cP(2)),sg.P1())) return true; else { - if(IntersectionPlaneSegment(pl,Segment3(tr.P(1),tr.P(2)),sg.P1())) + if(IntersectionPlaneSegment(pl,Segment3(tr.cP(1),tr.cP(2)),sg.P1())) return true; else assert(0); return true; @@ -295,9 +296,9 @@ namespace vcg { } else { - if(IntersectionPlaneSegment(pl,Segment3(tr.P(1),tr.P(2)),sg.P0())) + if(IntersectionPlaneSegment(pl,Segment3(tr.cP(1),tr.cP(2)),sg.P0())) { - if(IntersectionPlaneSegment(pl,Segment3(tr.P(0),tr.P(2)),sg.P1()))return true; + if(IntersectionPlaneSegment(pl,Segment3(tr.cP(0),tr.cP(2)),sg.P1()))return true; assert(0); return true; } @@ -305,12 +306,12 @@ namespace vcg { return false; } - /// intersection between two triangles - template + /// intersection between two triangles + template inline bool IntersectionTriangleTriangle(const TRIANGLETYPE & t0,const TRIANGLETYPE & t1){ - return NoDivTriTriIsect(t0.P0(0),t0.P0(1),t0.P0(2), - t1.P0(0),t1.P0(1),t1.P0(2)); - } + return NoDivTriTriIsect(t0.cP(0),t0.cP(1),t0.cP(2), + t1.cP(0),t1.cP(1),t1.cP(2)); + } template inline bool IntersectionTriangleTriangle(Point3 V0,Point3 V1,Point3 V2, @@ -608,7 +609,7 @@ bool IntersectionSegmentTriangle( const vcg::Segment3 @@ -727,10 +728,10 @@ public: ScalarType u; ScalarType v; - bool bret = IntersectionRayTriangle(ray, Point3::Construct(f.P(0)), Point3::Construct(f.P(1)), Point3::Construct(f.P(2)), t, u, v); + bool bret = IntersectionRayTriangle(ray, Point3::Construct(f.cP(0)), Point3::Construct(f.cP(1)), Point3::Construct(f.cP(2)), t, u, v); if (BACKFACETEST) { if (!bret) { - bret = IntersectionRayTriangle(ray, Point3::Construct(f.P(0)), Point3::Construct(f.P(2)), Point3::Construct(f.P(1)), t, u, v); + bret = IntersectionRayTriangle(ray, Point3::Construct(f.cP(0)), Point3::Construct(f.cP(2)), Point3::Construct(f.cP(1)), t, u, v); } } return (bret);