// PROGRAM wheel #include "TrueBASIC.h" int main(); void initial(double *r, double *omega, double *vcm, double *t, double *dt, double *xmax); int main() { double dt, omega, r, t, vcm, x = 0, xmax, y; GWopen(0); initial(&r, &omega, &vcm, &t, &dt, &xmax); GWsetpen(-1, -1, -1, -1); while(x <= xmax) { x = -r*cos(omega*t) + vcm*t; y = r*sin(omega*t); GWline2((float)(x), (float)(y)); t += dt; } GWquit(); return 0; } void initial(double *r, double *omega, double *vcm, double *t, double *dt, double *xmax) { float mx, xmin; (*t) = 0; (*r) = 1; // radius of wheel (*omega) = 1; // angular frequency of wheel (*vcm) = (*r)*(*omega); // velocity of center of mass (*dt) = 0.01; // time increment xmin = -1; (*xmax) = 50; mx = 0.01*((*xmax) - xmin); GWindow(xmin-mx, -4.0f, (float)((*xmax)+mx), 4.0f); // draw ground at y = -r (bottom of wheel) GWline(xmin, (float)(-(*r)), (float)((*xmax)), (float)(-(*r))); }