4 ms·
For a ball, can't I just randomly generate two angles (0-2pi)?
by gibybo 13y ago
For a ball, can't I just randomly generate two angles (0-2pi)?
- ColinWright 13y ago> For a ball, can't I just randomly generate > two angles (0-2pi)? Why would that be uniformly distributed?
- mturmon 13y agoNo, because the two angles can't easily be combined to make the resulting point uniform on the sphere. For instance, if you call one of the angles "latitude", and one "longitude", then you will get too many samples near the poles -- think about how the lines of constant longitude start out widely spaced on the equator, but then converge at the poles. This would cause points to pile up at the poles. Your proposal hits on the nub of why this problem is hard. It is, in general, hard to generate a bunch of non-independent random variables with a prescribed distribution. In this case, it's the angles that are not independent.
- gibybo 13y agoAh, of course, thanks.
- andrewcooke 13y agoyou can use longitude and z (height "up the axis") (it's uniform because a ring of thickness dz at height z is of area 2pi * z * cos(lat) * dz/cos(lat) (so the latitude cancels nicely - it's a trick used for equal area map projections).