As explained in Holger Dammetz page Hammersley Points on the Hemisphere, the 2D coordinates (u,v) are usually mapped to the spherical coordinates (θ, φ). enter image description here
As a result, the coordinate "uniformly distributed" - u in the 2D case - is the polar angle θ. This looks counter-intuitive to me, I would have mapped regularly spaced u values to regularly spaced azimuth φ values. To avoid "empty areas" like in this example:
enter image description here
which is generated by the mapping of the following 2D set:
enter image description here
What is the reason not to map (u, v) to (φ, θ) ?


2 Answers 2


You can of course, as you suggested, map (u, v) to (φ, θ). Unfortunately, it does not solve the problem for 5 points:

Switched mapping

I've changed Holger Dammertz' code a bit (switched u and v), and you see that the problem still persists. For a higher number of points, it really doesn't seem to make a (visual) difference.

The Hammersley point set is a way to very quickly determine points on a sphere that have good, but don't need to have a perfect distribution. In the problematic case of very few points, Hammersley might just not be the tool for the job. Pre-calculating and storing points sounds like a better option to me.


The "Uniform Mapping" here is incorrect. It does not transform to a uniform distribution on the sphere.

Very very bad me. I misread the equation AND I didn't even consult my own reference [1], if I had I would have seen my mistake.

Still the method from [2] is interesting and is described below.

Additional note:

To map a uniform point set from the unit square to the sphere or half sphere requires an area-preserving map. That will maintain the uniform property. For pseudo-random that's sufficient (points are independent), however low-discrepancy point set will have its discrepancy measure effected by distortions in area introduced by the map. I'm not aware of any references with respect to this point.

The method from [2] starts by mapping unit square to the unit disk. One way we can do this is by using a rejection method. Pseudo-code looks like this:

d = 0;

do {
  p = uniform2d(...);  // [0,1) x [0,1)   given to be uniform
  p = 2p;              // [0,2) x [0,2)   scaling (area-preserving)
  p = p-1;             // (-1,1) x (-1,1) translating (area-preserving)
  d = dot(p,p);        // is p in disk?
} while(d >= 1);       //   if not rinse-and-repeat

the area of the transformed square is $4$ and the unit disk is $\pi$, so the acceptance rate is $\frac{\pi }{4}$ (~.785) so on average requires $\frac{4}{\pi}$ (~1.273) iterations.

Also non-rejection based methods exist, for example [3] which requires one square root and one trig operation. Note that the rejection method does not distort areas so the discrepancy measure remains the same.

Once we have $ p = \left(u_0, u_1 \right) $ uniformly distributed in the unit disk, we have:

$$ u_0, u_1 \in \left(-1,1\right) $$ $$ d = p\cdot p = u_0^2+u_1^2,\; d < 1 $$

then the transform to the sphere is:

$$ s=2\sqrt{1-d} $$ $$ p = \left\{s\thinspace u_0,\thinspace s\thinspace u_1, 1-2d\right\} $$

or if you wanted a half-sphere, say positive Z, (just to state the obvious):

$$p = \left\{s\thinspace u_0,\thinspace s\thinspace u_1, d\right\} $$

There is a Stackexchange: Mathematics thread that discusses this method ([4],[5]).

Also if you want to procedurally generate a LDS the additive recurrence formulation of the Weyl sequence is very cheap.


  1. Wolfram MathWorld: Sphere Point Picking
  2. "Choosing a Point from the Surface of a Sphere.", George Marsaglia, 1972. (PDF)
  3. Wolfram MathWorld: Disk Point Picking
  4. SE Mathematics
  5. SE Mathematics
  • $\begingroup$ Doh: actually I'm wrong about the method not being uniform...working on a rewrite. $\endgroup$ Commented Mar 9, 2016 at 10:57
  • $\begingroup$ OK, I put up a first revision. $\endgroup$ Commented Mar 9, 2016 at 12:17
  • $\begingroup$ Added the area-distortion note $\endgroup$ Commented Mar 10, 2016 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.