springroll.native.Polygon Class

Constructor

springroll.native.Polygon

(
  • points
)

Parameters:

  • points Array | Array | Point... | Number... multiple

    This can be an array of Points that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be all the points of the polygon e.g. new Polygon(new Point(), new Point(), ...), or the arguments passed can be flat x,y values e.g. new Polygon(x,y, x,y, x,y, ...) where x and y are Numbers.

Methods

clone

() Polygon

Defined in clone:42

Creates a clone of this polygon

Returns:

Polygon:

a copy of the polygon

contains

(
  • x
  • y
)
Boolean

Defined in contains:59

Checks if the x, and y coords passed to this function are contained within this polygon

Parameters:

  • x Number

    The X coord of the point to test

  • y Number

    The Y coord of the point to test

Returns:

Boolean:

if the x/y coords are within this polygon