Difference between revisions of "love.math.isConvex"

m (Added note about where it's useful)
m (Arguments)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
Checks whether a polygon is convex.
 
Checks whether a polygon is convex.
  
[[PolygonShape]]s in [[love.physics]], some forms of [[Geometry]], and polygons drawn with [[love.graphics.polygon]] must be simple convex polygons.
+
[[PolygonShape]]s in [[love.physics]], some forms of [[Mesh]]es, and polygons drawn with [[love.graphics.polygon]] must be simple convex polygons.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
Line 9: Line 9:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|table|vertices|The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.}}
+
{{param|table|vertices|The vertices of the polygon as a table in the form of <code><nowiki>{x1, y1, x2, y2, x3, y3, ...}</nowiki></code>.}}
 +
 
 
=== Returns ===
 
=== Returns ===
 
{{param|boolean|convex|Whether the given polygon is convex.}}
 
{{param|boolean|convex|Whether the given polygon is convex.}}
Line 27: Line 28:
 
{{param|boolean|convex|Whether the given polygon is convex.}}
 
{{param|boolean|convex|Whether the given polygon is convex.}}
 
== See Also ==
 
== See Also ==
 +
* [[love.math.triangulate]]
 
* [[parent::love.math]]
 
* [[parent::love.math]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 09:00, 10 October 2016

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

Checks whether a polygon is convex.

PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons.

Function

Synopsis

convex = love.math.isConvex( vertices )

Arguments

table vertices
The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.

Returns

boolean convex
Whether the given polygon is convex.

Function

Synopsis

convex = love.math.isConvex( x1, y1, x2, y2, x3, y3, ... )

Arguments

number x1
The position of the first vertex of the polygon on the x-axis.
number y1
The position of the first vertex of the polygon on the y-axis.
number x2
The position of the second vertex of the polygon on the x-axis.
number y2
The position of the second vertex of the polygon on the y-axis.
number x3
The position of the third vertex of the polygon on the x-axis.
number y3
The position of the third vertex of the polygon on the y-axis.

Returns

boolean convex
Whether the given polygon is convex.

See Also

Other Languages