Curve
EditA 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 Pass:points or Pass: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.newCurve | Create a new Curve. |
| Curve:slice | Get a new Curve from a slice of an existing one. |
Methods
| Curve:addPoint | Add a new control point to the Curve. |
| Curve:evaluate | Turn a number from 0 to 1 into a point on the Curve. |
| Curve:getLength | Get the length of the Curve. |
| Curve:getPoint | Get a control point of the Curve. |
| Curve:getPointCount | Get the number of control points in the Curve. |
| Curve:getTangent | Get the direction of the Curve at a point. |
| Curve:removePoint | Remove a control point from the Curve. |
| Curve:render | Get a list of points on the Curve. |
| Curve:setPoint | Set a control point of the Curve. |
| Curve:slice | Get a new Curve from a slice of an existing one. |
| Curve:step | Get the curve parameter at a given distance along the curve. |
| Object:release | Immediately release the Lua reference to an object. |
| Object:type | Get the type name of the object. |