Say yo want a set of points sorted in some counterclockwise order. What is the best (fast, precise, short) way to do it? The atan2l
function is precise and short but way too slow.
Update: I like the following one (adapted from ideas by mnbvmar and Swistakk).
sort(v.begin(), v.end(), [] (point a, point b) {
bool x = a > point(), y = b > point();
return x == y ? a.x * b.y > a.y * b.x : x < y;
});
Reference: 68213997.