Significant change of names to the UpdateSelection Class.

now follows the standard VertexClear instead of ClearVertex.
Updated all the other files of vcg using it...

(added also selection stuff for edges..)
This commit is contained in:
Paolo Cignoni 2011-12-13 10:07:00 +00:00
parent 5ec7fc1e4a
commit ae58754015
4 changed files with 43 additions and 26 deletions

View File

@ -785,7 +785,7 @@ private:
assert(tri::HasEEAdjacency(m)); assert(tri::HasEEAdjacency(m));
tri::UpdateTopology<MeshType>::EdgeEdge(m); tri::UpdateTopology<MeshType>::EdgeEdge(m);
if(SelectFlag) UpdateSelection<MeshType>::ClearVertex(m); if(SelectFlag) UpdateSelection<MeshType>::VertexClear(m);
int nonManifoldCnt=0; int nonManifoldCnt=0;
SimpleTempData<typename MeshType::VertContainer, int > TD(m.vert,0); SimpleTempData<typename MeshType::VertContainer, int > TD(m.vert,0);
@ -828,8 +828,8 @@ private:
UpdateFlags<MeshType>::FaceClear(m,nmfBit[0]+nmfBit[1]+nmfBit[2]); UpdateFlags<MeshType>::FaceClear(m,nmfBit[0]+nmfBit[1]+nmfBit[2]);
if(SelectFlag){ if(SelectFlag){
UpdateSelection<MeshType>::ClearVertex(m); UpdateSelection<MeshType>::VertexClear(m);
UpdateSelection<MeshType>::ClearFace(m); UpdateSelection<MeshType>::FaceClear(m);
} }
assert(tri::HasFFAdjacency(m)); assert(tri::HasFFAdjacency(m));
@ -872,7 +872,7 @@ private:
static int CountNonManifoldVertexFF( MeshType & m, bool selectVert = true ) static int CountNonManifoldVertexFF( MeshType & m, bool selectVert = true )
{ {
assert(tri::HasFFAdjacency(m)); assert(tri::HasFFAdjacency(m));
if(selectVert) UpdateSelection<MeshType>::ClearVertex(m); if(selectVert) UpdateSelection<MeshType>::VertexClear(m);
int nonManifoldCnt=0; int nonManifoldCnt=0;
SimpleTempData<typename MeshType::VertContainer, int > TD(m.vert,0); SimpleTempData<typename MeshType::VertContainer, int > TD(m.vert,0);

View File

@ -358,7 +358,7 @@ class Clustering
void SelectPointSet(MeshType &m) void SelectPointSet(MeshType &m)
{ {
typename STDEXT::hash_map<HashedPoint3i,CellType>::iterator gi; typename STDEXT::hash_map<HashedPoint3i,CellType>::iterator gi;
UpdateSelection<MeshType>::ClearVertex(m); UpdateSelection<MeshType>::VertexClear(m);
for(gi=GridCell.begin();gi!=GridCell.end();++gi) for(gi=GridCell.begin();gi!=GridCell.end();++gi)
{ {
VertexType *ptr=(*gi).second.Ptr(); VertexType *ptr=(*gi).second.Ptr();

View File

@ -118,12 +118,13 @@ typedef typename MeshType::ScalarType ScalarType;
typedef typename MeshType::VertexType VertexType; typedef typename MeshType::VertexType VertexType;
typedef typename MeshType::VertexPointer VertexPointer; typedef typename MeshType::VertexPointer VertexPointer;
typedef typename MeshType::VertexIterator VertexIterator; typedef typename MeshType::VertexIterator VertexIterator;
typedef typename MeshType::EdgeIterator EdgeIterator;
typedef typename MeshType::FaceType FaceType; typedef typename MeshType::FaceType FaceType;
typedef typename MeshType::FacePointer FacePointer; typedef typename MeshType::FacePointer FacePointer;
typedef typename MeshType::FaceIterator FaceIterator; typedef typename MeshType::FaceIterator FaceIterator;
typedef typename vcg::Box3<ScalarType> Box3Type; typedef typename vcg::Box3<ScalarType> Box3Type;
static size_t AllVertex(MeshType &m) static size_t VertexAll(MeshType &m)
{ {
VertexIterator vi; VertexIterator vi;
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) for(vi = m.vert.begin(); vi != m.vert.end(); ++vi)
@ -131,15 +132,22 @@ static size_t AllVertex(MeshType &m)
return m.vn; return m.vn;
} }
static size_t AllFace(MeshType &m) static size_t EdgeAll(MeshType &m)
{
EdgeIterator ei;
for(ei = m.edge.begin(); ei != m.edge.end(); ++ei)
if( !(*ei).IsD() ) (*ei).SetS();
return m.fn;
}
static size_t FaceAll(MeshType &m)
{ {
FaceIterator fi; FaceIterator fi;
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(fi = m.face.begin(); fi != m.face.end(); ++fi)
if( !(*fi).IsD() ) (*fi).SetS(); if( !(*fi).IsD() ) (*fi).SetS();
return m.fn; return m.fn;
} }
static size_t ClearVertex(MeshType &m) static size_t VertexClear(MeshType &m)
{ {
VertexIterator vi; VertexIterator vi;
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) for(vi = m.vert.begin(); vi != m.vert.end(); ++vi)
@ -147,7 +155,15 @@ static size_t ClearVertex(MeshType &m)
return 0; return 0;
} }
static size_t ClearFace(MeshType &m) static size_t EdgeClear(MeshType &m)
{
EdgeIterator ei;
for(ei = m.edge.begin(); ei != m.edge.end(); ++ei)
if( !(*ei).IsD() ) (*ei).ClearS();
return 0;
}
static size_t FaceClear(MeshType &m)
{ {
FaceIterator fi; FaceIterator fi;
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(fi = m.face.begin(); fi != m.face.end(); ++fi)
@ -157,11 +173,12 @@ static size_t ClearFace(MeshType &m)
static void Clear(MeshType &m) static void Clear(MeshType &m)
{ {
ClearVertex(m); VertexClear(m);
ClearFace(m); EdgeClear(m);
FaceClear(m);
} }
static size_t CountFace(MeshType &m) static size_t FaceCount(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
FaceIterator fi; FaceIterator fi;
@ -170,7 +187,7 @@ static size_t CountFace(MeshType &m)
return selCnt; return selCnt;
} }
static size_t CountVertex(MeshType &m) static size_t VertexCount(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
VertexIterator vi; VertexIterator vi;
@ -179,7 +196,7 @@ static size_t CountVertex(MeshType &m)
return selCnt; return selCnt;
} }
static size_t InvertFace(MeshType &m) static size_t FaceInvert(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
FaceIterator fi; FaceIterator fi;
@ -195,7 +212,7 @@ static size_t InvertFace(MeshType &m)
return selCnt; return selCnt;
} }
static size_t InvertVertex(MeshType &m) static size_t VertexInvert(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
VertexIterator vi; VertexIterator vi;
@ -215,7 +232,7 @@ static size_t InvertVertex(MeshType &m)
static size_t VertexFromFaceLoose(MeshType &m) static size_t VertexFromFaceLoose(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearVertex(m); VertexClear(m);
FaceIterator fi; FaceIterator fi;
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(fi = m.face.begin(); fi != m.face.end(); ++fi)
if( !(*fi).IsD() && (*fi).IsS()) if( !(*fi).IsD() && (*fi).IsS())
@ -249,7 +266,7 @@ static size_t VertexFromFaceStrict(MeshType &m)
static size_t FaceFromVertexStrict(MeshType &m) static size_t FaceFromVertexStrict(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearFace(m); FaceClear(m);
FaceIterator fi; FaceIterator fi;
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(fi = m.face.begin(); fi != m.face.end(); ++fi)
if( !(*fi).IsD()) if( !(*fi).IsD())
@ -267,7 +284,7 @@ static size_t FaceFromVertexStrict(MeshType &m)
static size_t FaceFromVertexLoose(MeshType &m) static size_t FaceFromVertexLoose(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearFace(m); FaceClear(m);
FaceIterator fi; FaceIterator fi;
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(fi = m.face.begin(); fi != m.face.end(); ++fi)
if( !(*fi).IsD() && !(*fi).IsS()) if( !(*fi).IsD() && !(*fi).IsS())
@ -284,7 +301,7 @@ static size_t FaceFromVertexLoose(MeshType &m)
static size_t VertexFromBorderFlag(MeshType &m) static size_t VertexFromBorderFlag(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearVertex(m); VertexClear(m);
VertexIterator vi; VertexIterator vi;
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) for(vi = m.vert.begin(); vi != m.vert.end(); ++vi)
if( !(*vi).IsD() ) if( !(*vi).IsD() )
@ -302,7 +319,7 @@ static size_t VertexFromBorderFlag(MeshType &m)
static size_t FaceFromBorderFlag(MeshType &m) static size_t FaceFromBorderFlag(MeshType &m)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearFace(m); FaceClear(m);
FaceIterator fi; FaceIterator fi;
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(fi = m.face.begin(); fi != m.face.end(); ++fi)
if( !(*fi).IsD() ) if( !(*fi).IsD() )
@ -377,7 +394,7 @@ static size_t FaceConnectedFF(MeshType &m)
static size_t FaceFromQualityRange(MeshType &m,float minq, float maxq) static size_t FaceFromQualityRange(MeshType &m,float minq, float maxq)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearFace(m); FaceClear(m);
FaceIterator fi; FaceIterator fi;
assert(HasPerFaceQuality(m)); assert(HasPerFaceQuality(m));
for(fi=m.face.begin();fi!=m.face.end();++fi) for(fi=m.face.begin();fi!=m.face.end();++fi)
@ -396,7 +413,7 @@ static size_t FaceFromQualityRange(MeshType &m,float minq, float maxq)
static size_t VertexFromQualityRange(MeshType &m,float minq, float maxq) static size_t VertexFromQualityRange(MeshType &m,float minq, float maxq)
{ {
size_t selCnt=0; size_t selCnt=0;
ClearVertex(m); VertexClear(m);
VertexIterator vi; VertexIterator vi;
assert(HasPerVertexQuality(m)); assert(HasPerVertexQuality(m));
for(vi=m.vert.begin();vi!=m.vert.end();++vi) for(vi=m.vert.begin();vi!=m.vert.end();++vi)

View File

@ -133,8 +133,8 @@ static void SelectRegion(MeshType &m, VertexPointer vp)
{ {
PerVertexPointerHandle sources = tri::Allocator<MeshType>:: template GetPerVertexAttribute<VertexPointer> (m,"sources"); PerVertexPointerHandle sources = tri::Allocator<MeshType>:: template GetPerVertexAttribute<VertexPointer> (m,"sources");
assert(tri::Allocator<MeshType>::IsValidHandle(m,sources)); assert(tri::Allocator<MeshType>::IsValidHandle(m,sources));
tri::UpdateSelection<MeshType>::ClearFace(m); tri::UpdateSelection<MeshType>::FaceClear(m);
tri::UpdateSelection<MeshType>::ClearVertex(m); tri::UpdateSelection<MeshType>::VertexClear(m);
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
{ {