-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (49 loc) · 1.5 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <vector>
#include <clocale>
#include <memory>
#include <stdexcept>
#include "edgeextractor.h"
#include "normalsfinder.h"
#include "mesh.h"
#include "interface.h"
#include "flowrunner.h"
#include "plydatareader.h"
#include "flowfactory.h"
#ifndef NDEBUG
#include <fenv.h>
#endif
int main ( int argc, char *argv[] )
{
#ifndef NDEBUG
fetestexcept ( FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW );
#endif
setlocale ( LC_NUMERIC, "en_US" );
if ( argc < 5 )
throw std::runtime_error ( "Run with: <mesh.ply> <MEAN | POWER_MEAN> [int | null] <max time>" );
Mesh mesh;
PLYDataReader *reader = new PLYDataReader;
reader->set ( &mesh );
reader->read ( argv[1] );
mesh.verify();
delete reader;
NormalsFinder * normalsFinder = new NormalsFinder;
normalsFinder->set(&mesh);
normalsFinder->execute();
delete normalsFinder;
EdgeExtractor * extractor = new EdgeExtractor;
extractor->init ( &mesh );
for ( unsigned int i = 0; i < mesh.vertex_count(); i++ )
{
extractor->extract(i);
mesh.set_star_of(i, extractor->get() );
}
delete extractor;
std::shared_ptr < FlowFilter > flowFilter = FlowFactory::get_flow ( argv[2], argv[3] );
flowFilter->input ( &mesh );
FlowRunner flowRunner ( flowFilter );
Interface interface;
flowRunner.register_listener ( &interface );
interface.register_listener ( &flowRunner );
interface.init( mesh, std::atof ( argv[4] ) );
return interface.exec();
}