48 # pragma warning(disable: 4267 4311) 54 #include <qapplication.h> 55 #include <qdatetime.h> 57 #include <OpenMesh/Core/IO/BinaryHelper.hh> 58 #include <OpenMesh/Core/IO/MeshIO.hh> 60 #include <OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh> 68 void DecimaterViewerWidget::keyPressEvent(QKeyEvent* _event)
70 switch (_event->key())
73 std::cout <<
"Press '+' to increase the number of decimating steps\n" 74 <<
"Press '-' to decrease the number of decimating steps\n" 75 <<
"Press 'd' to perform the set number of decimating steps\n" 76 <<
"Press 'S' to save the mesh to 'result.off'\n" 77 <<
"Press 'q' or 'Esc' quit the application" << std::endl;
82 if ( (rc=decimater_->decimate(steps_)) )
84 decimater_->mesh().garbage_collection();
85 std::cout << rc <<
" vertices removed!\n";
89 std::cout <<
"Decimation failed\n";
95 steps_ = std::min( steps_ , (
size_t)( mesh_.n_vertices() / 10 ) );
97 std::cout <<
"# decimating steps increased to " << steps_ << std::endl;
102 steps_ = std::max( steps_ ,
size_t(1) );
104 std::cout <<
"# decimating steps increased to " << steps_ << std::endl;
114 std::cout <<
"mesh saved in 'result.off'\n";
125 this->inherited_t::keyPressEvent(_event);
130 void DecimaterViewerWidget::animate(
void )
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.
Set options for reader/writer modules.