# Formula for the coordinate of the midpoint in spherical coordinate system

Please let me know the formula for the coordinate of the midpoint of 2 points in spherical coordinate system . If possible , I want the answer includes the exact formula as , midpoint = point1 + ( point2 - point1 ) / 2 .

Thank you very much

Thank you very much for the answer. Is it necessary to compute the Cartesian coordinate of the midpoint ? No means to compute directly the spherical coordinate of the midpoint ?

Thank you for the second answer . I am happy to know that I must use Cartesian coordinate system for the purpose .

Please someone let me know how to mark the answer as my accepted answer. There is no button for the purpose on my page .

-
This will (most-likely) be messy... What you don't like about Cartesian coordinates? – Fabian Apr 30 '11 at 6:32
"No means to compute directly the spherical coordinate of the midpoint?" - Doing coordinate conversions will result in a direct formula. The thing is, spherical coordinates are poorly suited for systems where you need to do translations, segment cuts, and other such operations where Cartesian coordinates are more "natural"... – J. M. Apr 30 '11 at 8:23
FYI - this problem is trivial with Homogeneous Coordinates. – ja72 Apr 30 '11 at 17:19
Hi seven_swodniw: You have two accounts and they must be merged before you can accept an answer. I informed the moderators and they should take care of that soon. These problems will go away when you register. – t.b. Jun 14 '11 at 3:45
To Theo Buehler : Thank you very much . I finally finished to accept the answer . – seven_swodniw Jun 16 '11 at 8:02

You can use the general formulas for converting between Cartesian and spherical coordinates to do this:

$$\left(\begin{array}{c}x\\y\\z\end{array}\right)=\left(\begin{array}{c}r\sin\theta\cos\phi\\r\sin\theta\sin\phi\\r\cos\theta\end{array}\right)\;,$$

so the midpoint between two points $1$ and $2$ is

$$\frac{1}{2}\left(\begin{array}{c}x_1+x_2\\y_1+y_2\\z_1+z_2\end{array}\right) =\frac{1}{2}\left(\begin{array}{c}r_1\sin\theta_1\cos\phi_1+r_2\sin\theta_2\cos\phi_2\\r_1\sin\theta_1\sin\phi_1+r_2\sin\theta_2\sin\phi_2\\r_1\cos\theta_1+r_2\cos\theta_2\end{array}\right)\;.$$

Then you can substitute this into the expression for the spherical coordinates in terms of the Cartesian coordinates:

$$\left(\begin{array}{c}r\\\theta\\\phi\end{array}\right)=\left(\begin{array}{c}\sqrt{x^2+y^2+z^2}\\\arccos(z/\sqrt{x^2+y^2+z^2})\\\arctan(y/x)\end{array}\right)\;.$$

-
where arctan still has to be defined properly, such that $\phi \in [0,2\pi]$. – Fabian Apr 30 '11 at 7:10
@Fabian: correct, depending on the signs of $x$ and $y$; on a computer, this would typically be done using the atan2 function. – joriki Apr 30 '11 at 7:11
Thank you very much for the answer. – seven_swodniw Apr 30 '11 at 7:33
Heh, I was talking about this the other day... some people have $\phi$ be the longitude and $\theta$ be the co-latitude, while others (me included) use $\theta$ as the longitude and $\phi$ as the co-latitude. So kids, be careful with using spherical coordinate formulae! :) – J. M. Apr 30 '11 at 7:53