Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
OpenMesh
Commits
e029d33c
Commit
e029d33c
authored
Jul 22, 2016
by
Janis Born
Browse files
document that DecimaterT::decimate does not perform garbage collection on the mesh
parent
c9510459
Pipeline
#2331
passed with stage
in 72 minutes and 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Doc/Examples/decimater.cc
View file @
e029d33c
//
using
namespace
OpenMesh
using
namespace
OpenMesh
;
// ---------------------------------------- necessary types
// Mesh type
typedef
TriMesh_ArrayKernelT
<>
Mesh
;
// Decimater type
typedef
Decimater
::
DecimaterT
<
Mesh
>
Decimater
;
// Decimation Module Handle type
typedef
Decimater
::
ModQuadricT
<
Mesh
>::
Handle
HModQuadric
;
// ---------------------------------------- decimater setup
typedef
TriMesh_ArrayKernelT
<>
Mesh
;
typedef
Decimater
::
DecimaterT
<
Mesh
>
Decimater
;
typedef
Decimater
::
ModQuadricT
<
Mesh
>::
Handle
HModQuadric
;
Mesh
mesh
;
// a mesh object
Decimater
decimater
(
mesh
);
// a decimater object, connected to a mesh
HModQuadric
hModQuadric
;
// use a quadric module
decimater
.
add
(
hModQuadric
);
// register module at the decimater
std
::
cout
<<
decimater
.
module
(
hModQuadric
).
name
()
<<
std
::
endl
;
// the way to access the module
decimater
.
add
(
hModQuadric
);
// register module at the decimater
std
::
cout
<<
decimater
.
module
(
hModQuadric
).
name
()
<<
std
::
endl
;
// module access
/*
* since we need exactly one priority module (non-binary)
* we have to call set_binary(false) for our priority module
* in the case of HModQuadric, unset_max_err() calls set_binary(false) internally
*/
decimater
.
module
(
hModQuadric
).
unset_max_err
();
decimater
.
initialize
();
// let the decimater initialize the mesh and the
// modules
decimater
.
module
(
hModQuadric
).
unset_max_err
();
decimater
.
decimate
();
// do decimation
decimater
.
initialize
();
decimater
.
decimate
();
// after decimation: remove decimated elements from the mesh
mesh
.
garbage_collection
();
Doc/decimater.docu
View file @
e029d33c
...
...
@@ -39,7 +39,7 @@
// If halfedge is boundary, lock the corresponding vertices
for (he_it = mesh_->halfedges_begin(); he_it != he_end ; ++he_it)
if (mesh_->is_boundary(*he_it)
) {
if (mesh_->is_boundary(*he_it)) {
mesh_->status(_mesh->to_vertex_handle(*he_it)).set_locked(true);
mesh_->status(_mesh->from_vertex_handle(*he_it)).set_locked(true);
}
...
...
src/OpenMesh/Tools/Decimater/DecimaterT.hh
View file @
e029d33c
...
...
@@ -101,21 +101,43 @@ public: //------------------------------------------------------ public methods
public:
/** Decimate (perform _n_collapses collapses). Return number of
performed collapses. If _n_collapses is not given reduce as
much as possible */
/**
* @brief Perform a number of collapses on the mesh.
* @param _n_collapses Desired number of collapses. If zero (default), attempt
* to do as many collapses as possible.
* @return Number of collapses that were actually performed.
* @note This operation only marks the removed mesh elements for deletion. In
* order to actually remove the decimated elements from the mesh, a
* subsequent call to ArrayKernel::garbage_collection() is required.
*/
size_t
decimate
(
size_t
_n_collapses
=
0
);
/// Decimate to target complexity, returns number of collapses
/**
* @brief Decimate the mesh to a desired target vertex complexity.
* @param _n_vertices Target complexity, i.e. desired number of remaining
* vertices after decimation.
* @return Number of collapses that were actually performed.
* @note This operation only marks the removed mesh elements for deletion. In
* order to actually remove the decimated elements from the mesh, a
* subsequent call to ArrayKernel::garbage_collection() is required.
*/
size_t
decimate_to
(
size_t
_n_vertices
)
{
return
(
(
_n_vertices
<
this
->
mesh
().
n_vertices
())
?
decimate
(
this
->
mesh
().
n_vertices
()
-
_n_vertices
)
:
0
);
}
/** Decimate to target complexity (vertices and faces).
* Stops when the number of vertices or the number of faces is reached.
* Returns number of performed collapses.
/**
* @brief Attempts to decimate the mesh until a desired vertex or face
* complexity is achieved.
* @param _n_vertices Target vertex complexity.
* @param _n_faces Target face complexity.
* @return Number of collapses that were actually performed.
* @note Decimation stops as soon as either one of the two complexity bounds
* is satisfied.
* @note This operation only marks the removed mesh elements for deletion. In
* order to actually remove the decimated elements from the mesh, a
* subsequent call to ArrayKernel::garbage_collection() is required.
*/
size_t
decimate_to_faces
(
size_t
_n_vertices
=
0
,
size_t
_n_faces
=
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment