sorts the input cartesian coordinates