- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name | ### curveTangent()
Examples |
    noFill();
    curve(5, 26, 73, 24, 73, 61, 15, 65);
    int steps = 6;
    for (int i = 0; i <= steps; i++) {
      float t = i / float(steps);
      float x = curvePoint(5, 73, 73, 15, t);
      float y = curvePoint(26, 24, 61, 65, t);
      //ellipse(x, y, 5, 5);
      float tx = curveTangent(5, 73, 73, 15, t);
      float ty = curveTangent(26, 24, 61, 65, t);
      float a = atan2(ty, tx);
      a -= PI/2.0;
      line(x, y, cos(a)*8 + x, sin(a)*8 + y);
    }
Description | Calculates the tangent of a point on a curve. There's a good definition of tangent on Wikipedia.
Syntax |
    curveTangent(a, b, c, d, t)
Parameters |
a | float: coordinate of first point on the curve
b | float: coordinate of first control point
c | float: coordinate of second control point
d | float: coordinate of second point on the curve
t | float: value between 0 and 1
Returns | float
Related | curve() curveVertex() curvePoint() bezierTangent()

Updated on July 4, 2018 11:56:43am EDT