behaviour change: AddFaces and AddVertices return the vert.end() and face.end() if called with n==0.
Added AddVertices with local pointers to VertexPointer to update
This commit is contained in:
parent
2dc0c1e1dc
commit
1a9220ce98
|
@ -270,6 +270,7 @@ namespace vcg {
|
||||||
static VertexIterator AddVertices(MeshType &m,int n, PointerUpdater<VertexPointer> &pu)
|
static VertexIterator AddVertices(MeshType &m,int n, PointerUpdater<VertexPointer> &pu)
|
||||||
{
|
{
|
||||||
VertexIterator last;
|
VertexIterator last;
|
||||||
|
if(n == 0) return m.vert.end();
|
||||||
pu.Clear();
|
pu.Clear();
|
||||||
if(m.vert.empty()) pu.oldBase=0; // if the vector is empty we cannot find the last valid element
|
if(m.vert.empty()) pu.oldBase=0; // if the vector is empty we cannot find the last valid element
|
||||||
else {
|
else {
|
||||||
|
@ -309,12 +310,28 @@ namespace vcg {
|
||||||
return last;// deve restituire l'iteratore alla prima faccia aggiunta;
|
return last;// deve restituire l'iteratore alla prima faccia aggiunta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Function to add n vertices to the mesh.
|
||||||
|
First wrapper, with no parameters
|
||||||
|
*/
|
||||||
static VertexIterator AddVertices(MeshType &m, int n)
|
static VertexIterator AddVertices(MeshType &m, int n)
|
||||||
{
|
{
|
||||||
PointerUpdater<VertexPointer> pu;
|
PointerUpdater<VertexPointer> pu;
|
||||||
return AddVertices(m, n,pu);
|
return AddVertices(m, n,pu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Function to add n vertices to the mesh.
|
||||||
|
Second Wrapper, with a vector of vertex pointers to be updated.
|
||||||
|
*/
|
||||||
|
static VertexIterator AddVertices(MeshType &m, int n, std::vector<VertexPointer *> &local_vec)
|
||||||
|
{
|
||||||
|
PointerUpdater<VertexPointer> pu;
|
||||||
|
VertexIterator v_ret = AddVertices(m, n,pu);
|
||||||
|
|
||||||
|
typename std::vector<VertexPointer *>::iterator vi;
|
||||||
|
for(vi=local_vec.begin();vi!=local_vec.end();++vi)
|
||||||
|
pu.Update(**vi);
|
||||||
|
return v_ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,6 +365,7 @@ namespace vcg {
|
||||||
static FaceIterator AddFaces(MeshType &m, int n, PointerUpdater<FacePointer> &pu)
|
static FaceIterator AddFaces(MeshType &m, int n, PointerUpdater<FacePointer> &pu)
|
||||||
{
|
{
|
||||||
FaceIterator last;
|
FaceIterator last;
|
||||||
|
if(n == 0) return m.face.end();
|
||||||
pu.Clear();
|
pu.Clear();
|
||||||
if(m.face.empty()) {
|
if(m.face.empty()) {
|
||||||
pu.oldBase=0; // if the vector is empty we cannot find the last valid element
|
pu.oldBase=0; // if the vector is empty we cannot find the last valid element
|
||||||
|
|
Loading…
Reference in New Issue