prolate cycloid body movement

Discuss issues specific to using Box2D on the iPhone
gamist
Posts: 17
Joined: Wed May 30, 2012 11:05 am

prolate cycloid body movement

Postby gamist » Wed May 01, 2013 8:26 am

How can I make a box2d body move along a prolate cycloid curve? The parametric equations are
x = at-bsint
y = a-bcost where a is the radius and a and b are constants.

I am not sure how to use these equations to get the movement. I've searched extensively and haven't found anything leads. Please check the following link to see how the curve looks (http://mathworld.wolfram.com/ProlateCycloidEvolute.html). I would appreciate any help.

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: prolate cycloid body movement

Postby irresistible force » Wed May 01, 2013 7:15 pm

I suppose you pick whatever values for a, b, radius that you want, and then gradually change t to get the x and y positions along the curve. Then you can either set the body position with SetTransform, or SetLinearVelocity to make it move towards the x,y that was calculated.

gamist
Posts: 17
Joined: Wed May 30, 2012 11:05 am

Re: prolate cycloid body movement

Postby gamist » Thu May 02, 2013 6:44 am

Thanks for the help. I found some other equations for the prolate cycloid which I am using from (http://cuhkmath.wordpress.com/2011/07/2 ... curvature/).

x = at + bCost
y = bSint

Since y is bSint it should move from -b to b, but that doesn't happen. The prolate cycloid movement at the beginning works for the first two turns then it moves a bit like a sin curve with y (it's range) reducing as x increases. I don't know what is causing this.

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: prolate cycloid body movement

Postby irresistible force » Thu May 02, 2013 8:11 am

gamist wrote:x = at + bCost
y = bSint

hmm.... but the page you linked to says:
x = t + 2Cost
y = 2Sint

Just to check that we're on the same page, to put that in code you would have something like this right?

Code: Select all

b2Vec2 prolateCycloid( float t ) {
    return b2Vec2( t + 2 * cosf(t), 2 * sinf(t) );
}

To stretch it horizontally or vertically you could then multiply each component by something:

Code: Select all

b2Vec curvePoint = prolateCycloid( ... );
curvePoint.x *= a;
curvePoint.y *= b;

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: prolate cycloid body movement

Postby irresistible force » Thu May 02, 2013 8:21 am

Sorry, this is not as simple as I thought. :shock: I also noticed that the link you gave in your first post is for the 'evolute' of the curve (the red line in the graph on that page), so it's probably not the one you want. I think this is the one you want: http://mathworld.wolfram.com/ProlateCycloid.html
So that would be:

Code: Select all

b2Vec2 prolateCycloid( float t, float a, float b ) {
    return b2Vec2( a * t - b * sinf(t), a - b * cosf(t) );
}

gamist
Posts: 17
Joined: Wed May 30, 2012 11:05 am

Re: prolate cycloid body movement

Postby gamist » Thu May 02, 2013 12:11 pm

It's working after increases the b value considerably. Actually the prolate I want is like (http://www.dmcinfo.com/Latest-Thinking/ ... Loops.aspx). I mainly want the loops to be smaller, I've been trying values but I am not getting it the loops as small as I want. I also realized that the loops reduce as they move along the x-axis. I don't know what causes that.


Return to “iPhone”



Who is online

Users browsing this forum: No registered users and 1 guest