Example #1
0
V6
v6s2c(V6 vs)
{
    double cos_a;
    double cos_d;
    double sin_a;
    double sin_d;
    V6 vc;

    if (v6GetType(vs) == CARTESIAN) {
	return(vs);
    }

    vc = v6init(CARTESIAN);

    cos_a = cos(A);
    cos_d = cos(D);
    sin_a = sin(A);
    sin_d = sin(D);

    /* the standard transformation */
    v6SetX(vc, R*cos_d*cos_a);
    v6SetY(vc, R*cos_d*sin_a);
    v6SetZ(vc, R*sin_d);

    /* the first derivative of the standard transformation */
    v6SetXDot(vc, -R*(cos_d*sin_a*ADOT + sin_d*cos_a*DDOT) + RDOT*cos_d*cos_a);
    v6SetYDot(vc,  R*(cos_d*cos_a*ADOT - sin_d*sin_a*DDOT) + RDOT*cos_d*sin_a);
    v6SetZDot(vc,  R*cos_d*DDOT + RDOT*sin_d);

    return(vc);
}
Example #2
0
int main(){
  V6 v6;
  DMS dms;
  HMS hms;
  double ra=0.0, de=0.0, pmra=0.0, pmde=0.0, px=0.0, rv=0.0, C=0.0;
  /* Barnard's star from Hipparcos catalog. 
     ICRS Epoch J1991.25 */
  ra = d2r(269.45402305);
  de = d2r(4.66828815);
  px = 549.01 / 1000.0; /* Arc seconds */
  rv = 0.0;
  pmra = (-797.84 / 1000.0 ) / cos(de); /* pmra * cos(de) into pmra */
  pmra *= 100.0; /* Arcseconds per century. */
  pmde = (10326.93 / 1000.0);
  pmde *= 100.0; /* Arcseconds per century. */
  C = CJ;
  printf("RA %f DE %f PMRA %f PMDE %f PX %f RV %f\n",
         ra, de, pmra, pmde, px, rv);

  v6 = v6init(CARTESIAN);
  v6 = cat2v6(ra, de, pmra, pmde, px, rv, C);
  v6 = proper_motion(v6, J2000, JYEAR2JD(1991.25));
  printf("RAJ2000: %s DEJ2000:%s\n", fmt_alpha(v6GetAlpha(v6c2s(v6))),
  fmt_d(r2d(v6GetDelta(v6c2s(v6)))));

  hms = hms2hms(r2hms(v6GetAlpha(v6c2s(v6))));
  dms = dms2dms(r2dms(v6GetDelta(v6c2s(v6))));
  printf("RAJ2000: hh %.1f mm %.1f ss %.4f\n", hms.hh, hms.mm, hms.ss);
  printf("DEJ2000: dd %.1f mm %.1f ss %.4f\n", dms.dd, dms.mm, dms.ss);
  
  return 0;
}
Example #3
0
V6
v32v6(V3 v3)
{
    V6 v6;

    v6 = v6init(v3GetType(v3));
    v6SetPos(v6, v3);

    return(v6);
}
Example #4
0
/* Simple test of aberrate function: just add the velocity of second to
   first. */
int main(){
  V6 v6;
  #define L 2
  double ep[L] = {J2000, J1984};
  v6 = v6init(CARTESIAN);
  
  for(int i=0; i < L; i++){
    v6 = eterms(ep[i]);
    
    printf("X %.10f \tY %.10f \tZ %.10f \nXDOT %.10f \tYDOT %.10f \tZDOT %.10f\n",
           v6GetX(v6), v6GetY(v6), v6GetZ(v6), v6GetXDot(v6),
           v6GetYDot(v6), v6GetZDot(v6));
    
  }

 
  return 0;
}
Example #5
0
int main(){
  V6 v6;

  v6 = v6init(SPHERICAL);
  v6SetR(v6, 1e9);
  v6SetAlpha(v6, h2r(20.0));
  v6SetDelta(v6, d2r(40.0));
  v6 = v6s2c(v6);

  v6 = v6c2s(ellab(J2000, v6, -1));


  printf("X %.9f \tY %.9f \tZ %.9f \nXDOT %.9f \tYDOT %.9f \tZDOT %.9f\n",
         v6GetX(v6), r2h(r2r(v6GetY(v6))), r2d(r2r(v6GetZ(v6))), v6GetXDot(v6),
         v6GetYDot(v6), v6GetZDot(v6));

  return 0;
}
Example #6
0
int main(){
  V6 v6;
  v6 = v6init(CARTESIAN);
  v6SetX(v6, 0.5);
  v6SetY(v6, 0.173611298);
  v6SetZ(v6, 0.84844511);
  v6SetXDot(v6, -0.034000000);
  v6SetYDot(v6, 0.251873488);
  v6SetZDot(v6, -0.872330067);

  v6 = equ2ecl(v6, d2r(23.7));

  printf("X %.9f \tY %.9f \tZ %.9f \nXDOT %.9f \tYDOT %.9f \tZDOT %.9f\n",
         v6GetX(v6), v6GetY(v6), v6GetZ(v6), v6GetXDot(v6),
         v6GetYDot(v6), v6GetZDot(v6));

  return 0;
}
Example #7
0
int main(){
  V6 v6;
  v6 = v6init(SPHERICAL);
  v6SetR(v6, 1.0);
  v6SetAlpha(v6, M_PI/4.0);
  v6SetDelta(v6, M_PI/4.0);
  v6 = v6s2c(v6);
  v6SetXDot(v6, -0.034);
  v6SetYDot(v6, -0.12);
  v6SetZDot(v6, -0.9);

  v6 = ecl2equ(v6, d2r(23.7));

  printf("X %.9f \tY %.9f \tZ %.9f \nXDOT %.9f \tYDOT %.9f \tZDOT %.9f\n",
         v6GetX(v6), v6GetY(v6), v6GetZ(v6), v6GetXDot(v6),
         v6GetYDot(v6), v6GetZDot(v6));

  return 0;
}
Example #8
0
int main(){
  double ra = (12+22/60.0+54.899/3600.0) * (2*M_PI/24.0);
  double de = (15+49/60.0+20.57/3600.0) * (2*M_PI/360.0);
  double ra1, ra1_d, de1, de1_d;
  double ep = J2000;
  double eq = J2000;
  DMS ra_dms, de_dms;
  V6 v6;
  V6 pvec[N_TPM_STATES];
  TPM_TSTATE tstate;
  int s1 = TPM_S06; /* Heliocentric mean J2000 FK5 ~~ ICRS */
  int s2 = TPM_S00; /* Assign required states. */

  for(int i=TPM_S00; i < N_TPM_STATES; i ++){
    tpm_data(&tstate, TPM_INIT);
    tstate.utc = J2000;
    tstate.lon = d2r(-111.598333);
    tstate.lat = d2r(31.956389);
    tstate.alt = 2093.093;
    tstate.delta_ut = delta_UT(tstate.utc);
    tpm_data(&tstate, TPM_ALL);
     
    v6 = v6init(SPHERICAL);
    v6SetR(v6, 1e9);
    v6SetAlpha(v6, ra);
    v6SetDelta(v6, de);
     
    pvec[s1] = v6s2c(v6);
    s2 = i;
    tpm(pvec, s1, s2, ep, eq, &tstate);
    v6 = v6c2s(pvec[s2]);
     
    ra_dms = dms2dms(r2dms(v6GetAlpha(v6)));
    de_dms = dms2dms(r2dms(v6GetDelta(v6)));
    
    printf("%02d-%02d %7.2f %7.2f %8.4f %7.2f %7.2f %8.4f\n", 
           s1, s2, ra_dms.dd, ra_dms.mm, ra_dms.ss, 
           de_dms.dd, de_dms.mm, de_dms.ss);

  }
  return 0;
}
Example #9
0
int main(){
  V6 v6;
  #define L 3
  double ha, dec;
  double az[L] = {0, 90, 133.30805555555557};
  double el[L] = {90, -45, 59.086111111111116};

  v6 = v6init(SPHERICAL);
  v6SetR(v6, 1e9);
  for (int i=0; i < L; i++){
    v6SetAlpha(v6, d2r(az[i]));
    v6SetDelta(v6, d2r(el[i]));
    v6 = v6c2s(azel2hadec(v6s2c(v6), d2r(43.07833)));
    ha = r2d(r2r(v6GetAlpha(v6)));
    dec = r2d(r2r(v6GetDelta(v6)));
    printf("%.9f %.9f\n", ha, dec);
  }

  return 0;
}
Example #10
0
V6
m3v6(M3 m, V6 v1)
{
    int row, col;
    V6 v2;

    if (v6GetType(v1) == SPHERICAL) {
	v1 = v6s2c(v1);
    }

    v2 = v6init(CARTESIAN);

    for (row = 0; row < 3; row++) {
	for (col = 0; col < 3; col++) {
	    v2.v[POS].v[row] += m.m[row][col] * v1.v[POS].v[col];
	    v2.v[VEL].v[row] += m.m[row][col] * v1.v[VEL].v[col];
	}
    }

    return(v2);
}
Example #11
0
int main(){
  V6 v6;
   
  v6 = v6init(SPHERICAL);

  v6SetR(v6, 1e9);
  v6SetAlpha(v6, d2r(34.1592));
  v6SetDelta(v6, d2r(12.9638));
  v6SetRDot(v6, -0.123);
  v6SetAlphaDot(v6, 0.382);
  v6SetDeltaDot(v6, 1.0);

  v6 = v6s2c(v6);
  v6 = precess(J2000, J1984, v6, PRECESS_FK5);
  v6 = v6c2s(v6);

  printf("R %.10f \tALPHA %.10f \tDELTA %.10f \nRDOT %.10f \tALPHADOT %.10f \tDELTADOT %.10f\n",
         v6GetR(v6), v6GetAlpha(v6), v6GetDelta(v6),
         v6GetRDot(v6), v6GetAlphaDot(v6), v6GetDeltaDot(v6));

  return 0;  

    
}
Example #12
0
int main(){

  V3 v3_1, v3_2;
  V6 v6, v6s;
  /* Create a V6 vector, using 2 V3 vectors.*/
	v3_1 = v3init(CARTESIAN);
  v3_2 = v3init(CARTESIAN);
  v6 = v6init(CARTESIAN);

  v3SetType(v3_1, CARTESIAN);
	v3SetX(v3_1, 1123.4556);
	v3SetY(v3_1, 4556.1123);
	v3SetZ(v3_1, 9876.1267);
	
  v3SetType(v3_2, CARTESIAN);
	v3SetX(v3_2, 2.3456);
	v3SetY(v3_2, 6.7891);
	v3SetZ(v3_2, 7.8912);
	
	v6SetPos(v6, v3_1);
	v6SetVel(v6, v3_2);
	
	v6SetType(v6, CARTESIAN);

  v6s = v6c2s(v6);
  
  printf("X %f \tY %f \tZ %f \nXDOT %f \tYDOT %f \tZDOT %f\n",  \
         v6GetX(v6), v6GetY(v6), v6GetZ(v6), v6GetXDot(v6),
         v6GetYDot(v6), v6GetZDot(v6));
  printf("R %.8f \tAlpha %.8f \tDelta %.8f \nRDOT %.8f \tAlphaDOT %.8f \tDeltaDOT %.8f\n",  \
         v6GetR(v6s), v6GetAlpha(v6s), v6GetDelta(v6s), v6GetRDot(v6s),
         v6GetAlphaDot(v6s), v6GetDeltaDot(v6s));


  return 0;
}