#ifndef __astro_h #define __astro_h #include #include #include #include #include #include #include "global.h" #ifndef PI #define PI 3.14159265358979323846 #endif #define STARDAYSECONDS 86164.0 #define HOURSECONDS 3600.0 #define HOUR24SECONDS 86400.0 #define rad(x) ((x)*PI/180.0) #define deg(x) ((x)*180.0/PI ) #define hdeg(x) ((x)*15.0) #define degh(x) ((x)/15.0) #define hrad(x) rad(hdeg(x)) #define arctohs(a,s) ((a)/(s)) #define hstoarc(a,s) ((a)*(s)) #define degtoarc(x) ((x)*3600) #define arctodeg(x) ((x)/3600) #define degtoarc10(x) ((x)*36000) #define arc10todeg(x) ((x)/36000) #define degtoarc100(x) ((x)*360000) #define arc100todeg(x) ((x)/360000) #define hourstosecs(x) ((x)*3600.0) #define hourstomillis(x) ((x)*3600.0*1000.0) #define secstohours(x) ((x)/3600.0) #define millistohours(x) ((x)/3600.0/1000.0) #define circle_radius(x,y) (sqrt(((x)*(x))+((y)*(y)))); #define circle_circumf(r) ((r)*2.0*PI) #define circle_angle(b,u) (((b)/(u))*360.0) #define ARC0 0.0 #define ARC45 162000.0 #define ARC90 324000.0 #define ARC135 486000.0 #define ARC180 648000.0 #define ARC225 810000.0 #define ARC270 972000.0 #define ARC315 1134000.0 #define ARC360 1296000.0 #define ARC10_000 0 #define ARC10_045 1620000 #define ARC10_090 3240000 #define ARC10_135 4860000 #define ARC10_180 6480000 #define ARC10_225 8100000 #define ARC10_270 9720000 #define ARC10_315 11340000 #define ARC10_360 12960000 /* This calculates and sets GAST,and LAST. YEAR,MONTH,DAY,MINUTE,SECOND,MSECOND must contain correct time before. Also LONGITUTE must contain correct value. */ extern void cCurrentStarTime( void ); /* Calculates Rektazension/Declination-kooordinates to azimuth/altitude-koordinates for the local time, and place. This sets KOOR_AZ, KOOR_ALT ( as floatnumbers of degrees ) KOOR_RA must be set as hours KOOR_DEC dec as degrees. the current local startime ( LAST ), must be set before by calling cCurrentStartTime Also LATITUDE must contain correct value. */ extern void cAzAlt( void ); /* Calculates Azimut/Altitude-kooordinates to Rectaszension/Declination-koordinates for the local time, and place. This KOOR_RA, KOOR_DEC ( as floatnumbers of Hours/degrees ) KOOR_AZ, and KOOR_ALT must be set as floatnumber of degrees. The current startime LAST must be set before by calling cCurrentStarTime, also the LATITUDE. */ extern void cRaDec( void ); /* converts a RA-Koordinate ( floatnumber of hours ) to a long value, representing the value as 1/10 arcseconds */ extern long dHourslArc10( double val ); /* converts a AZ/ALT, or DEC-Koordinate ( floatnumber of degrees ) to a long value, representing the value as 1/10 arcseconds. */ extern long dDegreeslArc10( double val ); /* converts a long, representing a RA-Koordinate as 1/10 of arcseconds to its aequevalent floatnumber of hours, - stored as double. */ extern double lArc10dHours( long val ); /* converts a AZ/ALT, or DEC-Koordinate, represented as 1/10 of arcseconds, to its aequevalent flotnumber of degrees, - stored as double. */ extern double lArc10dDegrees( long val ); /* val must representing a value of 1/10 arcseconds. returns a number, representing the 360 degrees-sector, which is fullfilled by the koordinate. 0 = 0 - 3.239.999 1 = 3.240.000 - 6.479.999 2 = 6.480.000 - 9.719.999 3 = 9.720.000 - 12.959.999 */ extern int arc10Sector( long val ); /* val must representing a floatnumber of degrees. returns a number, representing the 360 degrees-sector, which is fullfilled by the koordinate. 0 = 000 - 089.999999 1 = 090 - 179.999999 2 = 180 - 269.999999 3 = 270 - 359.999999 */ extern int degreesSector( double val ); #endif