Added Add Edge, corrected bug in the assert in addFace

This commit is contained in:
Paolo Cignoni 2017-12-21 01:14:23 +01:00
parent 38ca45f71d
commit 975027bcf6
1 changed files with 15 additions and 5 deletions

View File

@ -347,6 +347,17 @@ public:
return ei; return ei;
} }
/** Function to add a single edge to the mesh. and initializing it with two indexes to the vertexes
*/
static EdgeIterator AddEdge(MeshType &m, size_t v0, size_t v1)
{
assert(v0!=v1);
assert(v0>=0 && v0<m.vert.size());
assert(v1>=0 && v1<m.vert.size());
return AddEdge(m,&(m.vert[v0]),&(m.vert[v1]));
}
/** Function to add a face to the mesh and initializing it with the three given coords /** Function to add a face to the mesh and initializing it with the three given coords
*/ */
static EdgeIterator AddEdge(MeshType &m, CoordType p0, CoordType p1) static EdgeIterator AddEdge(MeshType &m, CoordType p0, CoordType p1)
@ -501,9 +512,9 @@ public:
static FaceIterator AddFace(MeshType &m, size_t v0, size_t v1, size_t v2) static FaceIterator AddFace(MeshType &m, size_t v0, size_t v1, size_t v2)
{ {
assert((v0!=v1) && (v1!=v2) && (v0!=v2)); assert((v0!=v1) && (v1!=v2) && (v0!=v2));
assert(v0>=0 && v0<=m.vert.size()); assert(v0>=0 && v0<m.vert.size());
assert(v1>=0 && v1<=m.vert.size()); assert(v1>=0 && v1<m.vert.size());
assert(v2>=0 && v2<=m.vert.size()); assert(v2>=0 && v2<m.vert.size());
return AddFace(m,&(m.vert[v0]),&(m.vert[v1]),&(m.vert[v2])); return AddFace(m,&(m.vert[v0]),&(m.vert[v1]),&(m.vert[v2]));
} }
/** Function to add a face to the mesh and initializing it with the three given coords /** Function to add a face to the mesh and initializing it with the three given coords
@ -810,7 +821,6 @@ public:
assert((int)pos==m.vn); assert((int)pos==m.vn);
PermutateVertexVector(m, pu); PermutateVertexVector(m, pu);
} }
/*! \brief Wrapper without the PointerUpdater. */ /*! \brief Wrapper without the PointerUpdater. */
@ -868,7 +878,7 @@ public:
m.edge[ pu.remap[i] ].VEi(1) = m.edge[i].cVEi(1); m.edge[ pu.remap[i] ].VEi(1) = m.edge[i].cVEi(1);
} }
if(HasEEAdjacency(m)) if(HasEEAdjacency(m))
if (m.edge[i].cEEp(0)!=0) // if (m.edge[i].cEEp(0)!=0)
{ {
m.edge[ pu.remap[i] ].EEp(0) = m.edge[i].cEEp(0); m.edge[ pu.remap[i] ].EEp(0) = m.edge[i].cEEp(0);
m.edge[ pu.remap[i] ].EEi(0) = m.edge[i].cEEi(0); m.edge[ pu.remap[i] ].EEi(0) = m.edge[i].cEEi(0);