# Vectors and coordinate transformations

• Jan 8th 2012, 04:03 PM
UsualSuspect
Vectors and coordinate transformations
Hi all,

Got a problem here I was hoping you could help me with.

I have a point P in a spherical coordinate system, and I'll let the origin be called the point Q to simplify my explanation. The distance from Q to P is fixed, H. but P can rotate around Q, so that $\phi_Q \text{ and } \theta_Q$ are variable.

Now, take P to be the origin of a second spherical coordinate system, from which distance measurements are made to arbitrary points $(r,\theta_P ,\phi_P )$. What I want to do is to convert the arbitrary distance measurements from point P into cartesian coordinates relative to the "Q" coordinate system - baring in mind that P may change position relative to Q.

I can convert from spherical to cartesian coordinates around the P origin using the formulas:

$x=r\sin\phi_P\cos\theta_P$
$y=r\sin\phi_P\sin\theta_P$
$z=r\cos\phi_P$

And I can get the cartesian coordinates for P within the Q coordinate system, using the same formulas. The problem is that the orientation of the P coordinate system changes depending on the location of P (The angles $\phi_Q$, and $\theta_Q$ ). If the vector QP points in the positive z direction of the Q coordinate system (P lies on the z-axis), then take the x-axis (Or datum point) of the P coordinate system to be parallel with the x-axis of the Q coordinate system, and pointing in the positive direction.

The unit vector i=[1,0,0] in the P system (Pointing along positive x-axis), will remain perpendicular to vector QP (With Q, P, and $(1,0,0)_P$ lying in the same plane), as the point P is free to orbit around Q. This is what I can't get my head around, but my maths is rusty to say the least, and I have an inkling I will need a vector calculation of some sort, like dot product/cross product, but can't think how to go about it.

I hope I made my explanation clear enough for you to visualise the situation - had a hard time trying to describe it. :)

Cheers
• Jan 10th 2012, 08:55 AM
Ackbeet
Re: Vectors and coordinate transformations
If I understand your problem correctly, you need to do vector addition. The coordinates of point $P$ as measured in the $Q$ coordinate system are

$x_{1}=H\sin(\phi_{Q})\cos(\theta_{Q})$

$y_{1}=H\sin(\phi_{Q})\sin(\theta_{Q})$

$z_{1}=H\cos(\phi_{Q}).$

The coordinates of the point in the $P$ coordinate system, which I'll call point $R,$ as measured in the $P$ coordinate system are as you've written: $\langle x,y,z\rangle$. Using vector addition, the coordinates of point $R$ as measured in the $Q$ system must be

$x_{1}+x$

$y_{1}+y$

$z_{1}+z.$

From there, you can form the full expression as a function of the distances and angles you've been given. Can you finish?
• Jan 16th 2012, 11:11 AM
UsualSuspect
Re: Vectors and coordinate transformations
Thanks for the reply. The thing that was stumping me was the fact that as P changes position, the orientation of the P coordinate system changes in a way that depends on P's position around a sphere centered on the origin of the Q coordinate system. In the 'default' state, P's axes are aligned in the same way as Q's axes so that respective x-y, x-z, and y-z planes are parallel when P is in the 'default' position.

I realized after thinking a little more that as P moves around the sphere, away from its default position, the difference in angular displacement of the vector from P to Q in the new position, to the vector from P to Q in the default position, is equal to the change in angle of the axes of the P coordinate systems. So when converting points in the P coordinate system from spherical to Cartesian coordinates in order to allow me to do the vector addition you mentioned, all I had to do was to first subtract the angular displacements of the PQ vector (From the Q coordinate system) from the spherical angles to the point in the P coordinate system.

I probably could have explained that better, but hopefully it will help someone, Thanks anyway