**0**

# Converting a rotation to spherical coordinates

###
#1
Members - Reputation: **501**

Posted 11 March 2007 - 04:13 PM

###
#2
Members - Reputation: **501**

Posted 13 March 2007 - 01:22 AM

###
#3
Members - Reputation: **1003**

Posted 13 March 2007 - 02:12 AM

Setup the equation

**v**=

**w**X

**r**

**v**is known,

**r**is known,

**w**is sought. Solve for

**w**.

Then project

**w**onto your axes to determine the contribution around the axes of interest.

###
#4
Members - Reputation: **501**

Posted 13 March 2007 - 03:08 AM

Quote:

Original post by Omid Ghavami

Then projectwonto your axes to determine the contribution around the axes of interest.

Care to elaborate?

###
#5
Members - Reputation: **1003**

Posted 13 March 2007 - 03:47 AM

Quote:

Original post by NumsgilQuote:

Original post by Omid Ghavami

Then projectwonto your axes to determine the contribution around the axes of interest.

Care to elaborate?

Orthogonal projection of

**u**on

**v**!= 0 is given by

<u,v>u^{'}= ------v

|v|^{2}

EDIT: hmpf, bold text doesn't show inside code clause, too bad.

Where <

**a**,

**b**> is the inner product (dot product) and |

**v**| is the 2-norm, ie the length of vector.

EDIT: noticed the equation don't look that great (When is GD going to support LaTeX? [wink]), if it's unclear it says:

The inner product (dot product) between

**u**and

**v**divided by the squared norm of

**v**, unless

**v**is normalised in which case the divition will be by 1 and hence unnecessary. This will be a scalar which is then multiplied by the vector

**v**to produce the orthogonal projection of

**u**on

**v**, here donted

**u**

^{'}

###
#6
Members - Reputation: **1003**

Posted 13 March 2007 - 04:07 AM

<u, v> = |u| * |v| * cos(a)

Where a is the angle between the vectors. Now what's interesting here is that we see the term |u| * cos(a), which by trigonometry we know will be the component of u in v's direction.

% u

/

/

/) a

------> v

So if we now divide <u, v> by |v| we get |u| * cos(a), which is u magnitude in v's direction. This is however a scalar value but we want a vector. So we want a vector in v's direction whose magnitude is |u| * cos(a). So we normalise v by dividing it with |v| and then multiply the normalized vector with |u| * cos(a).

The end result is as stated earlier

<u, v> / |v| * v / |v| = <u, v> v / |v|

^{2}

###
#7
Members - Reputation: **501**

Posted 13 March 2007 - 04:33 AM

*what*to project on to. There are 3 possible planes of interest. z = 0, y = 0, and x = 0. I have only 2 terms, phi and theta (or longitude and latitude).

The issue is also complicated by the fact that facing North on the equator, and facing north 1 mm from the North Pole, give almost orthogonal directional vectors in euclidean space. But they are the same direction in geodesic space (that is, the topology of the surface of a sphere). Very confusing.

What's really happening is that the rotation is being defined by the player's position on the sphere. The great circle that passes through the player's position and is parallel in direction to the player's direction at the player's position forms the forward/backward rotation. The great circle perpindicular to this forms the left/right rotation. The forward/backward great circle probably coudl be corresponded pretty well to longitude. Both are great circles.

Latitude is not built from great circles. So I don't think an easy correspondance exists.

I dunno, the whole thing just stumps me.

###
#8
Members - Reputation: **1003**

Posted 13 March 2007 - 04:46 AM

**e**

_{r}= (sin(θ)cos(φ), sin(θ)sin(φ), cos(θ))

**e**

_{θ}= (cos(θ)cos(φ), cos(θ)sin(φ), -sin(θ))

**e**

_{φ}= (-sin(φ), cos(φ), 0)

**v**(R,θ,φ) = R

**e**

_{r}+ θ

**e**

_{θ}+ φ

**e**

_{φ}

EDIT:

**e**

_{θ}and for φ project on

**e**

_{φ}.

Or even better after giving it some thought perhaps the best way would be to:

**v**= v

_{R}

**e**

_{r}+ v

_{θ}

**e**

_{θ}+ v

_{φ}

**e**

_{φ}

Where

v

_{R}= dR/dt

v

_{θ}= R * dθ/dt

v

_{φ}= R * dφ/dt * sin(θ)

Where

**v**is known in cartesian coordinates, the base vectors are known for the current position, since θ and φ are known for the current position. So you get three equations with two unknown, namely dθ/dt and dφ/dt, since you already know dR/dt = 0. Solving that will give you the change in θ and φ.

[Edited by - Omid Ghavami on March 13, 2007 11:46:55 AM]

###
#9
Members - Reputation: **501**

Posted 13 March 2007 - 05:19 AM

###
#10
Members - Reputation: **1003**

Posted 13 March 2007 - 05:46 AM

**R**to the z-axis, whilst φ is measured from the projection of

**R**in the x-y plane to the x-axis.

The base unit vectors are then defined so that:

**e**

_{R}is in the direction in which movement would increase R but not alter θ and φ.

**e**

_{θ}is in the direction in which movement would increase θ but not alter R and φ.

**e**

_{φ}is in the direction in which movement would increase φ but not alter R and θ.

Note that these base vectors are only valid for the state, they will change change as soon as

**R**changes. Now since

**e**

_{R}points in the direction of our point, the position of a given point is entirely determined by

**R**= R

**e**

_{R}.

It won't however remain that simple when we take the time derivative, since

**e**

_{R}changes with time. Taking the time derivate we will reach the presented equation for the velocity

**v**. The derivation is pretty straight forward but it's difficult to type it in here since there is no support for math expressions, so I won't do that.

We now have an expression for the time derivative of the position vector, and we also know the numerical values for the components of the velocity in cartesian coordinates. We also know the spherical coordinate base vectors in cartesian coordinates, so we get three equations, one for each cartesian component. There will be three unknown, these are dR/dt, dθ/dt, dφ/dt. Three equations, three unknowns, sounds promising. We also happen to know that dR/dt = 0, so we only need to consider 2 of the equations.

Solving this will give us what we sought.

###
#11
Members - Reputation: **1003**

Posted 13 March 2007 - 06:00 AM

Quote:

Original post by Numsgil

That looks like a solution! I'll give it a try and see waht I get. In the mean time, where did the base vectors come from? I've never seen them before, and I've been working with sphericeal coordiantes casually for a while, not to mention having covered them in calculus.

Any orthogonal curvilinear coordinate system has a base. You can find the basis for a curvilinear coordinate system by taking the derivative of a vector in cartesian coordinates in terms of the curvilinear coordinate components with respect to each of the components. And then normalizing.

For example in the case of spherical coordinates you have:

vector

**x**given by

x

_{1}= r * sin(a) * cos(b)

x

_{2}= r * sin(a) * sin(b)

x

_{3}= r * cos(a)

e

_{r}= d

**x**/dr / h

_{r}= [sin(a) * cos(b), sin(a) * sin(b), cos(a)] / h

_{r}

h

_{r}= | [sin(a) * cos(b), sin(a) * sin(b), cos(a)] | = 1

e

_{r}= [sin(a) * cos(b), sin(a) * sin(b), cos(a)]

e

_{a}= d

**x**/da / h

_{a}= [r * cos(a) * cos(b), r * cos(a) * sin(b), - r * sin(a)] / h

_{a}

h

_{a}= |[r * cos(a) * cos(b), r * cos(a) * sin(b), - r * sin(a)]| = r

e

_{a}= [cos(a) * cos(b), cos(a) * sin(b), - sin(a)]

e

_{b}= d

**x**/db / h

_{b}= [-r * sin(a) * sin(b), r * sin(a) * cos(b), 0] / h

_{b}

h

_{b}= |[-r * sin(a) * sin(b), r * sin(a) * cos(b), 0]| = r * sin(a)

e

_{b}= [-sin(b), cos(b), 0]