better comments
This commit is contained in:
parent
e362d54a25
commit
f036874693
|
@ -130,6 +130,10 @@ static void VoronoiColoring(MeshType &m, std::vector<VertexType *> &seedVec, boo
|
|||
tri::UpdateColor<MeshType>::VertexQualityRamp(m);
|
||||
}
|
||||
|
||||
// It associates the faces with a given vertex according to the vertex associations
|
||||
//
|
||||
// It READS the PerVertex attribute 'sources'
|
||||
// It WRITES the PerFace attribute 'sources'
|
||||
|
||||
static void FaceAssociateRegion(MeshType &m)
|
||||
{
|
||||
|
@ -141,7 +145,7 @@ static void FaceAssociateRegion(MeshType &m)
|
|||
std::vector<VertexPointer> vp(3);
|
||||
for(int i=0;i<3;++i) vp[i]=vertexSources[fi->V(i)];
|
||||
|
||||
for(int i=0;i<3;++i) // First try to assoiciate to the most reached vertex
|
||||
for(int i=0;i<3;++i) // First try to associate to the most reached vertex
|
||||
{
|
||||
if(vp[0]==vp[1] && vp[0]==vp[2]) faceSources[fi] = vp[0];
|
||||
else
|
||||
|
@ -165,7 +169,6 @@ static void FaceAssociateRegion(MeshType &m)
|
|||
for(int i=0;i<3;++i)
|
||||
vp[i]=faceSources[fi->FFp(i)];
|
||||
|
||||
int cnt[3]={0,0,0};
|
||||
if(vp[0]!=0 && (vp[0]==vp[1] || vp[0]==vp[2]))
|
||||
faceSources[fi] = vp[0];
|
||||
else if(vp[1]!=0 && (vp[1]==vp[2]))
|
||||
|
@ -179,12 +182,14 @@ static void FaceAssociateRegion(MeshType &m)
|
|||
while(unassCnt>0);
|
||||
}
|
||||
|
||||
// Select all the faces with a given source vertex <vp>
|
||||
// It reads the PerFace attribute 'sources'
|
||||
|
||||
static int FaceSelectAssociateRegion(MeshType &m, VertexPointer vp)
|
||||
{
|
||||
PerFacePointerHandle sources = tri::Allocator<MeshType>:: template GetPerFaceAttribute<VertexPointer> (m,"sources");
|
||||
assert(tri::Allocator<MeshType>::IsValidHandle(m,sources));
|
||||
tri::UpdateSelection<MeshType>::FaceClear(m);
|
||||
tri::UpdateSelection<MeshType>::VertexClear(m);
|
||||
tri::UpdateSelection<MeshType>::Clear(m);
|
||||
int selCnt=0;
|
||||
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
|
||||
{
|
||||
|
@ -197,15 +202,16 @@ static int FaceSelectAssociateRegion(MeshType &m, VertexPointer vp)
|
|||
return selCnt;
|
||||
}
|
||||
|
||||
// Given a seed, it selects all the faces that have at least one vertex sourced by the given VertexPointer.
|
||||
// vp can be null (it search for unreached faces...)
|
||||
// Given a seed <vp>, it selects all the faces that have the minimal distance vertex sourced by the given <vp>.
|
||||
// <vp> can be null (it search for unreached faces...)
|
||||
// returns the number of selected faces;
|
||||
//
|
||||
// It reads the PerVertex attribute 'sources'
|
||||
static int FaceSelectRegion(MeshType &m, VertexPointer vp)
|
||||
{
|
||||
PerVertexPointerHandle sources = tri::Allocator<MeshType>:: template GetPerVertexAttribute<VertexPointer> (m,"sources");
|
||||
assert(tri::Allocator<MeshType>::IsValidHandle(m,sources));
|
||||
tri::UpdateSelection<MeshType>::FaceClear(m);
|
||||
tri::UpdateSelection<MeshType>::VertexClear(m);
|
||||
tri::UpdateSelection<MeshType>::Clear(m);
|
||||
int selCnt=0;
|
||||
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
|
||||
{
|
||||
|
@ -366,6 +372,9 @@ static void TopologicalVertexColoring(MeshType &m, std::vector<VertexType *> &se
|
|||
|
||||
}
|
||||
|
||||
// Drastic Simplification algorithm.
|
||||
// Similar in philosopy to the classic grid clustering but using a voronoi partition instead of the regular grid.
|
||||
//
|
||||
// This function assumes that in the mOld mesh, for each vertex you have a quality that denotes the index of the cluster
|
||||
// mNew is created by collasping onto a single vertex all the vertices that lies in the same cluster.
|
||||
// Non degenerate triangles are preserved.
|
||||
|
@ -398,7 +407,7 @@ static void VoronoiClustering(MeshType &mOld, MeshType &mNew, std::vector<Vertex
|
|||
}
|
||||
}
|
||||
|
||||
};
|
||||
}; // end class VoronoiProcessing
|
||||
|
||||
} // end namespace tri
|
||||
} // end namespace vcg
|
||||
|
|
Loading…
Reference in New Issue