# spherical interpolation in triangle

Is there a formula or algorithm with which one can interpolate the points of a triangle that lies on the unit sphere in a spherical manner?

Let me elaborate:

If you want to interpolate two points on a unit sphere spherical, you use slerp.

If you want to interpolate between points of a planar triangle, you probably want to use barycentric coordinates.

My overall goal is to create points within the triangle of the sphere which are evenly positioned, in regards to their angle, if possible.

In particular, I want to do create a geodesic polyhedron (based on an icosahedron) in which the triangles on the surface of the approximated sphere are as evenly spread as possible, without the points closer to an original corner of the icosahedron having smaller distances to each other than those in the middle.

My approach do to so so far was to interpolate spherical on two of the edges using slerp, and then between the points created in this manner, but a more direct approach over something like barycentric coordinates would be appreciated.

• What if you expand the triangle to the entire surface of a sphere? What kind of distribution of points do you want to construct? – Somos Jul 6 '19 at 16:19
• A geodesical polyhedron, as written above. And what do you mean by expanding it to the entire surface of a sphere? You can't approximate a sphere with a single triangle. – Aziuth Jul 6 '19 at 17:01

Hint:

Perform slerp on two edges with the same fraction $$u$$. This gives you two points that define an arc of a great circle. Repeat with another pair of edges and a fraction $$v$$. This gives you a mapping of $$(u,v)$$ to the inside of the triangle.

Of course you can define a third pencil of great circles based on the remaining pair of sides and a parameter $$w$$. Remains to establish the relation between $$u,v$$ and $$w$$ and check that it is isotropic.

• Slerp is not associative, therefore I did not proceed with it. – Aziuth Aug 8 '19 at 9:27

I read further into Slerp and found out that it is not associative, which makes it a bad choice for nested application, as the order in which it is applied matters.

Further search into the topic yielded the paper Spherical Averages and Applications to Spherical Splines and Interpolation by Samuel R. Buss and Jay P. Fillmore.

The paper presents the concept of a spherical centroid.
For given points $$p_1,...,p_n \in S^d$$, given weights $$w_1,...,w_n$$ with $$w_i \geq 0$$ and $$\sum_i w_i = 1$$, and the spherical distance $$d_S(\cdot,\cdot)$$ (arc length of the shortest path between two points on the unit sphere, equals their angle), the spherical centroid is defined as

$$argmin_{C \in S^d} \sum_i w_i \cdot d_S(C, p_i)^2$$

Afther that, they state a proof that this is uniquely defined if all $$p_i$$ lie within a common hemisphere.

If we use this with three points, the weights work pretty much like barycentric coordinates, just what I wanted.

The paper also contains algorithms on how to compute this and I successfully implemented them in C++.

If your goal is to create a triangulation of a sphere that does not have singularities at the poles (as lat/lon rectangles do), look into the Quaternary Triangular Mesh or QTM devised by Geoffrey Dutton.

It starts with an octahedron inscribed in a sphere. Each triangle is called a "facet". If a facet is too big, it is divided into four facets by connecting the midpoints of the edges. Do this recursively until facets are small enough. You don't need to do it universally if you need different resolution in different areas. Assuming you do it universally, the ratio of the area of the smallest triangle to the largest one approaches 11/6, not zero as in the case of lat/lon rectangles.

Given lat/lon coordinates of a point, the facet in which that point appears can be found with time proportional to the degree of refinement. If done universally, the time complexity is the logarithm of the number of facets. Refining to nine levels yields facets with edges about 1.5 degrees.

You might also find Icosahedral Snyder Equal Area Hexagons, or ISEAH, to be useful. It's more complicated than QTM. I'm not related to John Snyder.

• No singularities was already solven by me using icosahedrons in general. Recursively subdividing facets wouldn't be a solution as I need to have strong control over the granularity. Such a method would have the amount of polygons rise exponentially over the amount of steps, while doing a subdivision with a given frequency once only has them rising quadratically with the frequency - far easier to control. – Aziuth Apr 25 '20 at 18:07
• My basic goal is to spread the resulting nodes as evenly as possibly over the globe. In my project, I initially create a approximated sphere (here I need this) and then further process that sphere (what exactly I do is unrelated). ISEAH sounds interesting, but doing a short search, I haven't found any source that explains the actual algorithm. – Aziuth Apr 25 '20 at 18:10
• (Latitude and longitude are not really a topic for me. Am using them to compare them to my algorithm, but they are pretty bad to begin with. Or better to say, am comparing things to a zig-zag polar coordinate method, as I don't want to have any squares.) – Aziuth Apr 25 '20 at 18:13