14 vector<pair<double,double > >
convex_hull(vector<pair<double, double> > points)
16 int n = points.size();
18 vector<pair<double, double> > hull;
20 for (
int i = 0; i < n; ++i) {
23 cout <<
"popping out\n";
32 cout <<
"-------------------COUNTER VALUE AFTER LOWER HULL:" << counter <<endl;
34 for (
int i = n-2, t = counter+1; i >= 0; i--) {
37 cout <<
"popping out\n";
46 cout <<
"-------------------COUNTER VALUE AFTER UPPER HULL:" << counter <<endl;
47 hull.resize(counter-1);
60 set<pair<double, double> >
execAndrews(vector<pair<double, double> > Points) {
61 cout <<
"Executing Andrews Algorithm\n---\n";
62 vector<pair<double, double> > tentative_hull;
63 vector<pair<double, double> > L_upper,L_lower;
65 len = int(Points.size());
75 set<pair<double ,double> > f_convex_hull;
76 int LU_len = tentative_hull.size();
79 out_file.open(
"output.ch");
81 out_file << len <<
" " << LU_len <<
"\n";
82 cout <<
"Elements in convex hull:" << LU_len <<endl;
83 for(
int i=0;i < len;i++) {
84 out_file << Points[i].first <<
" " << Points[i].second <<
" 0\n";
86 for(
int i=0;i<LU_len;i++) {
87 f_convex_hull.insert(tentative_hull[i]);
91 vector<int>::iterator it_set;
93 out_file << *it_set <<
" ";
set< pair< double, double > > execAndrews(vector< pair< double, double > > Points)
Complete Execution of Andrews Monotone Chain
Definition: Andrews.h:60
int orientation(pair< double, double > a, pair< double, double > b, pair< double, double > c)
Orientation.
Definition: origin.h:33
vector< int > indices
Definition: origin.h:19
vector< pair< double, double > > convex_hull(vector< pair< double, double > > points)
Upper Hull and Lower Hull Algorithm
Definition: Andrews.h:14
#define CLOCKWISE
Definition: origin.h:16
bool orderedSort(pair< double, double > &f, pair< double, double > &s)
Comparator Function.
Definition: origin.h:52