# What is the average rotation angle needed to change the color of a sphere?

A sphere is painted in black and white. We are looking in the direction of the center of the sphere and see, in the direction of our vision, a point with a given color. When the sphere is rotated, at the end of the rotation we might see the same or a different color.

The coloring of the sphere is given; we know how the white and black color is distributed. The coloring is also “nice” (no fractals); the black patches have borders that are smooth and infinitely differentiable curves. How can I calculate the average angle required to change from black to white?

The question is very general. So a simple sub-case would be: if one hemisphere of the sphere is black, the other is white, and if one starts in a situation where the random starting point is black, what would the average angle be?

Starting from this subcase, what would be the way to calculate the average angle for a general black-and-white coloring?

#### Solutions Collecting From Web of "What is the average rotation angle needed to change the color of a sphere?"

For the general case you can define a function that assigns to each point on the sphere the distance (angle) to the nearest boundary.
The desired number is then the integral of this function over the whole sphere (see example by Joriki).
For the sphere, we can consider, for example, circular regions (a hemisphere is a special case).
Inside a small circular region (cap) the distance function looks like a little cone, centered at the center of the circle.
If the black (and therefore also the white) regions are made up of unions, intersection or differences of caps the distance function can be constructed from the distance functions for each of the caps.
Note that the colors are irrelevant.
The only thing that matters is the distance to the nearest boundary.
All you need is the list of circles.
Performing the integration exactly would not be easy.
The case of two non-overlapping caps is doable (non-intersecting circles).
For a set of circles that is not too large, you could use Monte Carlo integration (for a random set of points, average the distance to the nearest circle).
Easy to implement, but not very efficient.
Monte Carlo would also work for more general cases.

You could consider intersections of hemispheres as the equivalent of polygons on a sphere.
So the ideas described above apply to the case of “polygonal” regions on the sphere.

If you approximate your boundary by a discrete set of points you can probably use a Voronoi diagram.

Note that this kind of question is much easier to think about on a unit square (with periodic boundary conditions) or easier still on a unit interval (with periodic boundary conditions).
In the latter case, the distance function for an arbitrary partition is made up of “hats” with slopes of 1 and -1.
The integration is easy to perform in this case.

http://en.wikipedia.org/wiki/Signed_distance_function

http://en.wikipedia.org/wiki/Medial_axis

If one hemisphere is black and the other white, choose spherical coordinates such that the border between the colours is at the equator. Then the rotation angle required to change colours is $|\theta|$, where $\theta$ is the latitude. So the average angle is

$$\frac{\int_{-\pi/2}^{\pi/2}|\theta|\cos \theta\mathrm d\theta}{\int_{-\pi/2}^{\pi/2}\cos \theta\mathrm d\theta}= \int_0^{\pi/2}\theta\cos\theta\mathrm d\theta=\left[\theta\sin\theta+\cos\theta\right]_0^{\pi/2}=\frac{\pi}{2}-1\;.$$

I don’t see how anything useful could be said about the general case.