12
$\begingroup$

I have been looking for a way to map a unit cube (with vertices $x^2=1$, $y^2=1$, $z^2=1$) to a unit sphere ($x^2+y^2+z^2=1$) with minimal distortion of the great circles formed by mapping the coordinate lines on the cube face. As can be seen from the following picture, a simple radial contraction onto the sphere surface leads to large visible distortion of the great circles.

Radial contraction onto sphere

Phil Nowell here derived an elegant mapping that generates a much more uniform subdivision of the great circles.

Nowell mapping

However, close inspection shows that there is still some room for improvement. Points near the center of the cube faces get more compressed than those near the edges.

By using the rotation of central planes to map points on the cube to equidistant points on the sphere, I was able to come up with the following expressions for an improved mapping: $$ \begin{cases} x_\text{sphere}=x_c/\sqrt{x_c^2+ y_c^2+ z_c^2}\\ y_\text{sphere}=y_c/\sqrt{x_c^2+ y_c^2 + z_c^2}\\ z_\text{sphere}=z_c/\sqrt{x_c^2+ y_c^2 + z_c^2} \end {cases} $$

where $$ \begin{cases} x_c=\sqrt{x^p+y^2+z^2} \tan\left(x \arctan\left(\dfrac1{\sqrt{x^p+y^2+z^2} } \right)\right)\\ y_c=\sqrt{x^2+y^p+z^2} \tan\left(y \arctan\left(\dfrac1{\sqrt{x^2+y^p+z^2} } \right)\right)\\ z_c=\sqrt{x^2+y^2+z^p} \tan\left(z\arctan\left(\dfrac1{\sqrt{x^2+y^2+z^p} } \right)\right) \end{cases} $$

  • $p$ is a large even integer and
  • $x$, $y$, $z$ are the coordinates of the cube.

The picture below is obtained with $p=50$

Improved mapping

To express the quality $Q$ of the mapping, I calculate the ratio of the maximum and minimum length of a line segment on the most distorted great circle, $i,$ as follows: $$ Q=\frac{\ell_{i,\min}}{\ell_{i,\max}} \cdot 100\% $$ so that an optimum distribution gives a quality of $100\%.$

With this, the quality of the radial contraction of the 9x9x9 grid depicted above becomes $58\%,$ that of Nowell’s mapping becomes $79\%$ and that of my improved mapping becomes $96\%.$ It is also worth noting that the quality on the central coordinate lines and the edges is $100\%.$

Now, my question is: “can my mapping be improved further to yield a quality of $100\%$ everywhere on the sphere?”

Update 1

The following iterative scheme gives a further improvement: $$ \begin{align} x_{c,0} &= x,\quad y_{c,0} = y,\quad z_{c,0} = z\\ x_{c,i+1} &=\sqrt{x^{p}_{c,i}+y^{2}_{c,i}+z^{2}_{c,i}} \tan\left(x\arctan\left(\frac{1}{\sqrt{x^{p}_{c,i}+y^{2}_{c,i}+z^{2}_{c,i}} } \right)\right)\\ y_{c,i+1} &=\sqrt{x^{2}_{c,i}+y^{p}_{c,i}+z^{2}_{c,i}} \tan\left(y\arctan\left(\frac{1}{\sqrt{x^{2}_{c,i}+y^{p}_{c,i}+z^{2}_{c,i}} } \right)\right)\\ z_{c,i+1} &=\sqrt{x^{2}_{c,i}+y^{2}_{c,i}+z^{p}_{c,i}} \tan\left(z\arctan\left(\frac{1}{\sqrt{x^{2}_{c,i}+y^{2}_{c,i}+z^{p}_{c,i}} } \right)\right) \end{align} $$ With this, the quality of the mapped 9x9x9 grid increases after 2 iterations from 96.1% to 97.7%

For finer grids the improvement is more pronounced. A 50x50x50 grid (with p=500) achieves an improvement from 95.3% to 97.1% after 1 iteration and a grid of 500x500x500 (with p=5000) shows an improvement from 95.2% to 97.0% with 1 iteration.

$\endgroup$
24
  • 2
    $\begingroup$ The question of mapping a portion of a sphere to the plane has been well studied due to its application to map projection. In that context, it's well known that no such map can represent all lengths in their correct proportions. My favorite text in this field is Portraits of the Earth, where this result is attributed to Euler. It was likely known in antiquity, as well though. $\endgroup$ Commented May 12, 2023 at 11:20
  • 3
    $\begingroup$ Your equation "of unit cube" defines 8 points, not the unit cube. $\endgroup$ Commented May 12, 2023 at 11:36
  • 1
    $\begingroup$ Sam, I want to make the grid points on a “great circle” (in the meaning discussed with Timothy) equidistant. At the moment some “great circles” are worse than others. $\endgroup$ Commented May 13, 2023 at 7:42
  • 1
    $\begingroup$ When you claim your quality is $96\%$, is that for the $p=50$ example you gave? Did you seek to optimize $p$? $\endgroup$ Commented May 22, 2023 at 0:35
  • 1
    $\begingroup$ It is explained here: hvlanalysis.blogspot.com/2023/05/… $\endgroup$ Commented Oct 9, 2023 at 6:39

1 Answer 1

2
$\begingroup$

Not sure if this link might bring some light on the subject, the equi-angular cube mapping might be what you are looking for:

https://blog.google/products/google-ar-vr/bringing-pixels-front-and-center-vr-video/

$\endgroup$
3
  • 1
    $\begingroup$ Thanks @user 1277628. However, the mapping I am looking for is neither area nor angle preserving. I only require equidistant points on the cube's coordinate lines to be mapped to equidistant points on the sphere's coordinate lines (as per the original query and pictures). Also see: hvlanalysis.blogspot.com/2023/05/mapping-cube-to-sphere.html $\endgroup$ Commented Oct 9, 2023 at 18:03
  • $\begingroup$ @HarryvanLangen Do you allow different coordinate lines to be mapped onto the sphere with different scaling factors, i.e. so that their corresponding curves on the sphere have different lengths? $\endgroup$ Commented Oct 10, 2023 at 20:02
  • 1
    $\begingroup$ Yes @HelloGoodbye. Have a look at the last figure. The map of the central coordinate line is longer than that of the edges by a factor $\frac{\pi }{4} /arctan\left( \frac{1}{2} \sqrt{2} \right)$ $\endgroup$ Commented Oct 11, 2023 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .