×

# 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?

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

56621
accept rate: 0%

 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." http://en.wikipedia.org/wiki/Cycloid 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 3★kuruma 17.7k●72●143●209 accept rate: 8% Brilliant buddy.. And, thanks for the link as well. (01 Sep '14, 19:11) 1 You're welcome and thanks for marking answer as accepted :) Almost nobody does it :p (02 Sep '14, 16:48) kuruma3★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×1,911
×1,477
×1,217
×366
×5
×2

question asked: 01 Sep '14, 18:25

question was seen: 1,621 times

last updated: 02 Sep '14, 16:48