Sort the points by linear distance in a 3D space
05AB1E, 4 bytes
ΣαnO
Try it online!
Explanation
Σ # sort by
O # sum of
n # square of
α # absolute difference between current value and second input
JavaScript (ES6), 71 bytes
(b,a,g=a=>a.reduce((d,c,i)=>d+(c-=b[i])*c,0))=>a.sort((b,a)=>g(b)-g(a))
Haskell, 54 52 bytes
import Data.List
f o=sortOn(sum.map(^2).zipWith(-)o)
Try it online!
I don't need the size of the space. sum.map(^2).zipWith(-)o
computes the distance from a point to o
: (xo-xp)^2+(yo-yp)^2+(zo-zp)^2
. The points are simply sorted on the distance to o
.
EDIT: "if you don't need it, don't take it" saved 2 bytes.