00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <config.h>
00035
00036 #include <math.h>
00037 #include "nsc.h"
00038 #include "path.h"
00039 #include "plane.h"
00040 #include "update.h"
00041
00042 #ifndef PI
00043 #define PI 3.14159265358979323846
00044 #endif
00045
00046 void
00047 move_sat(struct plnstr *pp)
00048 {
00049 coord x1, y1, x2, y2;
00050 coord dx, dy;
00051 float newtheta;
00052 struct sctstr sect;
00053
00054 newtheta = pp->pln_theta + .05;
00055
00056 if (newtheta >= 1.0) {
00057 newtheta -= 1.0;
00058 }
00059
00060 x1 = (coord)(2 * pp->pln_theta * WORLD_X);
00061 x1 = xnorm(x1);
00062 y1 = (coord)(sin(6 * PI * pp->pln_theta) * (WORLD_Y / 4));
00063 x2 = (coord)(2 * newtheta * WORLD_X);
00064 x2 = xnorm(x2);
00065 y2 = (coord)(sin(6 * PI * newtheta) * (WORLD_Y / 4));
00066 dx = x1 - pp->pln_x;
00067 dy = y1 - pp->pln_y;
00068 x2 -= dx;
00069 y2 -= dy;
00070
00071 if ((x2 + y2) & 1) {
00072 x2++;
00073 }
00074
00075 pp->pln_x = xnorm(x2);
00076 pp->pln_y = ynorm(y2);
00077 pp->pln_theta = newtheta;
00078 getsect(pp->pln_x, pp->pln_y, §);
00079 if (sect.sct_own)
00080 if (pp->pln_own != sect.sct_own)
00081 wu(0, sect.sct_own, "%s satellite spotted over %s\n",
00082 cname(pp->pln_own), xyas(pp->pln_x, pp->pln_y,
00083 sect.sct_own));
00084 return;
00085 }