5
$\begingroup$

Cited from https://reference.wolfram.com/language/ref/SpherePoints.html?q=SpherePoints

SpherePoints[n] gives the positions of n uniformly distributed points on the surface of a unit sphere.

SpherePoints[n] gives exactly equally spaced points in certain cases for small n. In other cases, it places points so they are approximately equally spaced.

But for n=8 where we have a cube (platonic solid) the output neither seems to be exactly equally spaced nor approximately equally spaced.

Is it a bug or I am missing something? I have not tested for other values of n.

pts = SpherePoints[8];

pts2 = Flatten[{#, -#} & /@ SpherePoints[4], 1];

Graphics3D[{DelaunayMesh[pts], Opacity[0.5], Sphere[], Red, 
  PointSize[Large], Point[pts]}, ImageSize -> Small]

Graphics3D[{DelaunayMesh[pts2], Opacity[0.5], Sphere[], Red, 
  PointSize[Large], Point[pts2]}, ImageSize -> Small]

enter image description here

Solved with @Domen's comment that the exact definition of SpherePoints can be found in Spherical Code and is as follows (not same as in documentation):

How can n points be distributed on a unit sphere such that they maximize the minimum distance between any pair of points?

$\endgroup$
19
  • 1
    $\begingroup$ They may be, but they are not equally spaced on the surface of the sphere. There is a better distribution - a cube. $\endgroup$ Commented Apr 30, 2024 at 18:21
  • 2
    $\begingroup$ Do you think that pts2 is more equally spaced than pts? What test would you use to show this? $\endgroup$ Commented Apr 30, 2024 at 18:43
  • 1
    $\begingroup$ @JasonB Do you realize that the squares in the first figure are the same squares as in the second figure but twisted 45 degrees? But since they are twisted the opposite squares get closer to each other thus making the distribution more uneven compared to cube. $\endgroup$ Commented Apr 30, 2024 at 18:56
  • 2
    $\begingroup$ Instead of assuming there is a bug, just invest more time in googling: Spherical Code. Min@DeleteCases[DistanceMatrix[pts], 0., All] is 1.22, while Min@DeleteCases[DistanceMatrix[pts2], 0., All] is 1.15. $\endgroup$ Commented Apr 30, 2024 at 19:05
  • 1
    $\begingroup$ @Domen Have you read? Because the definition on that page "How can n points be distributed on a unit sphere such that they maximize the minimum distance between any pair of points?" is not the same as stated in the documentation of SpherePoints. There is no reference to any distance between points but "uniformly distributed points on the surface". And this is a big difference. If that was written in the documentation I would have no problem with it. But if we talk about even distribution on the surface (area) then the cube is the solution not the other figure. $\endgroup$ Commented Apr 30, 2024 at 19:16

2 Answers 2

1
$\begingroup$

I hope this picture is self-explanatory. I use the so-called Lambert cylindrical equal area projection which maps the sphere to a cylinder, area to equal area. Please, notice periodicity along each direction. Equivalent sides are of the same colour.

SphPts = SpherePoints[8];
CbcPts = Flatten[{#, -#} & /@ SpherePoints[4], 1];
Graphics[{PointSize[Large], Black, 
     Point[Table[{(Sin[u[[2]] - Pi/2] + 1)/2, 
                  (u[[3]] + Pi)/(2 Pi)},
           {u, ToSphericalCoordinates@#[[1]]}]], 
     Thick, Purple, 
     Line[{{0, 0}, {0, 1}}], Line[{{1, 0}, {1, 1}}], 
     Orange, 
     Line[{{0, 0}, {1, 0}}], Line[{{0, 1}, {1, 1}}]}, 
    PlotLabel -> #[[2]]] & /@ 
 {{SphPts, "SpherePoints[8]"}, {CbcPts, "CubePoints"}} // GraphicsRow

enter image description here

$\endgroup$
7
  • $\begingroup$ I guess the projection depends on the position of the figures to the cylinder. Are the squares of the figures parallel to top and bottom of the cylinder in both cases? If I am not mistaken they are not. $\endgroup$ Commented Apr 30, 2024 at 20:09
  • $\begingroup$ @azerbajdzan Yes. It is indeed interesting if there is a rotation of the sphere that makes cubic point look uniform under the Lambert project. I do not know. $\endgroup$ Commented Apr 30, 2024 at 20:11
  • $\begingroup$ I am not sure you know what I mean . Use these vertices SphPts = PolyhedronData["SquareAntiprism", "VertexCoordinates"]; CbcPts = PolyhedronData["Cube", "VertexCoordinates"]; You will see that cube vertices are better distributed. $\endgroup$ Commented Apr 30, 2024 at 20:22
  • 1
    $\begingroup$ And a second point, even if you projected sphere to a cylinder of the same area that does not mean that even distribution of points on sphere would be preserved on a projection to a cylinder. $\endgroup$ Commented Apr 30, 2024 at 20:31
  • $\begingroup$ Image with vertices from previous comment i.sstatic.net/TMj5vBfJ.png. $\endgroup$ Commented Apr 30, 2024 at 20:34
1
$\begingroup$

This is just out of curiosity regarding @DanielHuber comment.

If you image the points to be electrical charged and considers the energy, then the configuration with 45 degree rotated faces has lower energy. Therefore, I would vote for this configuration to be more evenly distributed.

Graph3D with GraphLayout -> "SpringElectricalEmbedding" outputs cube which can be verified by DistanceMatrix that is same as for cube.

Graph3D[{{1, 2}, {2, 4}, {4, 3}, {3, 1}, {5, 6}, {6, 8}, {8, 7}, {7, 
   5}, {2, 6}, {4, 8}, {3, 7}, {1, 5}}, VertexLabels -> Automatic, 
 GraphLayout -> "SpringElectricalEmbedding"]

DeleteDuplicates[GraphEmbedding[%] // DistanceMatrix // Flatten, 
 Abs[#1 - #2] < 0.01 &]

{0, 1, Sqrt[2], Sqrt[3]} // N

enter image description here

{0., 0.999451, 1.41355, 1.73142}

{0., 1., 1.41421, 1.73205}
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.