Does anyone know how I can order a pair of coordinates (x,y) in C++?
For example that first are the coordinates of the first quadrant, then the coordinates of the second quadrant, etc.
I already tried the algorithm library with the sort method but it doesn't work.
bool com(Coordenada a, Coordenada b){
return a.getX() < b.getX() || a.getY() < b.getY();
}
void mapa::sortVertices(){
std::sort (ver.begin(), ver.end(), com);
}
For example, before:
x=-1;y=-1
x=1;y=1
x=1;y=-1
x=-1;y=1
after:
x=1;y=1
x=1;y=-1
x=-1;y=-1
x=-1;y=1