▲ | dan-robertson 10 hours ago | ||||||||||||||||
Looking at Jacobians is the general method but one can rely on an interesting property: not only is the surface area of a sphere equal to the surface area of a cylinder tightly enclosing it (not counting end caps), but if you take a slice of this cylinder-with-sphere-inside, the surface area of the part of the sphere will be equal to the surface area of the shorter cylinder that results from the cutting. This gives an algorithm for sampling from a sphere: choose randomly from a cylinder and then project onto a sphere. In polar coordinates:
Potentially this is slower than the method in the OP depending on the relative speeds of sqrt and arcsin. | |||||||||||||||||
▲ | spyrja 10 hours ago | parent [-] | ||||||||||||||||
That's a neat approach! So basically something like this: https://editor.p5js.org/spyrja/sketches/eYt7H36Ka | |||||||||||||||||
|