1
0
Fork 0

Minor changes

pull/2/head
Cees Bassa 2014-10-07 23:41:49 +02:00
parent afc5d9eacf
commit 3f2009a46e
4 changed files with 37 additions and 43 deletions

View File

@ -6,7 +6,7 @@
#include "sgdp4h.h"
#include <getopt.h>
#define LIM 80
#define LIM 128
#define NMAX 256
#define D2R M_PI/180.0
#define R2D 180.0/M_PI

View File

@ -376,7 +376,6 @@ void plot_xyz(void)
while (fgetline(fp,line,LIM)>0) {
// Get satellite position
sscanf(line,"%lf %lf %lf %lf",&mjd,&satpos.x,&satpos.y,&satpos.z);
printf("%lf %f %f %f\n",mjd,satpos.x,satpos.y,satpos.z);
// Get positions
sunpos_xyz(m.mjd,&sunpos,&sra,&sde);

View File

@ -47,49 +47,44 @@ int read_twoline(FILE *fp, long search_satno, orbit_t *orb)
int found;
double bm, bx;
// Set defaults
strcpy(orb->desig,"");
st1 = line1;
st2 = line2;
do {
if(fgets(line1, ST_SIZE-1, fp) == NULL) return -1;
if(fgets(line1, ST_SIZE-1, fp) == NULL)
return -1;
st1 = st_start(line1);
} while(st1[0] != '1');
if(search_satno > 0)
{
if(search_satno > 0) {
found = 0;
}
else
{
} else {
found = 1;
search_satno = atol(st1+2);
}
sprintf(search, "1 %05ld", search_satno);
do {
st1 = st_start(line1);
if(strncmp(st1, search, 7) == 0)
{
if(strncmp(st1, search, 7) == 0) {
found = 1;
break;
}
} while(fgets(line1, ST_SIZE-1, fp) != NULL);
sprintf(search, "2 %05ld", search_satno);
if(found)
{
if(found) {
fgets(line2, ST_SIZE-1, fp);
st2 = st_start(line2);
}
if(!found || strncmp(st2, search, 7) != 0)
{
if(!found || strncmp(st2, search, 7) != 0) {
return -1;
}
orb->ep_year = (int)i_read(st1, 19, 20);
if(orb->ep_year < 57) orb->ep_year += 2000;