7 vector<pair<double , double> > points;
10 cout <<
"usage: " << argv[0] <<
" <algorithm> <filename>\n";
12 if (strcmp(argv[1],
"-h") == 0 || strcmp(argv[1],
"--help") == 0) {
13 cout <<
"\nusage: " << argv[0] <<
" <algorithm> <filename>\n";
14 printf(
"\t-g\t--grahamscan\tEvaluate by Graham Scan\n");
15 printf(
"\t-a\t--andrew\tEvaluate by Andrew's algorithm\n");
16 printf(
"\t-j\t--jarvismarch\tEvaluate by Jarvis March\n\n");
22 points =
getData(
"./tests/sampleInput.txt");
23 if (argv[1][1] ==
'g' || strcmp(argv[1],
"--grahamscan") == 0) {
27 else if (argv[1][1] ==
'a' || strcmp(argv[1],
"--andrew") == 0) {
30 set<pair<double, double> > andrews_res =
execAndrews(points);
31 ull andrews_len = andrews_res.size();
32 cout << andrews_len << endl;
33 set<pair<double, double> >::iterator iter;
34 for (iter = andrews_res.begin(); iter != andrews_res.end(); ++iter) {
35 cout << (*iter).first <<
" " << (*iter).second << endl;
40 else if (argv[1][1] ==
'j' || strcmp(argv[1],
"--jarvismarch") == 0) {
42 cout<<
"-----End of JarvisMarch-----"<<endl;
46 printf(
"Illegal flag");
set< pair< double, double > > execAndrews(vector< pair< double, double > > Points)
Complete Execution of Andrews Monotone Chain
Definition: Andrews.h:60
#define ull
Definition: origin.h:11
vector< pair< double, double > > getData(char *filename)
Extract Data from Input File.
Definition: origin.h:113
double execGrahamScans(vector< pair< double, double > > Points)
Graham Scans Algorithm Implementation
Definition: GrahamScans.h:26
double execJarvisMarch(vector< pair< double, double > > Points)
Jarvis March Algorithm Implementation
Definition: JarvisMarch.h:39