Name

bezierPoint()

Description

Evaluates the Bezier at point 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. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a Bézier curve at t.

Examples

  • size(400,400);
    noFill();
    bezier(340, 80, 40, 40, 360, 360, 60, 320);
    fill(255);
    int steps = 10;
    for (int i = 0; i <= steps; i++) {
      float t = i / float(steps);
      float x = bezierPoint(340, 40, 360, 60, t);
      float y = bezierPoint(80, 40, 360, 320, t);
      ellipse(x, y, 10, 10);
    }
    Image output for example 1

Syntax

  • bezierPoint(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

Return

  • float