Curve

A Curve is an object that represents a Bézier curve in three dimensions. Curves are defined by an arbitrary number of control points (note that the curve only passes through the first and last control point).

Once a Curve is created with lovr.math.newCurve, you can use Curve:evaluate to get a point on the curve or Curve:render to get a list of all of the points on the curve. These points can be passed directly to lovr.graphics.points or lovr.graphics.line to render the curve.

Note that for longer or more complicated curves (like in a drawing application) it can be easier to store the path as several Curve objects.

Constructors

lovr.math.newCurveCreate a new Curve.
Curve:sliceGet a new Curve from a slice of an existing one.

Methods

Curve:addPointAdd a new control point to the Curve.
Curve:getTangentGet the direction of the Curve at a point.
Curve:evaluateTurn a number from 0 to 1 into a point on the Curve.
Curve:getPointGet a control point of the Curve.
Curve:setPointSet a control point of the Curve.
Curve:getPointCountGet the number of control points in the Curve.
Curve:removePointRemove a control point from the Curve.
Curve:renderGet a list of points on the Curve.
Curve:sliceGet a new Curve from a slice of an existing one.

See also