# General Formula for Volume of Spherical Triangle

I'm working on a problem for which I'm trying to divide a sphere into layers defined by integer radius values ($r\in{1, 2, ...}$) such that the segments in each layer all have the same volume. Doing so seems feasible, since I can use the volume $\frac{\pi}{3}$ for each segment and thus get $4 (r^3-(r-1)^3)$ segments in each layer.

I have some ideas about how to try to divide the segments (maybe using spherical Voronoi tessellation to define the sides projected from the sphere's center), but to confirm that any approach I use works, I need to be able to calculate the volume of the segments I generate. I figure that, at the least, I can break down any segments with polygonal tops into spherical triangles and add their volumes, but that means I need to be able to calculate the volume of a spherical triangle wedge. In other words, given this shape:

I want to be able to calculate a portion of the enclosed volume as specified by a lower and higher radius for the region.

My maths are not very solid, so I have not been able to figure out how to calculate the volume given three general points. I have an approach that seems to work by rotating the points so the longest segment is along the equator first by rotating the shape, but that seems like a lot of overhead, especially if I need to use something like a genetic algorithm to determine the partitions:

• Let $P$ and $Q$ be the furthest apart points in the triangle, and $R$ is the third point. Let $C(x)$ convert a spherical coordinate into Cartesian coordinates, and $S(x)$ convert a Cartesian coordinate into spherical coordinates. $P$, $Q$, and $R$ are defined in spherical coordinates.
• Determine the axis of rotation from $P$ to $Q$ with $n$ = $\left\|C(Q) \times C(P)\right\|$.
• Determine the axis about which to rotate the sphere so that axis of rotation becomes the up vector: $u = \left<0, 1, 0\right> \times n$.
• Get the angle between the current axis of rotation $n$ and the intended axis $\left<0,1,0\right>$ by $\theta = n \cdot \left<0,1,0\right>$.
• Build the rotation matrix $R$ using the vector $u$ and the angle $\theta$ as shown at Wikipedia.
• Rotate the Cartesian points by multiplying them by the rotation matrix: $p' = Rp$, etc.
• Convert the Cartesian points back into spherical points: $P' = S(p')$, etc.
• Plug the values into the following formula resulting from a triple integral I spent a long time solving with help from Wolfram Alpha:
• $V = \frac{2}{3(\pi-2R_\phi')}(\rho_1^3 - \rho_0^3)(\sin(R'_\phi)-1)(P'_\theta-2R'_\theta+Q'_\theta)$ where $\phi$ is an altitudinal angle rotating down away from $\left<0,1,0\right>$, $\theta$ is the azimuthal angle rotating about $\left<0,1,0\right>$, $\rho_0$ is the shorter radius, and $\rho_1$ is the longer radus.

This process is really involved, and my confidence in my math is such that I am pretty sure that there are errors in it somewhere. Is there a more general algorithm for calculating this volume? Or, at least, could someone confirm that my approach works?

-
If the Cartesian coordinates are known, then you can use a formula by Oosterom and Strakee: $$\tan\frac{\Omega}{2} = \frac{|\vec{a}\cdot ( \vec{b} \times \vec{c} )|}{abc + (\vec{a}\cdot\vec{b})c + (\vec{c}\cdot\vec{a})b + (\vec{b}\cdot\vec{c})a}$$ to compute the solid angle $\Omega$ span by 3 vectors $\vec{a}$, $\vec{b}$ and $\vec{c}$ and the volume of the spherical "shape" is simply $\frac{\Omega}{3} r^3$. Look at the wiki page for Solid angle, there might be other formula you will find useful. –  achille hui Sep 10 '13 at 23:38
Isn't what you are looking for just $V=\frac{1}{3}rA$, where $r$ is the radius of the sphere and $A$ is the area of the triangle. There are many standard formulas for computing $A$. –  Andrey Sokolov Sep 11 '13 at 1:06
@achillehui I have now read that paper; it's over my head. If I understand their formula correctly, the numerator is the absolute value of the dot product of the first vector with the cross product of the other two, the letters without the vector bars are the great-circle arcs forming the triangle, and then I can use this $\Omega$ to calculate the volume I want by $\frac{\Omega}{3}(r^3-(r-1)^3)$? –  gamecoder Sep 11 '13 at 14:48
I scanned the paper again and caught the dot product formula written using this notation. $\vec{a}$ is a vector and $a$ is that vector's magnitude. –  gamecoder Sep 11 '13 at 15:16
add comment