//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // Program project //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* #include #include "nxgraph.h" //---- physical setting #define G (9.80665) #define M (1.0) #define dT (1.0/256) //---- graphic setting #define WIN_WIDTH (256) #define WIN_HEIGHT (256) //---- main function int main(void) { NXOpenWindow("Projection Motion", WIN_WIDTH, WIN_HEIGHT ); double qx=0.0, qy=0.0; double px=1.0, py=2.0; do{ NXDrawPoint( (int)(512*qx), WIN_HEIGHT-(int)(512*qy) ); qx += px/M*dT; qy += py/M*dT; px += M*0*dT; py += -M*G*dT; }while( qy > 0.0 ); XEvent ev; NXCheckEvent( NX_WAIT, ev ); NXCloseWindow(); return(0); }