# Transformation matrix between carthesian to spherical coordinates to draw parallel circumferences

I've seen some algorithms with the following transformation matrix:

In such an algorithm, this matrix is used to draw some parallel circumferences on a sphere, i.e. the blue circumferences in the following figure:

Each curve is approximated as a set of points (so each circumference is approximated with a polygon). Each point is defined with the spherical coordinates $$\rho, \phi, \theta$$.

I want to find out some informations about this matrix. It seems to contain the classical transformation matrix from cartesian to spherical coordinates:

but it as another coloumn at right. Why has this been inserted in my matrix?

$$X_c, Y_c, Z_c$$ express the centre of the sphere.

• Cartesian, after the Philosopher and Mathematician René Descartes. – Bazin Mar 20 at 16:59

Too long for a comment. The mapping $$\mathbb R_+\times (-π, π)\times (0,π)\ni(r,\theta, \phi)\mapsto (x,y,z)$$ is given by$$\begin{cases} x=r \cos \theta\sin\phi\\ y=r \sin \theta\sin\phi\\ z=r\cos \phi \end{cases}$$ and its differential is $$\begin{pmatrix} \cos \theta\sin\phi& -r \sin \theta\sin\phi&r \cos \theta\cos\phi\\ \sin \theta\sin\phi&r \cos \theta\sin\phi&r \sin \theta\cos\phi\\ \cos \phi&0&-r \sin\phi \end{pmatrix}.$$ Permuting the second and third row, making $$r=1$$ you get $$\begin{pmatrix} \cos \theta\sin\phi& \cos \theta\cos\phi& - \sin \theta\sin\phi\\ \sin \theta\sin\phi& \sin \theta\cos\phi& \cos \theta\sin\phi\\ \cos \phi&- \sin\phi&0 \end{pmatrix}.$$ The longitude lines are defined by $$\theta=\theta_0$$ and the latitude lines by $$\phi=\phi_0$$ (the latitude is $$\frac π2-\phi_0$$, positive on the northern hemisphere, negative on the southern). What was the use of your $$4\times 4$$ matrix?