home *** CD-ROM | disk | FTP | other *** search
- /*
- * Gcalc.c
- * ~~~~~~~
- * This is the calculation function to figure position
- * of object (x,y) at time (time) it uses externaly
- * defined structure XY which is passed and def.
- * from main module graph.c
- * © Copyright 1991 Christian E. Hopps
- */
-
-
- #include <exec/types.h>
- #include <libraries/mathffp.h>
- #include "link:/graph/constants.h"
- float CalcGrav();
- extern struct MathBase *MathBase;
- extern struct MathTransBase *MathTransBase;
- extern struct Clip
-
- {
- short clipx1;
- short clipy1;
- short clipx2;
- short clipy2;
- };
- extern struct XY
- {
- float voy;
- float vox;
- float x;
- float y;
- short xp;
- short yp;
- BOOL clipped;
- int scale;
- struct Clip *clip;
- };
-
-
- void Gcalc(time, xy)
-
- struct XY *xy;
- float time;
-
- {
- float x,y,g,k;
- float vox,voy;
- vox = xy->vox;
- voy = xy->voy;
-
- k = SPFlt(2);
- g = SPDiv(SPFlt(xy->scale),4.9);
- x = SPMul(vox,
- time
- );
-
- y = SPSub(
-
- SPMul(
- g,
- SPPow(k,time)
- ),
- SPMul(
- voy,
- time
- )
- );
-
- xy->x = x;
- xy->y = y;
- }
-
-
-