formulas for Angles rotation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

formulas for Angles rotation

Post by strale »

Hi

I would like to ask you if exist formulas to make rotation on angles in the Longitude and latitude manner ( ex. the ones used to geolocation.)
instead of using X,Y,Z coordinates:
And where to find information and explanation about this kind of matemethics..

I have found same formulas for rotation that use only angles:

Code: Select all

Angle NewLatitude  = asin( Sin(Lattitude1) * sin(Angle Rotation))
Angle NewLongitude =  acos( cos(Lattitude1)/cos(NewLatitude  ))
I still have to test the formulas but looks to work.

i have get a look to the rotation matrix formulas as
matrix rotation on X axes :
1 0 0
0 cos(a) sin(a)
0 -sin(a) cos (a)
now this rotation give and need parameters on the 3 axis X,Y,Z


to pass through the two sisytemsthere are formulas as:

Code: Select all

Z = r* sin (latitude)
Y= r* cos(latitude)* cos(longitude)
X =r *cos(latitude)* cos(longitude)
R is thge radius from the center of the sphere 
to pass from X,Y,Z coordinate to "Angles coordinates":

Code: Select all

r = radq(X ^2 +Y^2+ Z^2)
Long = arctan(Y/X)
altitude = arctan(  Z/(radq(X^2+Y^2))  ) 
Isn't it wonderful?
Thank you in advance
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

The question is: What kind of reference object do you want to use? Long/Lat coordinates always refer to either a sphere or an ellipsoid. So the first question you have to ask yourself is, which kind of reference sphere/ellipsoid you want to have.

There's different formulas depending which reference ellipsoid you're using. Here's an example for Switzerland which describes each step nicely:

http://www.swisstopo.admin.ch/internet/ ... gs84en.pdf

I've programmed parts of it when I was a student and it's possible to just use the math-header from C++.
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

Thank you very much for the replay

i would like to detect the position of a celestial body using angles from the center of the earth
the correct way to do it is to consider an ellipsoid
but as i do not need great precision i would prefer starting with a sphere geometry (easier)

I give a glance to the paper you linked
if i have understand :idea: the formulas let transform to coordinate system and to have better aproximation than the wgs84 for a local area 1 meter.

I was looking to formulas to make rotation using angles
ex:
suppose i have an shape projected on the surface of a sphere and i would like to rotate that shape of an angle from its center
i was wandering if i have to pass to x,yz to use vector , quaternions, or matrix or i can calculate everything staying in the angles Lat , Long coordinate system

Cheers
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

The paper I linked just describes the way to convert from a cartographic projection (X,Y,Z (h)) system into the WGS-84 (long,lat,H) system and back. These formulas are limited to Switzerland because of the oblateness of the wgs-84 ellipsoid (and the gravitational anomalies). For a different country you'll need different formulas.

Imo the best way to do your example is to define your coordinate system inside your sphere/ellipsoid and calculate the vector to the centre of your shape. Then you just rotate your shape and project it back onto the sphere.
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

ok

i found more information on rotation / traslation with matrix on the x,yz coordinate than in Lat long coordinate so ill follow that path :D

Thank you
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

I was mistake about a formula :(

Code: Select all

Z = r* sin (latitude)
Y= r* cos(latitude)* cos(longitude)
X =r *cos(latitude)* cos(longitude)
R is thge radius from the center of the sphere 
is :D

Code: Select all

Z = r* sin (latitude)
Y= r* cos(latitude)* sin(longitude)
X =r *cos(latitude)* cos(longitude)
R is thge radius from the center of the sphere 
I have also found information about the topic :
spheric trigonometry
And an interesting site :
formulas for aviation: http://williams.best.vwh.net/avform.htm

anyway the convertion to x,yz coordiante and the use of matrix , quaternion ecc. looks still the easier and conform way
Cheers
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

sorry to bother with my mistake and this tread :
here are the tested functions:

Wrong :(

Code: Select all

r = radq(X ^2 +Y^2+ Z^2)
Long = arctan(Y/X)
altitude = arctan(  Z/(radq(X^2+Y^2))  ) 
Looks good :)

Code: Select all

r = radq(X ^2 +Y^2+ Z^2)
Longitude = arctan(Y/X)
latitude = arcsin(  Z/r ) 
The End ?
Post Reply