Given sequence of coordinates, get order around origin by distance, without precise distance

36 Views Asked by At

Given a sequence of coordinates, what's the simplest way to get their order by stance around the origin, given that the absolute distance is of no consequence?

For example, given points [ [0 5] [0 -1] [2 0] ], all these order expressions are correct:

[ 3 1 2 ], [ 5 1 2 ], [-5 -1 -2]

If I wanted exact distance, Pythagora's theorem comes to mind, but my usecase is a machine learning model, so the simpler the calculation the better. Given this simple example, it seems that it would be enough to sum the coordinates, like so [ 0+5 (0 + abs(-1)) 2+0 ], but will that always preserve the order?

Excuse me being uninitiated.