curve_point()#

Evaluates the curve at point t for points a, b, c, d.

Examples#

example picture for curve_point()
 1def setup():
 2    py5.no_fill()
 3    py5.curve(5, 26, 5, 26, 73, 24, 73, 61)
 4    py5.curve(5, 26, 73, 24, 73, 61, 15, 65)
 5    py5.fill(255)
 6    py5.ellipse_mode(py5.CENTER)
 7    steps = 6
 8    for i in range(0, steps+1):
 9        t = i / steps
10        x = py5.curve_point(5, 5, 73, 73, t)
11        y = py5.curve_point(26, 26, 24, 61, t)
12        py5.ellipse(x, y, 5, 5)
13        x = py5.curve_point(5, 73, 73, 15, t)
14        y = py5.curve_point(26, 24, 61, 65, t)
15        py5.ellipse(x, y, 5, 5)

Description#

Evaluates the curve at point t for points a, b, c, d. The parameter t may range from 0 (the start of the curve) and 1 (the end of the curve). a and d are the control points, and b and c are points on the curve. As seen in the example, this can be used once with the x coordinates and a second time with the y coordinates to get the location of a curve at t.

Underlying Processing method: curvePoint

Syntax#

curve_point(a: float, b: float, c: float, d: float, t: float, /) -> float

Parameters#

  • a: float - coordinate of first control point

  • b: float - coordinate of first point on the curve

  • c: float - coordinate of second point on the curve

  • d: float - coordinate of second control point

  • t: float - value between 0 and 1

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