void gfq ( SpiceDouble et, SpiceDouble *value ) { // max separation between all non-0 planets in planets int i,j; SpiceDouble sep, lt, max=0.; SpiceDouble position[planetcount+1][3]; // TODO: why do I need a temp var here? SpiceDouble temp[3]; // compute positions for (i=1; i<=planetcount; i++) { spkezp_c(planets[i], et, "J2000", "LT+S", 10, temp, <); // copy from temp var (argh!) for (j=0; j<=2; j++) {position[i][j] = temp[j];} } // and now the angle diffs (keep only min) for (i=1; i<=planetcount; i++) { for (j=i+1; j<=planetcount; j++) { sep = vsep_c(position[i],position[j]); if (sep>max) {max=sep;} } } *value=max; return; }
double earthangle(double time, int p1, int p2) { SpiceDouble pos[3], pos2[3]; earthvector(time, p1, pos); earthvector(time, p2, pos2); // printf("GOT: %d %d %f %f %f\n",p1,p2,pos[0],pos[1],pos[2]); return vsep_c(pos,pos2); }
int main (int argc, char **argv) { SpiceDouble lt; SpiceDouble ang; SpiceDouble v[3]; SpiceDouble pos[3]; int i; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // spkezp_c(299,0,"ITRF93","LT+S",399,v,<); // printf("POS: %f,%f,%f\n",v[0],v[1],v[2]); // exit(0); // abq roughly georec_c (-106.5*rpd_c(), 35.05*rpd_c(), 1.609344, 6378.137, (6378.137-6356.7523)/6378.137, pos); for (i=0; i<=86400; i+=3600) { // pos of sun from IAU_EARTH spkezp_c(10,i,"ITRF93","LT+S",399,v,<); printf("POS(%d): %f,%f,%f\n",i,v[0],v[1],v[2]); // angle between abq vector and sun vector (0 = zenith) ang = vsep_c (v,pos); // printf("%d %f\n",i,r2d(ang)); } return 0; }
void gfq4 (SpiceDouble et, SpiceDouble *value) { SpiceDouble v[3], lt; // angular distance between Mars (for now) + globally defined curstar vector spkezp_c(4,et,"J2000","NONE",399,v,<); *value = vsep_c(v,curstar); }
void gfq5 (SpiceDouble et, SpiceDouble *value) { SpiceDouble u[3], v[3], lt; spkezp_c(10,et,REF,"NONE",601,u,<); spkezp_c( 5,et,REF,"NONE",601,v,<); // set global variable "s" to extra data, caller not required to use it // This is really ugly; if global variable 'extra' is set, print out // extra information; this should only be used when printing results // NOT during the search phase (TODO: this is ugly, better way?) if (vnorm_c(u)<vnorm_c(v)) { strcpy(s, "SUN IS CLOSER"); } else { strcpy(s, "POSSIBLE TRANSIT"); } *value = vsep_c(u,v)*180./pi_c(); }
int main (int argc, char **argv) { SPICEDOUBLE_CELL(cnfine,2); SPICEDOUBLE_CELL(result,500000); SpiceDouble beg, end, et_start, et_end, lt, iss[3]; char stime[255]; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // the limits of my TLE // TODO: compute this automatically from BSP file et_start = 506092496.; et_end = 507411908.; // geocentric angular distance between ISS and moon (transits) void issmoon (SpiceDouble et, SpiceDouble *value) { SpiceDouble iss[3], moon[3], lt; spkezp_c(-125544,et,"EQEQDATE","CN+S",399,iss,<); spkezp_c(301,et,"EQEQDATE","CN+S",399,moon,<); // printf("%f -> %f\n", et, vsep_c(iss,moon)*dpr_c()); *value = vsep_c(iss,moon); }
double bc_elev(double lat, double lon, double et, char *target) { double pos[3], radii[3], normal[3], state[6], lt; int n; // the Earth's 3 radii bodvrd_c ("EARTH", "RADII", 3, &n, radii); double flat = (radii[2]-radii[0])/radii[0]; // rectangular coordinates of position (ITRF93) georec_c (lon, lat, 0, radii[0], flat, pos); // surface normal vector to ellipsoid at latitude/longitude (this is // NOT the same as pos!) surfnm_c(radii[0], radii[1], radii[2], pos, normal); // printf("POS: %f %f %f\n", pos[0], pos[1], pos[2]); // printf("NORMAL: %f %f %f\n", normal[0], normal[1], normal[2]); // printf("ET = %f\n", et); // printf("POS: %f %f %f\n", pos[0], pos[1], pos[2]); // position of Sun in ITRF93 spkcpo_c("Sun", et, "ITRF93", "OBSERVER", "CN+S", pos, "Earth", "ITRF93", state, <); // printf("STATE: %f %f %f\n", state[0], state[1], state[2]); double el = halfpi_c() - vsep_c(state, normal); // printf("DEBUG: %f,%f,%f,%f,%f\n", lat, lon, 0., el, et); // return halfpi_c() - vsep_c(normal, state); return el; }