Changed signature
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@641 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -114,7 +114,7 @@ void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f)
|
|||||||
std::vector<VertexHandle*> empty_vh;
|
std::vector<VertexHandle*> empty_vh;
|
||||||
std::vector<HalfedgeHandle*> empty_hh;
|
std::vector<HalfedgeHandle*> empty_hh;
|
||||||
std::vector<FaceHandle*> empty_fh;
|
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()
|
void ArrayKernel::clear()
|
||||||
|
|||||||
@@ -266,6 +266,9 @@ public:
|
|||||||
* Usually if you delete primitives in OpenMesh, they are only flagged as deleted.
|
* Usually if you delete primitives in OpenMesh, they are only flagged as deleted.
|
||||||
* Only when you call garbage collection, they will be actually removed.
|
* 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 _v Remove deleted vertices?
|
||||||
* @param _e Remove deleted edges?
|
* @param _e Remove deleted edges?
|
||||||
@@ -273,13 +276,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void garbage_collection(bool _v=true, bool _e=true, bool _f=true);
|
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.
|
* Usually if you delete primitives in OpenMesh, they are only flagged as deleted.
|
||||||
* Only when you call garbage collection, they will be actually removed.
|
* Only when you call garbage collection, they will be actually removed.
|
||||||
*
|
*
|
||||||
* \note Garbage collection invalidates all handles. If you need to keep track of
|
* \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 vh_to_update Vertex handles that should get updated
|
||||||
* @param hh_to_update Halfedge 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,
|
template<typename std_API_Container_VHandlePointer,
|
||||||
typename std_API_Container_HHandlePointer,
|
typename std_API_Container_HHandlePointer,
|
||||||
typename std_API_Container_FHandlePointer>
|
typename std_API_Container_FHandlePointer>
|
||||||
void garbage_collection(bool _v=true, bool _e=true, bool _f=true,
|
void garbage_collection(std_API_Container_VHandlePointer& vh_to_update,
|
||||||
std_API_Container_VHandlePointer* vh_to_update = 0,
|
std_API_Container_HHandlePointer& hh_to_update,
|
||||||
std_API_Container_HHandlePointer* hh_to_update = 0,
|
std_API_Container_FHandlePointer& fh_to_update,
|
||||||
std_API_Container_FHandlePointer* fh_to_update = 0);
|
bool _v=true, bool _e=true, bool _f=true);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|||||||
@@ -56,11 +56,10 @@ namespace OpenMesh
|
|||||||
template<typename std_API_Container_VHandlePointer,
|
template<typename std_API_Container_VHandlePointer,
|
||||||
typename std_API_Container_HHandlePointer,
|
typename std_API_Container_HHandlePointer,
|
||||||
typename std_API_Container_FHandlePointer>
|
typename std_API_Container_FHandlePointer>
|
||||||
void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f,
|
void ArrayKernel::garbage_collection(std_API_Container_VHandlePointer& vh_to_update,
|
||||||
std_API_Container_VHandlePointer* vh_to_update,
|
std_API_Container_HHandlePointer& hh_to_update,
|
||||||
std_API_Container_HHandlePointer* hh_to_update,
|
std_API_Container_FHandlePointer& fh_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());
|
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,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// Update the vertex handles in the vertex handle vector
|
||||||
if ( vh_to_update ) {
|
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)
|
||||||
const int vertexCount = vertices_.size();
|
{
|
||||||
typename std_API_Container_VHandlePointer::iterator v_it(vh_to_update->begin()), v_it_end(vh_to_update->end());
|
if ( (*v_it)->idx() >= vertexCount )
|
||||||
for(; v_it != v_it_end; ++v_it)
|
(*v_it)->invalidate();
|
||||||
{
|
else
|
||||||
if ( (*v_it)->idx() >= vertexCount )
|
*(*v_it) = vh_map[(*v_it)->idx()];
|
||||||
(*v_it)->invalidate();
|
|
||||||
else
|
|
||||||
*(*v_it) = vh_map[(*v_it)->idx()];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the halfedge handles in the halfedge handle vector
|
// Update the halfedge handles in the halfedge handle vector
|
||||||
if ( hh_to_update ) {
|
typename std_API_Container_HHandlePointer::iterator hh_it(hh_to_update.begin()), hh_it_end(hh_to_update.end());
|
||||||
const int halfedgeCount = edges_.size() * 2;
|
for(; hh_it != hh_it_end; ++hh_it)
|
||||||
|
{
|
||||||
typename std_API_Container_HHandlePointer::iterator hh_it(hh_to_update->begin()), hh_it_end(hh_to_update->end());
|
if ( (*hh_it)->idx() >= halfedgeCount )
|
||||||
for(; hh_it != hh_it_end; ++hh_it)
|
(*hh_it)->invalidate();
|
||||||
{
|
else
|
||||||
if ( (*hh_it)->idx() >= halfedgeCount )
|
*(*hh_it) = hh_map[(*hh_it)->idx()];
|
||||||
(*hh_it)->invalidate();
|
|
||||||
else
|
|
||||||
*(*hh_it) = hh_map[(*hh_it)->idx()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the face handles in the face handle vector
|
// Update the face handles in the face handle vector
|
||||||
if(fh_to_update) {
|
typename std_API_Container_FHandlePointer::iterator fh_it(fh_to_update.begin()), fh_it_end(fh_to_update.end());
|
||||||
const int faceCount = faces_.size();
|
for(; fh_it != fh_it_end; ++fh_it)
|
||||||
|
{
|
||||||
typename std_API_Container_FHandlePointer::iterator fh_it(fh_to_update->begin()), fh_it_end(fh_to_update->end());
|
if ( (*fh_it)->idx() >= faceCount )
|
||||||
for(; fh_it != fh_it_end; ++fh_it)
|
(*fh_it)->invalidate();
|
||||||
{
|
else
|
||||||
if ( (*fh_it)->idx() >= faceCount )
|
*(*fh_it) = fh_map[(*fh_it)->idx()];
|
||||||
(*fh_it)->invalidate();
|
|
||||||
else
|
|
||||||
*(*fh_it) = fh_map[(*fh_it)->idx()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user