In my previous post, Moving an object along a Bezier Curve. Part II, I discussed how to compute the first derivative of a Bezier curve in order to find its tangent. Today, we will find the 2nd derivative of a beizer curve.
The 2nd derivative is computed by
=
.
.
local px2ndDer = 6 * (p1.x * ( -1 * ( 1-t )) + p2.x * ( (3 * t) -2 ) + ( p4.x * t ) + p3.x )
local py2ndDer = 6 * (p1.y * ( -1 * ( 1-t )) + p2.y * ( (3 * t) -2 ) + ( p4.y * t ) + p3.y )
.
.
.
local px2ndDer = 6 * (p1.x * ( -1 * ( 1-t )) + p2.x * ( (3 * t) -2 ) + ( p4.x * t ) + p3.x )
local py2ndDer = 6 * (p1.y * ( -1 * ( 1-t )) + p2.y * ( (3 * t) -2 ) + ( p4.y * t ) + p3.y )
.
.
Why is it important to find the 2nd derivative of a curve in regards to moving an object along a path? It is to calculate the curvature radius of the path at specified parameter t. It measures the rate of change of direction of the curve. It is the tangent’s line turn per unit distance moved along the curve.
To compute the curvature, using the first and second derivative, it is as follows:
To compute the curvature radius, it is easy, its the inverse. And it is denoted as follows:
Carlos