[−][src]Static p5_sys::global::curveTangent
pub static curveTangent: CurveTangentInternalType
Evaluates the tangent to the curve at position t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are points on the curve, and b and c are the control points.
Examples
noFill(); curve(5, 26, 73, 24, 73, 61, 15, 65); let steps = 6; for (let i = 0; i <= steps; i++) { let t = i / steps; let x = curvePoint(5, 73, 73, 15, t); let y = curvePoint(26, 24, 61, 65, t); //ellipse(x, y, 5, 5); let tx = curveTangent(5, 73, 73, 15, t); let ty = curveTangent(26, 24, 61, 65, t); let a = atan2(ty, tx); a -= PI / 2.0; line(x, y, cos(a) * 8 + x, sin(a) * 8 + y); }
Parameters
a
coordinate of first control point
b
coordinate of first point on the curve
c
coordinate of second point on the curve
d
coordinate of second conrol point
t
value between 0 and 1