Advertisement

How to apply constant angular speed to quadratic linear speed?

Started by March 11, 2014 12:26 AM
2 comments, last by ferrous 10 years, 11 months ago

If I have a Px(t) = At^3 + Bt^2 + Ct + 0 and Py(t) = 0 for my character's position while running and a constant radians/second that my character can turn, how can I transform that into an explicit formula for Px(t) and Py(t) after turning is applied? Is this related to fresnel and euler spirals or track transition curves? Much thanks to anyone who can give me a strong kick in the right direction.

Edit: I figured out a piece, that I ought to be figuring out P''x(t) and P''y(t) instead of thinking about curves at all.

If "Px(t) = At^3 + Bt^2 + Ct + 0" is a spline giving position and t is time, maybe you want to trivially follow exactly the same path and turn the character as he goes.

If you want something else, like walking more or less in the direction the character is facing, you need to figure out how the new motion with turning is supposed to be related to the old motion without turning.

For example, if the non-turning character position P(t) goes from P1 to P2 in T seconds with undefined facing and the turning speed is w radians/second, you might want to interpolate between the original P(t) and the circular arc A(t) = A0+ A1*(cos (s+w*t), sin (s+w*t)). A0, A1, starting angle s and likely angular velocity w can be chosen to match endpoints P1 and P2, tangents, or something else.

Or you might want to compute the tangent direction of P(t), let's call it D(t) (an angle, not a vector!), and check that its rate of change doesn't exceed a certain range [-w,w], This would require reconstructing P(t) from its tangent direction at each t value, which also requires arbitrary arc lengths at each t value; clothoid splines are an easy choice for that (constant arc length) but you might prefer something more related to the original cubic spline you try to reproduce.

Omae Wa Mou Shindeiru

Advertisement

I think that I have the basis for a solution. I needed to convert from my turn speed to the curvature, the curvature to a circle radius, and finally the circle radius to acceleration towards the center of that circle.

I don't exactly know what you're attempting to do, it does look like you're doing a spline, but you may want to look into Dubin's Curves instead to see if that would help you or not. (It might not)

This topic is closed to new replies.

Advertisement