51 #include <OpenMesh/Core/IO/MeshIO.hh> 52 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh> 55 #include <OpenMesh/Tools/Utils/getopt.h> 59 using namespace Smoother;
78 void usage_and_exit(
int _xcode)
80 std::cout << std::endl;
81 std::cout <<
"Usage: smooth [Options] <iterations> <input mesh> <output mesh>\n";
82 std::cout << std::endl;
83 std::cout <<
"Options \n" 85 <<
" -c <0|1> \t continuity (C0,C1). Default: C1\n" 86 <<
" -t \t\t smooth tangential direction. Default: Enabled\n" 87 <<
" -n \t\t smooth normal direction. Default: Enabled\n" 96 int main(
int argc,
char **argv)
115 while ( (c=getopt(argc, argv,
"tnc:h"))!=-1 )
139 case 'h': usage_and_exit(0);
141 default: usage_and_exit(1);
151 std::stringstream str; str << argv[optind]; str >> iterations;
156 ifname = argv[++optind];
160 ofname = argv[++optind];
167 omout() <<
"read mesh..." << std::flush;
171 omout() <<
"done (" << t.
as_string() <<
")\n";
173 omout() <<
" #V " << mesh.n_vertices() << std::endl;
178 smoother.initialize(component,continuity);
180 omout() <<
"smoothing..." << std::flush;
183 smoother.smooth(iterations);
187 omout() << t.
seconds() <<
"s ~ ";
189 << (iterations*mesh.n_vertices())/t.
seconds() <<
" Vertices/s)\n";
193 omout() <<
"write mesh..." << std::flush;
197 omout() <<
"done (" << t.
as_string() <<
")\n";
Add normals to mesh item (vertices/faces)
void start(void)
Start measurement.
double seconds(void) const
Returns measured time in seconds, if the timer is in state 'Stopped'.
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Set options for reader/writer modules.
std::string as_string(Format format=Automatic)
void stop(void)
Stop measurement.
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.