There are several questions on this site about distributing points on the surface of a sphere, but all of these are based on actually generating all of the points on that sphere. My favorite thus far is the golden spiral discussed in Evenly distributing n points on a sphere.
I need to cover a sphere in trillions of points, but only ever need to actually generate a tiny region of the surface (earth down to ~10 meters, looking at a roughly 1 km^2 area). The points generated for that region must match the points that would be generated for the entire sphere (i.e., stitching small regions together must yield the same result as generating a larger region), and generation should be pretty fast.
My attempts to use the golden spiral with such a large number of points have been thwarted by floating point precision issues.
The best I've managed to come up with is generating points at equally spaced latitudes and calculating longitudinal spacing based on the circumference at that latitude. The result is far from satisfactory however (especially the resulting horizontal rings of points).
Does anyone have a suggestion for generating a small region of distributed points on the surface of a sphere?
CodePudding user response:
The vertices of a geodesic sphere would work well in this application.
You start with an icosahedron, divide each face into a triangular mesh of whatever resolution you like, and project the points onto the surface of the sphere.
CodePudding user response:
You could use a spherical coordinate system to approximate an even gridding, creating adjustments based on empirical experimentation and known requirements.
For example in the coordinate system each point is uniquely determined by a coordinate (r,phi,theta)
, here we can assume r = 1
for the unit sphere, and phi \in [0,2*pi)
and theta \in [0,pi)
.
If you create an equal gridding for phi and theta, undoubtedly the result will look poor.
To account for corrections to the girdding define each point via the coordinates as (r,g(phi),h(theta))
, where g
and h
are functions that will be fit empirically to produce "good" results.
Since your favorite method is the golden spiral method, you can fit g
and h
to approximate the golden spiral. One approach to fit g
and h
would be
- Compute the golden spiral fully on a sphere of
N << trillion
points. - Compute the spherical coordinate representation of these points.
- Start simple and assume
g
andh
are polynomial functions and fitg
andh
by computing the fit forg(x)=y
,h(x)=y
wherex
are uniformly spaced grid points in their respective domains andy
are the values calculated by the golden spiral method.
Step 3 may need refinement, experimentation, or revision of what form of function g
and h
should take (may require something other than polynomials.)
Once g
and h
are fit and you are happy with the results, you have an analytic form to calculate the the position of any subset of points.