Hacker News new | ask | show | jobs
by dan-robertson 305 days 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:

  sample theta uniformly in (0,2pi)
  sample y uniformly in (-1,1)
  project phi = arcsin(y) in (-pi,pi)
  polar coordinates (theta, phi) define describe random point on sphere
Potentially this is slower than the method in the OP depending on the relative speeds of sqrt and arcsin.
2 comments

That's a neat approach! So basically something like this: https://editor.p5js.org/spyrja/sketches/eYt7H36Ka
This seems more like a random point on a spiral on the sphere. There was a thing on hn about spirals on a sphere few days ago.
Ah, good catch. I forgot to scale the point properly! How does the updated sketch look?

EDIT: Plotting it out as a point cloud seems to confirm your suspicion.

Without scaling: https://editor.p5js.org/spyrja/sketches/7IK_RssLI

Scaling fixed: https://editor.p5js.org/spyrja/sketches/kMxQMG0dj

Ah neat ! It never occurred to me -- the connection with Archimdedes' result. He certainly considered it to be his best.