IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ticket #116: ccc.pl

File ccc.pl, 785 bytes (added by Paul Price, 22 years ago)

Perl program that does coordinate conversions from RA,Dec to Galactic or Ecliptic

Line 
1#!/usr/local/bin/perl
2
3use Math::Trig;
4
5$DEG_IN_RAD = 57.2957795130823;
6
7# l2,b2
8$alphaP = (90 + 192.85948) / $DEG_IN_RAD;
9$deltaP = (90 - 27.12825) / $DEG_IN_RAD;
10$phiP = (32.93192) / $DEG_IN_RAD;
11
12# Ecliptic
13$T = 2; # Centuries from 1900
14$alphaP = 0;
15$deltaP = ((23+27/60+8.26/3600) - 46.845/3600*$T - 0.0059/3600*$T*$T + 0.00181/3600*$T*$T*$T) / $DEG_IN_RAD;
16$phiP = 0;
17
18$alpha = 180 / $DEG_IN_RAD;
19$delta = 30 / $DEG_IN_RAD;
20
21### The transformation itself
22$theta = asin( sin($delta) * cos($deltaP) - cos($delta) * sin($deltaP) * sin($alpha - $alphaP));
23$y = cos($delta) * cos($deltaP) * sin($alpha - $alphaP) + sin($delta) * sin($deltaP);
24$x = cos($delta) * cos($alpha - $alphaP);
25$phi = atan2($y,$x) + $phiP;
26
27$theta *= $DEG_IN_RAD;
28$phi *= $DEG_IN_RAD;
29
30print "$phi $theta\n";