# Spherical coordinates to cartesian coordinates.

I want to find out the distance between the centers of $2$ circles. Say, circle $1$ $(\theta,\phi)$ circle $2$ $(\theta,\phi)$

The radius of this circle is found using $d\tan(\theta)$ where $d$ is the range (different from radius)

$$cd=\sqrt{(x_1-x_2)^2 + (y_1-y_2)^2 + (z_1-z_2)^2}$$ is the formula I'm going to use to find out the distance between the $2$ points.

But can anyone help me in defining $x$, $y$ and $z$?

I know to convert it to Cartesian coordinates if say the points are $(r,\theta)$ where $r$ is the radius [$2$ dimensional]

cd is a euclidean distance between the centre of circle#1 (formed due to angles az(t,n),el(t,n) in space from transmitter t, at trial n and distance d away from origin) and circle#2 (formed due to angles az(r,n),el(r,n) in space from receiver r, at trial n and distance d away from origin)

-
It is difficult to understand what you are asking. –  copper.hat Dec 10 '12 at 16:44
the centers of the circles are defines by angles say (theta, phi) I need to find out the distance between the centers of the 2 circles using cd=sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2) but I do not know what x, y and z are –  Nidhi Dec 10 '12 at 16:45
but r1 and r2 are the radius. I have 2 angles as my center. will the formula still work? –  Nidhi Dec 10 '12 at 16:49
my problem is 3 dimensional. :( –  Nidhi Dec 10 '12 at 16:49
I am not sure I understand exactly what you are asking. What do you mean by saying that you have a circle given by $(\theta, \phi)$? –  Thomas Dec 10 '12 at 16:50
show 3 more comments

In spherical coordinates, and generally in $\mathbb R^3$, it takes three coordinates to specify a point. If you only have $\phi, \theta$ you have a ray from the origin. You need the distance from the origin to get a point. Then, given $(r,\theta,\phi)$ for each point you can convert to Cartesian coordinates with $x=r \sin \theta \cos \phi, y=\sin \theta \sin \phi, z=r \cos \theta$

Added, based on your comment: The easiest is to erect a coordinate system at each transmitter. From transmitter 1, you know the point is at $(r_1,\theta_1,\phi_1)$, which you can convert to $(x_1,y_1,z_1)$. Then from transmitter 2, you know the vector is $(r'_2,\theta'_2,\phi'_2)$ where the primes indicate that the coordinate system is centered on transmitter 2. Hopefully your axes are aligned, that makes it easier. Convert this to $(x'_2,y'_2,z'_2)$, still referenced to transmitter 2. Then if transmitter 2 is at $(t2_x,t2_y,t2_z)$ in the transmitter 1 frame, the second point is at $(x'2+t2_x,y'_2+t2_y,z'_2+t2_z)$. Now you can use the usual Cartesian distance function.

-
No I have tried this but the problem is will r be the radius or the range. I have 2 different parameters. I'll try to attach a figure –  Nidhi Dec 10 '12 at 16:59