Difference between revisions of "BezierCurve:render"

(Created page with "{{newin|0.9.0|090|type=function}} Get a list of coordinates to be used with love.graphics.line. This function samples the Bézier curve using recursive subdivision. You ...")
 
(See Also)
 
(4 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.
 
This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.
  
If you are just interested to know the position on the curve given a parameter, use [[BezierCurve:eval]].
+
If you are just interested to know the position on the curve given a parameter, use [[BezierCurve:evaluate]].
  
 
== Function ==
 
== Function ==
Line 15: Line 15:
 
=== Returns ===
 
=== Returns ===
 
{{param|table|coordinates|List of x,y-coordinate pairs of points on the curve.}}
 
{{param|table|coordinates|List of x,y-coordinate pairs of points on the curve.}}
 +
== Example ==
 +
=== Draw a bezier curve ===
 +
<source lang="lua">
 +
curve = love.math.newBezierCurve({25,25,75,50,125,25})
 +
function love.draw()
 +
love.graphics.line(curve:render())
 +
end
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::BezierCurve]]
 
* [[parent::BezierCurve]]
* [[BezierCurve:eval]]
+
* [[BezierCurve:renderSegment]]
 +
* [[BezierCurve:evaluate]]
 
* [[love.math]]
 
* [[love.math]]
 +
* [[love.graphics.polygon]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Get a list of points on the curve.}}
 
{{#set:Description=Get a list of points on the curve.}}
 +
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|BezierCurve:render}}
 
{{i18n|BezierCurve:render}}

Latest revision as of 23:04, 1 January 2022

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Get a list of coordinates to be used with love.graphics.line.

This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter.

If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate.

Function

Synopsis

coordinates = BezierCurve:render(depth)

Arguments

number depth (5)
Number of recursive subdivision steps.

Returns

table coordinates
List of x,y-coordinate pairs of points on the curve.

Example

Draw a bezier curve

curve = love.math.newBezierCurve({25,25,75,50,125,25})
function love.draw()
	love.graphics.line(curve:render())
end

See Also


Other Languages