Py5Shape.curve_vertex()#

Specifies a Py5Shape object’s vertex coordinates for curves.

Examples#

example picture for curve_vertex()
 1def setup():
 2    py5.size(100, 100, py5.P2D)
 3    s = py5.create_shape()
 4    s.begin_shape()
 5    s.no_fill()
 6    s.curve_vertex(84, 91)
 7    s.curve_vertex(84, 91)
 8    s.curve_vertex(68, 19)
 9    s.curve_vertex(21, 17)
10    s.curve_vertex(32, 100)
11    s.curve_vertex(32, 100)
12    s.end_shape()
13    py5.shape(s)

Description#

Specifies a Py5Shape object’s vertex coordinates for curves. This method may only be used between Py5Shape.begin_shape() and Py5Shape.end_shape() and only when there is no MODE parameter specified to Py5Shape.begin_shape(). The first and last points in a series of curve_vertex() 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 curve_vertex() will draw the curve between the second, third, and fourth points. The curve_vertex() method is an implementation of Catmull-Rom splines.

Drawing 2D curves requires using the P2D renderer and drawing 3D curves requires using the P3D renderer. When drawing directly with Py5Shape objects, curves do not work at all using the default renderer.

This method can only be used within a Py5Shape.begin_shape() and Py5Shape.end_shape() pair.

Underlying Processing method: PShape.curveVertex

Syntax#

curve_vertex(x: float, y: float, /) -> None
curve_vertex(x: float, y: float, z: float, /) -> None

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

Updated on November 12, 2021 11:30:58am UTC