Difference between revisions of "PolygonShape:getPoints"

(return clarification)
(world corrected local)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Get the world coordinates of the polygon's vertices.
+
Get the local coordinates of the polygon's vertices.
  
 
This function has a variable number of return values. It can be used in a nested fashion with [[love.graphics.polygon]].
 
This function has a variable number of return values. It can be used in a nested fashion with [[love.graphics.polygon]].
Line 5: Line 5:
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
x1, y1, x2, y2, x3, y3, ... = PolygonShape:getPoints( )
+
x1, y1, x2, y2, ... x8, y8 = PolygonShape:getPoints( )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
Line 14: Line 14:
 
{{param|number|x2|The x-component of the second vertex.}}
 
{{param|number|x2|The x-component of the second vertex.}}
 
{{param|number|y2|The y-component of the second vertex.}}
 
{{param|number|y2|The y-component of the second vertex.}}
{{param|number|x3|The x-component of the third vertex.}}
+
And so on, for up to eight vertices.
{{param|number|y3|The y-component of the third vertex.}}
 
  
The dots indicate that the function may have up to 16 return values, since it returns two values for each vertex in the polygon. (In other words, it can return 8 pairs in a series.)
+
This function may have up to 16 return values, since it returns two values for each vertex in the polygon. In other words, it can return the coordinates of up to 8 points.
  
 
== See Also ==
 
== See Also ==
 
* [[parent::PolygonShape]]
 
* [[parent::PolygonShape]]
 +
* [[parent::Body:getWorldPoints]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Get the world coordinates of the polygon's vertices.}}
+
{{#set:Description=Get the local coordinates of the polygon's vertices.}}
 
{{#set:Since=000}}
 
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|PolygonShape:getPoints}}
 
{{i18n|PolygonShape:getPoints}}

Latest revision as of 03:30, 14 May 2013

Get the local coordinates of the polygon's vertices.

This function has a variable number of return values. It can be used in a nested fashion with love.graphics.polygon.

Function

Synopsis

x1, y1, x2, y2, ... x8, y8 = PolygonShape:getPoints( )

Arguments

None.

Returns

number x1
The x-component of the first vertex.
number y1
The y-component of the first vertex.
number x2
The x-component of the second vertex.
number y2
The y-component of the second vertex.

And so on, for up to eight vertices.

This function may have up to 16 return values, since it returns two values for each vertex in the polygon. In other words, it can return the coordinates of up to 8 points.

See Also


Other Languages