Amogh Talpallikar
Amogh Talpallikar

Reputation: 12184

How to find average velocity and acceleration of Bezier Spline ?

In my application, I have few screen coordinates through which I draw a Bezier Spline and I need to find the average Velocity and acceleration through that spline.

How should I go about it ?

I will find it in terms of pixel/sec and pixels/square-sec. and then convert it to m/sec and m/sec sq once the User provides pixel-meter mapping.

But How will I get the velocity or accn as I cant just take start point and end point, It has to be thru that curve.

Upvotes: 2

Views: 1937

Answers (2)

Rook
Rook

Reputation: 62538

Ughh, leave the pixel/sex and the pixels/square-sec approach aside for now.

I'm assuming from your question that you have an x-y plot with some sort of Bezier spline, some sort of curve which represents way over time. The x axis usually represents time, while the y axis represents way (length) s.

Velocity is the derivation of length over time, and acceleration the derivation of that. A derivation is simply the ratio of dy/dx in a (preferably) close pair of points.

So, what you need for a start is to interpolate and gather as many points from that Bezier spline. Leaving that up to you. From there,

dy = y(i+1) - yi
dx = x(i+1) - xi
velocity = dy/dx

So a graph of velocity over time would be that plotted on a time basis. Same goes for accelleration, just repeat the process.

Upvotes: 2

MoonKnight
MoonKnight

Reputation: 23833

You need to differentiate the curve once with respect to the temporal dimension in your plot (here I am assuming the x-axis/horizontal axis represents time; the y-axis/vertical axis represents distance travelled) to gain the local velocity component. Differentiate twice with respect to the same temporal dimension to get the acceleration at a given point. This is basically working out the gradient at each point along the curve for velocity, and the gradient of velocity to get the rate of change of velocity, namely acceleration.

To do this you use numerical integration to get the new quantities (velocity and acceleration) at each discreet point (or coordinate) on your spline based upon the data surrounding that point/coordinate location.

Upvotes: 1

Related Questions