News for hackers. Stuff that matters.
Re:Random Points on a Sphere by ginko on Monday April 27, 2015 @02:27AM (#9444631)
A very simple solution is to generate a 3D point in [-1,1]^3, regenerate if it's length is >1 and project it on to the sphere otherwise.
Re:Random Points on a Sphere by reitzensteinm on Monday April 27, 2015 @02:34AM (#9444650)
Why would you regenerate it if the length exceeds 1? Can't you just normalize the vector regardless of its length (excluding 0)?
Re:Random Points on a Sphere by dietrichepp on Monday April 27, 2015 @02:41AM (#9444673)
That would lead to the distribution being non-uniform: there would be more points in the corners of the cube.
Re:Random Points on a Sphere by reitzensteinm on Monday April 27, 2015 @03:28AM (#9444816)
Ah, of course. To visualize it, the distance between the center and the surface of the shape would be proportional to the probability of that vector being selected after normalization. Thanks!
Re:Random Points on a Sphere by gliptic on Monday April 27, 2015 @02:44AM (#9444685)
Because that would bias the distribution to the corners of the cube.
Re:Random Points on a Sphere by kasdkashdkas on Monday April 27, 2015 @02:48AM (#9444698)
Since the box is anisotropic, this would not give the uniform distribution (it's more likely to draw a "diagonal" direction than a coordinate axis direction).