Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector<pair<long long, long long> > points;
- struct cmpr{
- cmpr(pair<long long, long long> p0){
- this->p0.first = p0.first;
- this->p0.second = p0.second;
- }
- bool operator()(pair<long long, long long> lPoint, pair<long long, long long> rPoint){
- long long orient = (lPoint.second-p0.second)*(rPoint.first-lPoint.first) -
- (lPoint.first-p0.first)*(rPoint.second-p0.second);
- if(orient < 0) return false;
- return true;
- }
- pair<long long, long long> p0;
- };
- void CCRSort(){
- /* p[0] has the smallest y value of all points */
- sort(points.begin(), points.end(), cmpr(points[0]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement