Class Curve

A cubic Bézier curve.

For details on Bézier curves, see Bézier curves on Wikipedia.

Tables

Curve.x0 x coordinate of curve point P0
Curve.y0 y coordinate of curve point P0
Curve.cp1x x coordinate of first control point P1
Curve.cp1y y coordinate of first control point P1
Curve.cp2x x coordinate of second control point P2
Curve.cp2y y coordinate of second control point P2
Curve.x x coordinate of curve point P3
Curve.y y coordinate of curve point P3
Curve.p table of curve points.

Methods

Curve:remove () Remove curve from subpath.
Curve:split (t) Split curve into two curves.


Tables

Curve.x0
x coordinate of curve point P0
Curve.y0
y coordinate of curve point P0
Curve.cp1x
x coordinate of first control point P1

Usage:

    graphics.paths[1].subpaths[1].curves[1].cp1x = 10
Curve.cp1y
y coordinate of first control point P1

Usage:

    print(graphics.paths[1].subpaths[1].curves[1].cp1y)
Curve.cp2x
x coordinate of second control point P2
Curve.cp2y
y coordinate of second control point P2
Curve.x
x coordinate of curve point P3
Curve.y
y coordinate of curve point P3
Curve.p
table of curve points. Use this to access points in a curve by index. Note that for consistency with Lua, the indices here are one-based, even though traditional Bézier terminology is 0-based. So keep in mind that P0 = p[1], P1 = p[2], P2 = p[3], P3 = p[4].

Usage:

    print(graphics.paths[1].subpaths[1].curves[1].p[1].x) -- get P0.x
    graphics.paths[1].subpaths[1].curves[1].p[4].y = 7 -- set P3.y

Methods

Curve:remove ()
Remove curve from subpath.
Curve:split (t)
Split curve into two curves.

Parameters:

  • t number location of split, 0 <= t <= 1
generated by LDoc 1.4.6 Last updated 2019-04-19 11:25:52