Create points evenly on a sphere

I am interested in creating points that are “evenly” (and not coincidentally) distributed around a sphere, like the dimples of a golf ball or the vertices of hexagons on a soccer ball. Are there any specific algorithms for this?

Note. I know that the points are not really "evenly" distributed over the sphere, but they are distributed in such a way that the distribution of the points looks the same from any direction that looks directly at any of the points - this is what interests me.

+3
source share
7 answers

. . .

psuedo ++, :

/* Assume 'data' initially holds vertices for eight triangles (an octahedron) */
void GenerateSphere(float radius, std::vector<Vector3f>& data, int accum=10)
{
    assert( !(data.size() % 3) );

    std::vector<Vector3f> newData;

    for(int i=0; i<data.size(); i+=3){
        /* Tesselate each triangle into three new ones */
        Vector3f centerPoint = (data[i] + data[i+1] + data[i+2]) / 3.0f;

        /* triangle 1*/
        newData.push_back(data[i+0]);
        newData.push_back(data[i+1]);
        newData.push_back(centerPoint);
        /* triangle 2*/
        newData.push_back(data[i+1]);
        newData.push_back(data[i+2]);
        newData.push_back(centerPoint);
        /* triangle 3*/
        newData.push_back(centerPoint);
        newData.push_back(data[i+2]);
        newData.push_back(data[i+0]);
    }
    data = newData;
    if(!accum){
        /* We're done. Normalize the vertices,
             multiply by the radius and return. */
        for(int i=0; i<data.size(); ++i){
            data[i].normalize();
            data[i] *= radius;
        }
    } else {
        /* Decrease recursion counter and iterate again */
        GenerateSphere(radius, data, accum-1);
    }
    return;
}

, , .

+1

.

  • , , [0, 1] ^ 3

  • . , 1, , 1.

  • , , .

. , , , .

0

, , , , . , :

. http://elenzil.com/progs/randompoints. , , , , worlfram.

-, "" , , . , , . : http://elenzil.com/progs/separate, , , , .

0

:

  • .
  • ( )
  • , 4- - .
  • repeats until a sufficient number of points has been created.

This works as long as accuracy does not destroy uniformity. The resulting points form figures that are similar to geodesics.

You do not need to calculate any surface, since each new triangle does not exceed all the previous ones. Just process them in FIFO order.

0
source

All Articles