0

A straightforward solution to this problem is:

Generating a random point [x_0, y_0, z_0] on a unit sphere according to the following steps:

  • Choose

    a random number r, which -1 < r < 1

    a random number t, which 0 < t < 2*pi

  • Set

    x_0 = sqrt(1-r^2)*cos(t)

    y_0 = sqrt(1-r^2)*sin(t)

    z_0 = r

Then mapping this point onto a tri-axial ellipsoid surface (with A > B > C semi-axes) as follows:

  • Define

    x = A * x_0

    y = B * y_0

    z = C * z_0

  • Calculate

    R = sqrt{(B^2)(C^2)((x_0)^2) + (A^2)(C^2)((y_0)^2)+(A^2)(B^2)((z_0)^2)}

  • Keep the point with probability

    P = R / A*B

    else reject it and start over.


Also, a similar solution is discussed in How to generate points uniformly distributed on the surface of an ellipsoid? in more detail.


I have some confusion with the last line of the described solution (i.e., Keep points with probability P, and reject others). What this exactly mean, and why?

I write an algorithm based on this method in C++ language, but I'm not sure that in the last line (Keep the point with probability P...),

  • the probability "p([x, y, z]) = R([x, y, z]) / A*B" must be equal to "P" (which calculated for [x_0, y_0, z_0]) to keep the point,
  • or I have to generate the second random point [x', y', z'] and check the condition "p([x', y', z']) = P" to decide if the point [x, y, z] should be accepted/rejected (like the latest step of the well-known "rejection method" for sampling),
  • or anything else? (I'm totally wrong and that phrase has a different meaning)

I would be very grateful if anyone could clearly explain and help me with this.

1 Answers1

1

Although the axis-stretching transformation from the solid sphere to the solid ellipsoid preserves volume, it does not preserve surface area when viewed as a map from the surface of the sphere to the surface of the ellipsoid. Rejection sampling is one way to compensate for this.

kimchi lover
  • 24,277