Commit 0ebf091e authored by Jan Möbius's avatar Jan Möbius

Changed signature

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@641 fdac6126-5c0c-442c-9429-916003d36597
parent c7575e43
......@@ -114,7 +114,7 @@ void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f)
std::vector<VertexHandle*> empty_vh;
std::vector<HalfedgeHandle*> empty_hh;
std::vector<FaceHandle*> empty_fh;
garbage_collection( _v, _e, _f, &empty_vh,&empty_hh,&empty_fh);
garbage_collection( empty_vh,empty_hh,empty_fh,_v, _e, _f);
}
void ArrayKernel::clear()
......
......@@ -266,6 +266,9 @@ public:
* Usually if you delete primitives in OpenMesh, they are only flagged as deleted.
* Only when you call garbage collection, they will be actually removed.
*
* \note Garbage collection invalidates all handles. If you need to keep track of
* a set of handles, you can pass them to the second garbage collection
* function, which will update a vector of handles.
*
* @param _v Remove deleted vertices?
* @param _e Remove deleted edges?
......@@ -273,13 +276,15 @@ public:
*/
void garbage_collection(bool _v=true, bool _e=true, bool _f=true);
/** \brief garbage collection
/** \brief garbage collection with handle tracking
*
* Usually if you delete primitives in OpenMesh, they are only flagged as deleted.
* Only when you call garbage collection, they will be actually removed.
*
* \note Garbage collection invalidates all handles. If you need to keep track of
* a set of handles, you can pass vectors of pointers to the handles to this function
* a set of handles, you can pass them to this function and they will get updated.
*
*
*
* @param vh_to_update Vertex handles that should get updated
* @param hh_to_update Halfedge handles that should get updated
......@@ -291,10 +296,10 @@ public:
template<typename std_API_Container_VHandlePointer,
typename std_API_Container_HHandlePointer,
typename std_API_Container_FHandlePointer>
void garbage_collection(bool _v=true, bool _e=true, bool _f=true,
std_API_Container_VHandlePointer* vh_to_update = 0,
std_API_Container_HHandlePointer* hh_to_update = 0,
std_API_Container_FHandlePointer* fh_to_update = 0);
void garbage_collection(std_API_Container_VHandlePointer& vh_to_update,
std_API_Container_HHandlePointer& hh_to_update,
std_API_Container_FHandlePointer& fh_to_update,
bool _v=true, bool _e=true, bool _f=true);
void clear();
......
......@@ -56,11 +56,10 @@ namespace OpenMesh
template<typename std_API_Container_VHandlePointer,
typename std_API_Container_HHandlePointer,
typename std_API_Container_FHandlePointer>
void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f,
std_API_Container_VHandlePointer* vh_to_update,
std_API_Container_HHandlePointer* hh_to_update,
std_API_Container_FHandlePointer* fh_to_update
)
void ArrayKernel::garbage_collection(std_API_Container_VHandlePointer& vh_to_update,
std_API_Container_HHandlePointer& hh_to_update,
std_API_Container_FHandlePointer& fh_to_update,
bool _v, bool _e, bool _f)
{
int i, i0, i1, nV(n_vertices()), nE(n_edges()), nH(2*n_edges()), nF(n_faces());
......@@ -205,47 +204,37 @@ void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f,
}
}
// Update the vertex handles in the vertex handle vector
if ( vh_to_update ) {
const int vertexCount = vertices_.size();
typename std_API_Container_VHandlePointer::iterator v_it(vh_to_update->begin()), v_it_end(vh_to_update->end());
for(; v_it != v_it_end; ++v_it)
{
if ( (*v_it)->idx() >= vertexCount )
(*v_it)->invalidate();
else
*(*v_it) = vh_map[(*v_it)->idx()];
}
const int vertexCount = vertices_.size();
const int halfedgeCount = edges_.size() * 2;
const int faceCount = faces_.size();
// Update the vertex handles in the vertex handle vector
typename std_API_Container_VHandlePointer::iterator v_it(vh_to_update.begin()), v_it_end(vh_to_update.end());
for(; v_it != v_it_end; ++v_it)
{
if ( (*v_it)->idx() >= vertexCount )
(*v_it)->invalidate();
else
*(*v_it) = vh_map[(*v_it)->idx()];
}
// Update the halfedge handles in the halfedge handle vector
if ( hh_to_update ) {
const int halfedgeCount = edges_.size() * 2;
typename std_API_Container_HHandlePointer::iterator hh_it(hh_to_update->begin()), hh_it_end(hh_to_update->end());
for(; hh_it != hh_it_end; ++hh_it)
{
if ( (*hh_it)->idx() >= halfedgeCount )
(*hh_it)->invalidate();
else
*(*hh_it) = hh_map[(*hh_it)->idx()];
}
typename std_API_Container_HHandlePointer::iterator hh_it(hh_to_update.begin()), hh_it_end(hh_to_update.end());
for(; hh_it != hh_it_end; ++hh_it)
{
if ( (*hh_it)->idx() >= halfedgeCount )
(*hh_it)->invalidate();
else
*(*hh_it) = hh_map[(*hh_it)->idx()];
}
// Update the face handles in the face handle vector
if(fh_to_update) {
const int faceCount = faces_.size();
typename std_API_Container_FHandlePointer::iterator fh_it(fh_to_update->begin()), fh_it_end(fh_to_update->end());
for(; fh_it != fh_it_end; ++fh_it)
{
if ( (*fh_it)->idx() >= faceCount )
(*fh_it)->invalidate();
else
*(*fh_it) = fh_map[(*fh_it)->idx()];
}
typename std_API_Container_FHandlePointer::iterator fh_it(fh_to_update.begin()), fh_it_end(fh_to_update.end());
for(; fh_it != fh_it_end; ++fh_it)
{
if ( (*fh_it)->idx() >= faceCount )
(*fh_it)->invalidate();
else
*(*fh_it) = fh_map[(*fh_it)->idx()];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment