12

Let's say I have a D-dimensional sphere with center, [C1, C2, C3, C4, ... CD], and a radius R. Now I want to plot N number of points evenly distributed (equidistant apart from each other) on the surface of the sphere. It doesn't matter where those points are exactly, just that they are ROUGHLY equidistant from each other. I want a function that returns an array of these points, P.

function plotter(D, C[1...D], R, N)
{
   //code to generate the equidistant points on the sphere

   return P[1...N][1...D];
}

3-dimensional sphere with many points

3-dimensional sphere with a few points

Dane Iracleous
  • 1,659
  • 2
  • 16
  • 35
  • This is mathematically quite technical to get right. I'd ask this on math.stackexchange.com instead. But just phrase it as points on a unit D-Sphere (as the scaling and translation to make it radius R, centered at (c_1, ..., c_D) is trivial. – Michael Anderson Oct 03 '12 at 02:57
  • I haven't fully thought this through, so it might not make sense. What if you start with any point (say (R, 0, 0, ..., 0) and assume the sphere is centered at the origin). Now rotate that point in D-1 axes (shouldn't matter which but be consistent) by an angle of theta/(N-1) and put a new point there (this will involve a lot of [matrix multiplication](http://en.wikipedia.org/wiki/Rotation_matrix#General_rotations). Do this N-1 times. This might get you want you want, but I apologize if it fails horribly as I haven't thought it all the way through. – Michael McGowan Oct 03 '12 at 03:05
  • You could create a random solution then anneal it. Create N random points on the D-Sphere. Evaluate it using a measure for uniformity. Randomly tweak a random point. If that improves the measure, keep the tweak, else undo it. Repeat until tired. – NovaDenizen Oct 03 '12 at 06:53
  • 1
    The tag says "3D", the question says "D-dimensional sphere". Which is it? There are a number of mechanisms to spread points (somewhat) uniformly over the 2-sphere (that's a sphere in 3 dimensional space). In general there is no nice solution because even the 2-sphere does not form a topological group. The only ones that do are the 0-sphere (a pair of points), the 1-sphere (a circle), and the 3-sphere (one representation of which is the unit quaternions). – David Hammen Oct 03 '12 at 07:27
  • possible duplicate of [random unit vector in multi-dimensional space](http://stackoverflow.com/questions/6283080/random-unit-vector-in-multi-dimensional-space) – Ali Oct 03 '12 at 08:31
  • possible duplicate of [Generate random 5d vector of given magnitude](http://stackoverflow.com/q/12591241/341970) – Ali Oct 03 '12 at 08:32
  • @Ali this question is not a duplicate. – Ivan Kochurkin Oct 03 '12 at 13:57
  • @KvanTTT Could you please explain the significant difference? I don't see it... :( – Ali Oct 03 '12 at 14:32
  • 1
    @Ali solutions involving random points are just one class of solutions to this problem. I for instance would be interested in a solution that would involve creating a n-sphere as an extruded (n-1)-sphere (though I don't know if that can be done, but it seems realistic). – Peter Jankuliak Oct 03 '12 at 15:12
  • 2
    I don't see why this is a duplicate : here, the question is to generate *evenly* distributed points. This is not necessarily the same as randomly distributed (although this can be an option if we have a flexible definition of "evenly"). – nbonneel Oct 05 '12 at 01:38
  • 1
    related links http://www.rhinocerus.net/forum/lang-idl-pvwave/117743-equally-spaced-points-hypersphere.html http://mathoverflow.net/questions/30270/maximum-number-of-mutually-equidistant-points-in-an-n-dimensional-euclidean-space – Ray Tayek Oct 05 '12 at 02:14
  • @RayTayek, sorry, it's seems my mistake) – Ivan Kochurkin Oct 05 '12 at 16:48
  • 1
    It's easy to come up with an algorithm to do this, but whether it's practical depends on D and the total number of points. If D is small, 2 (very easy), 3 or 4, some of the answers suggesting annealing or repulsion might work. But if D is say fifty, and P is a few million, that's not the way to do it. – DarenW Oct 12 '12 at 05:54
  • (I meant N not P for number of points) – DarenW Oct 12 '12 at 06:01
  • @DarenW I am facing this problem right now! D is like fifty! And P is around 1000. Do you know of any method even if only an approximation? – gota Mar 02 '18 at 15:13

3 Answers3

6

Several options :

  • Randomly throw points on the sphere and use a Lloyd relaxation to make them uniformly spread : you iteratively compute their Voronoi diagram and move them toward the center of their Voronoi cell (instead of working on the sphere, you may want to use an euclidean voronoi diagram restricted to the sphere : CGAL can fo that for instance, or refer to my article).

  • If a rough approximation is fine (ie., if a uniformly random distribution is good enough), you can use the formula explained on Wiki : N-Sphere . If not, you can still use this random sampling as the initialization of the method above

  • For a still random but better notion of equidistant samples, you can generate a Poisson-disk distribution. Fast code in high dimension is available at Robert Bridson's homepage . You may need to adapt it for a spherical domain though.

nbonneel
  • 3,286
  • 4
  • 29
  • 39
1

I don't know if this has been mentioned here yet; but you could, as others have suggested draw points from the uniform distribution on the sphere. After which, flow each point according to columb energy; using a gradient descent method. This particular problem has received a lot of attention. Check out the following paper and this website

Arvind
  • 119
  • 1
  • 8
  • 1
    As a plug I've written python code for [generating well-ordered distributions of points on the sphere](https://github.com/arvsrao/SpherePoints). – Arvind Feb 13 '14 at 21:20
  • Do you know where to find an implementation for the n-sphere? (n>2) – gota Mar 02 '18 at 15:09
  • @gota don't know. But I don't see why one couldn't apply a technique for S^2 to higher dimensional spheres. – Arvind Mar 11 '18 at 21:03
0

The only way I can think of that should produce good results is.

  1. Generate N points on the sphere surface. The usual way to do this for high dimensions is to generate the points acording to an D-dimensional normal distribution and normalise back to the sphere. These will not be equally spaced - so we need step two
  2. Next make each point repel other points using some repulsions function and use a small time-step, you adjust the direction of movement to be tangential to the D-Sphere. Move the point and then repoject back to the sphere. Keep doing this until you consider the points even enough.
Michael Anderson
  • 70,661
  • 7
  • 134
  • 187