You are not logged in. Please login at to post your questions!


How to make a circle acquire pure rolling from start?

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?






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(); }

asked 01 Sep '14, 18:25

shubhgoyal5's gravatar image

accept rate: 0%

For the circle to accquire pure rolling or to at least be seen that it is actually "rolling" you might want to plug in the equations for a "cycloid".

A cycloid is a special type of curve which can actually simulate what you need:

"A cycloid is the curve traced by a point on the rim of a circular wheel as the wheel rolls along a straight line without slippage."

Note that this is more a Physics question than a programming one, but, basically if the circle rolls without slippage than that means that for you to simulate a rotation, all you need to do is make the circle "slide" horizontally with constant velocity and couple a cycloid like motion to it.

If you do that, then you can literally obtain the figure which is on the wikipedia link.

Maybe this helps,

Bruno Oliveira


answered 01 Sep '14, 18:39

kuruma's gravatar image

accept rate: 8%

Brilliant buddy.. And, thanks for the link as well.

(01 Sep '14, 19:11) shubhgoyal50★

You're welcome and thanks for marking answer as accepted :) Almost nobody does it :p

(02 Sep '14, 16:48) kuruma3★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 01 Sep '14, 18:25

question was seen: 1,621 times

last updated: 02 Sep '14, 16:48