Improved comment/documentation. Changed throws in require

This commit is contained in:
Paolo Cignoni 2013-03-13 14:00:29 +00:00
parent 9e45730d93
commit 6950be4594
1 changed files with 41 additions and 41 deletions

View File

@ -215,7 +215,7 @@ static void AllocateEdge(MeshType &m)
/// \brief Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges. /// \brief Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges.
static void FaceFace(MeshType &m) static void FaceFace(MeshType &m)
{ {
if(!HasFFAdjacency(m)) throw vcg::MissingComponentException("FFAdjacency"); RequireFFAdjacency(m);
if( m.fn == 0 ) return; if( m.fn == 0 ) return;
std::vector<PEdge> e; std::vector<PEdge> e;
@ -258,22 +258,22 @@ static void FaceFace(MeshType &m)
/// \brief Update the Vertex-Face topological relation. /// \brief Update the Vertex-Face topological relation.
/** /**
The function allows to retrieve for each vertex the list of faces sharing this vertex. The function allows to retrieve for each vertex the list of faces sharing this vertex.
After this call all the VF component are initialized. Isolated vertices have a null list of faces.
\sa vcg::vertex::VFAdj
\sa vcg::face::VFAdj
*/ */
static void VertexFace(MeshType &m) static void VertexFace(MeshType &m)
{ {
if(!HasVFAdjacency(m)) throw vcg::MissingComponentException("VFAdjacency"); RequireVFAdjacency(m);
VertexIterator vi; for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
FaceIterator fi;
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
{ {
(*vi).VFp() = 0; (*vi).VFp() = 0;
(*vi).VFi() = 0; (*vi).VFi() = 0; // note that (0,-1) means uninitiazlied while 0,0 is the valid initialized values for isolated vertices.
} }
for(fi=m.face.begin();fi!=m.face.end();++fi) for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
if( ! (*fi).IsD() ) if( ! (*fi).IsD() )
{ {
for(int j=0;j<(*fi).VN();++j) for(int j=0;j<(*fi).VN();++j)
@ -346,14 +346,14 @@ In other words F1->FFp(i) == F2 iff F1 and F2 have the same tex coords along edg
static void FaceFaceFromTexCoord(MeshType &m) static void FaceFaceFromTexCoord(MeshType &m)
{ {
if(!HasPerWedgeTexCoord(m)) throw vcg::MissingComponentException("PerWedgeTexCoord"); RequireFFAdjacency(m);
if(!HasFFAdjacency(m)) throw vcg::MissingComponentException("FFAdjacency"); RequirePerFaceWedgeTexCoord(m);
std::vector<PEdgeTex> e; std::vector<PEdgeTex> e;
FaceIterator pf; FaceIterator pf;
typename std::vector<PEdgeTex>::iterator p; typename std::vector<PEdgeTex>::iterator p;
if( m.fn == 0 ) return; if( m.fn == 0 ) return;
// e.resize(m.fn*3); // Alloco il vettore ausiliario // e.resize(m.fn*3); // Alloco il vettore ausiliario
FaceIterator fi; FaceIterator fi;
@ -416,7 +416,7 @@ static void FaceFaceFromTexCoord(MeshType &m)
/// \brief Test correctness of VFtopology /// \brief Test correctness of VFtopology
static void TestVertexFace(MeshType &m) static void TestVertexFace(MeshType &m)
{ {
SimpleTempData<typename MeshType::VertContainer, int > numVertex(m.vert,0); SimpleTempData<typename MeshType::VertContainer, int > numVertex(m.vert,0);
assert(tri::HasPerVertexVFAdjacency(m)); assert(tri::HasPerVertexVFAdjacency(m));
@ -464,11 +464,11 @@ static void TestFaceFace(MeshType &m)
assert(HasFFAdjacency(m)); assert(HasFFAdjacency(m));
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
{ {
if (!fi->IsD()) if (!fi->IsD())
{ {
for (int i=0;i<(*fi).VN();i++) for (int i=0;i<(*fi).VN();i++)
{ {
FaceType *ffpi=fi->FFp(i); FaceType *ffpi=fi->FFp(i);
int e=fi->FFi(i); int e=fi->FFi(i);
//invariant property of FF topology for two manifold meshes //invariant property of FF topology for two manifold meshes
@ -485,7 +485,7 @@ static void TestFaceFace(MeshType &m)
assert( (ffv0i==v0i) || (ffv0i==v1i) ); assert( (ffv0i==v0i) || (ffv0i==v1i) );
assert( (ffv1i==v0i) || (ffv1i==v1i) ); assert( (ffv1i==v0i) || (ffv1i==v1i) );
} }
} }
} }
@ -521,7 +521,7 @@ inline bool operator != ( const PVertexEdge & pe ) const { return ( v!=pe.v );
static void EdgeEdge(MeshType &m) static void EdgeEdge(MeshType &m)
{ {
if(!HasEEAdjacency(m)) throw vcg::MissingComponentException("EEAdjacency"); RequireEEAdjacency(m);
std::vector<PVertexEdge> v; std::vector<PVertexEdge> v;
if( m.en == 0 ) return; if( m.en == 0 ) return;
@ -573,7 +573,7 @@ static void EdgeEdge(MeshType &m)
static void VertexEdge(MeshType &m) static void VertexEdge(MeshType &m)
{ {
if(!HasVEAdjacency(m)) throw vcg::MissingComponentException("VEAdjacency"); RequireVEAdjacency(m);
VertexIterator vi; VertexIterator vi;
EdgeIterator ei; EdgeIterator ei;