Yes, this is a very good solution. Here's how to implement it in order to ignore the numerical error.
- take any 3 points; these determine the plane, rotate appropriately
- check that abs(z)<THRESHOLD for all z-coordinates, now you can ignore them
- perform Graham scan which is O(n log(n)) time
- return order, else throw error if results.size <
You might want to select 3 points far enough apart, or a combination of many points (still have their problems) and make the THRESHOLD a little fraction of the maximum distance between them.
, , O(n log(n)), ( , X [X, X ^ 2] [0, max ^ 2]).