Cosinus value calculation + sorting by that value