Name

curveVertex()

Description

Specifies vertex coordinates for curves. This function may only be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). The first and last points in a series of curveVertex() lines will be used to guide the beginning and end of the curve. A minimum of four points is required to draw a tiny curve between the second and third points. Adding a fifth point with curveVertex() will draw the curve between the second, third, and fourth points. The curveVertex() function is an implementation of Catmull-Rom splines. Using the 3D version requires rendering with P3D (see the Environment reference for more information).

Examples

  • size(400, 400);
    noFill();
    beginShape();
    curveVertex(336,  364);
    curveVertex(336,  364);
    curveVertex(272,  76);
    curveVertex(84,  68);
    curveVertex(128, 400);
    curveVertex(128, 400);
    endShape();
    Image output for example 1

Syntax

  • curveVertex(x, y)
  • curveVertex(x, y, z)

Parameters

  • x(float)the x-coordinate of the vertex
  • y(float)the y-coordinate of the vertex
  • z(float)the z-coordinate of the vertex

Return

  • void
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.