curveDerivative()

Synopsis

Returns a derivative vector for a given point on a curve. Only first and second derivatives may be computed. The derivative vector is a function of the underlying mathematical representation of the curve. It is generally better to use the curveVector() function, which yields unit vectors and is a pure geometric value, independent of mathematical representation.

Syntax

curveDerivative ( curve As Part, _
                  p1 As Point, _
                  n As Integer) As Vector 
Argument Type Description
Curve part The curve whose derivative is required. Must be a kind of curveMixin.
p1 point The point on the curve at which derivatives are to be computed. The point must be on the curve.
n integer The derivative required. Use 1 for first derivative, 2 for second. Values higher than these will return the second derivative. Zero will return the "position vector" - the coordinates of the point given, but as a Vector, not a Point.

Example 1

Intent >curveDerivative(Arc_1, Arc_1.midPoint, 1) 
--> Vector_(0.0, -5.0, 0.0, WorldFrame()) 

The tangent direction. Note that the magnitude is not 1.

Example 2

Intent >curveDerivative(Arc_1, Arc_1.midPoint, 2) 
--> Vector_(5.0, 0.0, 0.0, WorldFrame()) 

The second derivative. Note that this is NOT the same as the normal to the curve, which is always perpendicular to the tangent. However, for an Arc, it is perpendicular.