# velocity constraints on cubic bezier

This topic is 2084 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to figure out how to include velocity constraints to a flight game.

I have a satellite background image that ranges from longitudeA to longitudeB (in cartesian) along x axis and latitudeA to latitudeB along y axis. I then have an airplane at Point 0 (lat0 and lon0) with velocity of 50 knots. The player then clicks to add Point 3 (lat3, lon3) with a direction and velocity using an arrow. I'm trying to figure out how to construct a bezier with these velocity constraints. Using this image as a reference (http://upload.wikimedia.org/wikipedia/commons/c/c1/Bezier_3_big.png), I'm trying to figure out how far to put P1 from P0 and P2 from P3 given the desired velocity at P3. I know the length between P2 and P3 will be longer if velocity is higher, but I don't know how to get an exact number.

So far, I can get everything but the velocity to work. I can generate a cubic bezier that's tangent to the current airplane direction and tangent to desired direction at point 3. I can't figure out how to add in the velocities. Am I missing something as simple as unit conversion?

##### Share on other sites

The derivatives of a cubic Bézier curve at the endpoints are 3(P_1 - P_0) and 3(P_3 - P_2). You thus have to set P_1 = P_0 + v_i/3 and P_2 = P_3 - v_f/3.

Edited by apatriarca

##### Share on other sites
&amp;nbsp;

The derivatives of a cubic Bézier curve at the endpoints are 3(P_1 - P_0) and 3\,(P_3 - P_2). You thus have to set P_1 = P_0 + v_i/3 and P_2 = P_3 - v_f/3.

&amp;nbsp;

Thanks for the response. The problem I was running into was units. Since the airplane location is a lat/long (in degrees), I don't know what units I my v_i and v_f be. Are the units going to be degrees/second, degrees/min, knots?

To simplify, if the location was a point (x,y) in meters, would my velocity be meters/second?

##### Share on other sites
If you are using seconds as your time unit and meters as your position unit, then it would be [m/s]. Otherwise it would be "your position unit"/"your time unit here". But it looks like you are using a spherical coordinate system (lat/long/altitude) to define your airplane position, but a different method to define your velocity. Can you clarify the math behind the following step "The player then clicks to add Point 3 (lat3, lon3) with a direction and velocity using an arrow."?

• 18
• 29
• 11
• 24
• 20