Hey, I’ve initiated the following code and now I want that the circle (with a spoke in it) performs pure rolling or it looks that it actually moves in real sense.
Can anybody tell me how to do it?
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<conio.h>
#include<dos.h>
int xc=0, yc=200, r;
int x[15], y[15];
void motioncircle()
{
circle(xc, yc, r);
}
void main()
{
double angle=0, theta;
int i, a;
int gd=DETECT, gm;
initgraph(&gd, &gm,"…\bgi");
printf(“Enter r: “);
scanf(”%d”, &r);
a=xc+r;
while(!kbhit())
{
while(a<=630)
{
theta=M_PIangle/180;
cleardevice();
motioncircle();
for(i=0; i<1; i++)
{
theta=M_PIangle/180;
x[i]=xc+rcos(theta);
y[i]=yc+rsin(theta);
angle+=20;
line(xc, yc, x[i], y[i]);
}
angle+=2;
xc+=2;
a=xc+r;
delay(50);
}
xc=0;
a=xc+r;
}
getch();
closegraph();
}