8. Usage examples

8.1. General

tbw

8.2. Geographical

tbw

8.3. Astronomical

8.3.1. Coordinates transformation

A commonly used task is a coordinate transformation. With the parameters of a new coordinate system (plane) relative to an old one,

Ω longitude of the ascending node angle between line of nodes and the zero point of longitude in the old plane.
ω argument of pericenter the angle from the ascending node to the position in the new plane.
i inclination angle between the new plane and the old plane.

you can do a transformation of an object object from an old into a new coordinate system using:

 object - strans 'ω, i, Ω'

or

 object - strans (ω, i, Ω)

Otherwise, for a transformation of an object object from the new into the old coordinate system, use the operator +:

 object + strans 'ω, i, Ω'

or

 object + strans (ω, i, Ω)

Example 59. perihelion and aphelion coordinates of a comet's orbit

We are assuming the orbital elements of a comet are Ω=30°, i=60° and ω=90°. We get the spherical position of perihelion and aphelion with:


sql> SELECT set_sphere_output('DEG');
 set_sphere_output 
-------------------
 SET DEG
(1 row)

sql> SELECT spoint '(0,0)' + strans '90d,60d,30d' AS perihelion;
   perihelion
--------------
 (120d , 60d)
(1 row)

sql> SELECT spoint '(180d,0)' + strans '90d,60d,30d' AS aphelion;
      aphelion
---------------
 (300d , -60d)
(1 row)