Я считаю, что было 2 негативных признака, которые нужно было исправить, как указано в комментарии. Это похоже на работу:
#include <iostream>
#include <vector>
#include <cmath>
typedef struct p {
float x,y;
} Point;
double getClockwiseAngle(Point p) {
double angle = 0.0;
angle = -1 * atan2(p.x, -1 * p.y);
return angle;
}
bool comparePoints(Point p1, Point p2) {
return getClockwiseAngle(p1) < getClockwiseAngle(p2);
}
int main() {
std::vector<Point> givenPoints{{-4,2}, {1,4}, {0,1}, {-1,4}};
sort(givenPoints.begin(), givenPoints.end(), comparePoints);
std::cout << "Sorted Points: ";
for(auto it = givenPoints.begin(); it != givenPoints.end(); it++) {
std::cout << "(" << it->x << ", " << it->y << ")" ;
}
std::cout << std::endl;
}
Выход:
Sorted Points: (0, 1)(1, 4)(-4, 2)(-1, 4)
Process finished with exit code 0