added handy constructor with the base mesh to vertex/face marker functors

This commit is contained in:
Paolo Cignoni 2009-01-29 00:17:31 +00:00
parent 92f9a2026b
commit d41a88bfe5
1 changed files with 8 additions and 3 deletions

View File

@ -146,6 +146,7 @@ namespace vcg {
MESH_TYPE *m; MESH_TYPE *m;
public: public:
Tmark(){} Tmark(){}
Tmark( MESH_TYPE *m) {SetMesh(m);}
void UnMarkAll(){m->UnMarkAll();} void UnMarkAll(){m->UnMarkAll();}
bool IsMarked(OBJ_TYPE* obj){return (m->IsMarked(obj));} bool IsMarked(OBJ_TYPE* obj){return (m->IsMarked(obj));}
void Mark(OBJ_TYPE* obj){m->Mark(obj);} void Mark(OBJ_TYPE* obj){m->Mark(obj);}
@ -155,7 +156,11 @@ namespace vcg {
template <class MESH_TYPE> template <class MESH_TYPE>
class FaceTmark:public Tmark<MESH_TYPE,typename MESH_TYPE::FaceType> class FaceTmark:public Tmark<MESH_TYPE,typename MESH_TYPE::FaceType>
{}; {
public:
FaceTmark() {}
FaceTmark(MESH_TYPE *m) {this->SetMesh(m);}
};
template <class MESH_TYPE> template <class MESH_TYPE>
class VertTmark class VertTmark
@ -164,6 +169,7 @@ namespace vcg {
typedef typename MESH_TYPE::VertexType VertexType; typedef typename MESH_TYPE::VertexType VertexType;
VertTmark(){} VertTmark(){}
VertTmark(MESH_TYPE *){}
void UnMarkAll(){} void UnMarkAll(){}
bool IsMarked(VertexType*) { return false; } bool IsMarked(VertexType*) { return false; }
void Mark(VertexType*){} void Mark(VertexType*){}
@ -195,8 +201,7 @@ namespace vcg {
typedef Point3<ScalarType> Point3x; typedef Point3<ScalarType> Point3x;
typedef FaceTmark<MESH> MarkerFace; typedef FaceTmark<MESH> MarkerFace;
MarkerFace mf; MarkerFace mf(&mesh);
mf.SetMesh(&mesh);
vcg::face::PointDistanceFunctor<ScalarType> FDistFunct; vcg::face::PointDistanceFunctor<ScalarType> FDistFunct;
_minDist=_maxDist; _minDist=_maxDist;
typename MESH::FaceType* bestf= gr.GetClosest(FDistFunct, mf, _p, _maxDist, _minDist, _closestPt); typename MESH::FaceType* bestf= gr.GetClosest(FDistFunct, mf, _p, _maxDist, _minDist, _closestPt);