sphere_grid, an Octave code which constructs a variety of sets of points over the surface of a sphere in 3D.

A grid on a sphere may mean a set of points, or a set of points and lines that connect them, or a set of points, lines that connect them, and the faces that are bounded by those lines.

A grid may be desired which simply organizes areas. In that case, something like the latitude and longitude lines on a globe may be sufficient, even though "evenly spaced" latitude and longitude lines result in grid cells that are close to rectangular near the equator, but become more asymmetric near the poles.

A grid may also be desired for sampling, that is, for choosing a set of points that are well spread across the sphere. A simple Monte Carlo approach can be used, although this means that the data is only well spread out in the long view; there may be local clusters and gaps.

Other grids are generated by drawing a spiral on the surface of the sphere, and choosing points at regular spacings along that line, or by projecting an icosahedron onto the surface of the sphere, which divides the surface into 20 congruent spherical triangles, and then dealing with the simpler issue of choosing points from the triangles.


The computer code and data files described and made available on this web page are distributed under the MIT license


sphere_grid is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version.

Related Data and Programs:


octave_grid, an Octave code which generates a regular grid of points inside a variety of regions in one, two, three or many dimensions.


  1. Edward Saff, Arno Kuijlaars,
    Distributing Many Points on a Sphere,
    The Mathematical Intelligencer,
    Volume 19, Number 1, 1997, pages 5-11.

Source Code:

Last revised on 25 March 2019.