Reference bezierTangent()

bezierTangent()

Calculates coordinates along a line that's tangent to a Bézier curve.

Tangent lines skim the surface of a curve. A tangent line's slope equals the curve's slope at the point where it intersects.

bezierTangent() calculates coordinates along a tangent line using the Bézier curve's anchor and control points. It expects points in the same order as the bezier() function. bezierTangent() works one axis at a time. Passing the anchor and control points' x-coordinates will calculate the x-coordinate of a point on the tangent line. Passing the anchor and control points' y-coordinates will calculate the y-coordinate of a point on the tangent line.

The first parameter, a, is the coordinate of the first anchor point.

The second and third parameters, b and c, are the coordinates of the control points.

The fourth parameter, d, is the coordinate of the last anchor point.

The fifth parameter, t, is the amount to interpolate along the curve. 0 is the first anchor point, 1 is the second anchor point, and 0.5 is halfway between them.

Examples

Syntax

bezierTangent(a, b, c, d, t)

Parameters

a
Number:

coordinate of first anchor point.

b
Number:

coordinate of first control point.

c
Number:

coordinate of second control point.

d
Number:

coordinate of second anchor point.

t
Number:

amount to interpolate between 0 and 1.

Returns

Number: coordinate of a point on the tangent line.
This page is generated from the comments in src/core/shape/curves.js . Please feel free to edit it and submit a pull request!

Related References