Polygon

php\gdx\math\Polygon

Class Polygon

Methods


__construct($vertices)
Parameters:
  • $verticesarray - (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:
  • $originXfloat
  • $originYfloat
setPosition($x, $y)

Sets the polygon’s position within the world.

Parameters:
  • $xfloat
  • $yfloat
setVertices($vertices)
Parameters:
  • $verticesarray
translate($x, $y)

Translates the polygon’s position by the specified horizontal and vertical amounts.

Parameters:
  • $xfloat
  • $yfloat
setRotation($degrees)

Sets the polygon to be rotated by the supplied degrees.

Parameters:
  • $degreesfloat
rotate($degrees)

Applies additional rotation to the polygon by the supplied degrees.

Parameters:
  • $degreesfloat
setScale($scaleX, $scaleY)

Sets the amount of scaling to be applied to the polygon.

Parameters:
  • $scaleXfloat
  • $scaleYfloat
scale($amount)

Applies additional scaling to the polygon by the supplied amount.

Parameters:
  • $amountfloat
dirty()
area()

Returns the area contained within the polygon.

Returns:float
contains($x, $y)
Parameters:
  • $xfloat
  • $yfloat
Returns:

bool

getX()
Returns:float
getY()
Returns:float
getOriginX()
Returns:float
getOriginY()
Returns:float
getRotation()
Returns:float
getScaleX()
Returns:float
getScaleY()
Returns:float