Polygon¶
-
php\gdx\math\Polygon
Class Polygon
Methods
__construct
($vertices)¶
Parameters:
- $vertices – array - (optional)
getVertices
()¶Returns the polygon’s local vertices without scaling or rotation and without being offset by the polygon position.
Returns: float[]
getTransformedVertices
()¶
Returns: float[] vertices scaled, rotated, and offset by the polygon position.
setOrigin
($originX, $originY)¶Sets the origin point to which all of the polygon’s local vertices are relative to.
Parameters:
- $originX – float
- $originY – float
setPosition
($x, $y)¶Sets the polygon’s position within the world.
Parameters:
- $x – float
- $y – float
setVertices
($vertices)¶
Parameters:
- $vertices – array
translate
($x, $y)¶Translates the polygon’s position by the specified horizontal and vertical amounts.
Parameters:
- $x – float
- $y – float
setRotation
($degrees)¶Sets the polygon to be rotated by the supplied degrees.
Parameters:
- $degrees – float
rotate
($degrees)¶Applies additional rotation to the polygon by the supplied degrees.
Parameters:
- $degrees – float
setScale
($scaleX, $scaleY)¶Sets the amount of scaling to be applied to the polygon.
Parameters:
- $scaleX – float
- $scaleY – float
scale
($amount)¶Applies additional scaling to the polygon by the supplied amount.
Parameters:
- $amount – float
dirty
()¶
area
()¶Returns the area contained within the polygon.
Returns: float
contains
($x, $y)¶
Parameters:
- $x – float
- $y – float
Returns: bool
getX
()¶
Returns: float
getY
()¶
Returns: float
getOriginX
()¶
Returns: float
getOriginY
()¶
Returns: float
getRotation
()¶
Returns: float
getScaleX
()¶
Returns: float
getScaleY
()¶
Returns: float