|
|
1.1 ! root 1: #include "map.h" ! 2: ! 3: struct coord stdpar; ! 4: ! 5: Xmecca(place, x, y) ! 6: struct place *place; ! 7: float *x, *y; ! 8: { ! 9: *x = - place->wlon.l; ! 10: *y = -(place->nlat.c*stdpar.s - ! 11: place->nlat.s*stdpar.c*place->wlon.c)/stdpar.c; ! 12: if(fabs(place->wlon.l) > 0.01) ! 13: *y *= *x/sin(*x); ! 14: if(fabs(*y)>2.0) ! 15: return(0); ! 16: if(place->nlat.s*stdpar.s + ! 17: place->nlat.c*stdpar.c*place->wlon.c <0) ! 18: return(-1); ! 19: return(1); ! 20: } ! 21: ! 22: int (*mecca(par))() ! 23: float par; ! 24: { ! 25: if(fabs(par)>80.) ! 26: return(0); ! 27: deg2rad(par,&stdpar); ! 28: return(Xmecca); ! 29: } ! 30: ! 31: Xhoming(place, x, y) ! 32: struct place *place; ! 33: float *x, *y; ! 34: { ! 35: int i = Xmecca(place, x, y); ! 36: float r, h; ! 37: if(i != 1) ! 38: return(i); ! 39: r = acos(stdpar.s*place->nlat.s + ! 40: stdpar.c*place->nlat.c*place->wlon.c); ! 41: h = hypot(*x, *y); ! 42: r = h<.001? r: r/h; ! 43: *x *= r; ! 44: *y *= r; ! 45: return(1); ! 46: } ! 47: ! 48: int (*homing(par))() ! 49: float par; ! 50: { ! 51: if(mecca(par)==0) ! 52: return(0); ! 53: return(Xhoming); ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.