46 #include <OpenMesh/Core/IO/MeshIO.hh> 47 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh> 50 #include <OpenMesh/Tools/Utils/getopt.h> 54 using namespace Smoother;
73 void usage_and_exit(
int _xcode)
75 std::cout << std::endl;
76 std::cout <<
"Usage: smooth [Options] <iterations> <input mesh> <output mesh>\n";
77 std::cout << std::endl;
78 std::cout <<
"Options \n" 80 <<
" -c <0|1> \t continuity (C0,C1). Default: C1\n" 81 <<
" -t \t\t smooth tangential direction. Default: Enabled\n" 82 <<
" -n \t\t smooth normal direction. Default: Enabled\n" 91 int main(
int argc,
char **argv)
110 while ( (c=getopt(argc, argv,
"tnc:h"))!=-1 )
134 case 'h': usage_and_exit(0);
break;
136 default: usage_and_exit(1);
146 std::stringstream str; str << argv[optind]; str >> iterations;
151 ifname = argv[++optind];
155 ofname = argv[++optind];
162 omout() <<
"read mesh..." << std::flush;
166 omout() <<
"done (" << t.
as_string() <<
")\n";
168 omout() <<
" #V " << mesh.n_vertices() << std::endl;
173 smoother.initialize(component,continuity);
175 omout() <<
"smoothing..." << std::flush;
178 smoother.smooth(iterations);
182 omout() << t.
seconds() <<
"s ~ ";
184 << (iterations*mesh.n_vertices())/t.
seconds() <<
" Vertices/s)\n";
188 omout() <<
"write mesh..." << std::flush;
192 omout() <<
"done (" << t.
as_string() <<
")\n";
double seconds(void) const
Returns measured time in seconds, if the timer is in state 'Stopped'.
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.
std::string as_string(Format format=Automatic)
Set options for reader/writer modules.
void start(void)
Start measurement.
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
void stop(void)
Stop measurement.