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; }
static VALUE georec(VALUE self, VALUE longitude, VALUE latitude, VALUE altitude, VALUE radius_equatorial, VALUE flattening) { double vector[3]; georec_c(NUM2DBL(longitude), NUM2DBL(latitude), NUM2DBL(altitude), NUM2DBL(radius_equatorial), NUM2DBL(flattening), vector); if(spice_error(SPICE_ERROR_SHORT)) return Qnil; return rb_nmatrix_dense_create(FLOAT64, (size_t *) VECTOR_SHAPE, 2, (void *) vector, 3); }
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; }