Class: Polygon

Polygon


new Polygon(points_)

Parameters:
Name Type Description
points_ Array.<Vector> | Array.<number> | Vector | number

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 Vector(), new Vector(), ...), 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.

Source:

Members


points :Array.<number>

An array of the points of this polygon

Type:
  • Array.<number>
Source:

type :number

The type of the object, mainly used to avoid instanceof checks

Type:
  • number
Source:

Methods


clone()

Creates a clone of this polygon

Source:
Returns:

a copy of the polygon

Type
Polygon

contains(x, y)

Checks whether the x and y coordinates passed to this function are contained within this polygon

Parameters:
Name Type Description
x number

The X coordinate of the point to test

y number

The Y coordinate of the point to test

Source:
Returns:

Whether the x/y coordinates are within this polygon

Type
boolean