53 # pragma warning(disable: 4267 4311)
59 #include <qapplication.h>
60 #include <qdatetime.h>
62 #include <OpenMesh/Core/IO/BinaryHelper.hh>
63 #include <OpenMesh/Core/IO/MeshIO.hh>
65 #include <OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh>
73 void DecimaterViewerWidget::keyPressEvent(QKeyEvent* _event)
75 switch (_event->key())
78 std::cout <<
"Press '+' to increase the number of decimating steps\n"
79 <<
"Press '-' to decrease the number of decimating steps\n"
80 <<
"Press 'd' to perform the set number of decimating steps\n"
81 <<
"Press 'S' to save the mesh to 'result.off'\n"
82 <<
"Press 'q' or 'Esc' quit the application" << std::endl;
87 if ( (rc=decimater_->decimate(steps_)) )
89 decimater_->mesh().garbage_collection();
90 std::cout << rc <<
" vertices removed!\n";
94 std::cout <<
"Decimation failed\n";
100 steps_ = std::min( steps_ , (
size_t)( mesh_.n_vertices() / 10 ) );
102 std::cout <<
"# decimating steps increased to " << steps_ << std::endl;
107 steps_ = std::max( steps_ ,
size_t(1) );
109 std::cout <<
"# decimating steps increased to " << steps_ << std::endl;
119 std::cout <<
"mesh saved in 'result.off'\n";
130 this->inherited_t::keyPressEvent(_event);
135 void DecimaterViewerWidget::animate(
void )
Set options for reader/writer modules.
bool write_mesh(const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default, std::streamsize _precision=6)
Write a mesh to the file _filename.