Class: Polygon

Tiny. Polygon

new Tiny.Polygon(points)

Name Type Description
points Array.<Tiny.Point> | Array.<number> repeatable

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 Tiny.Polygon(new Tiny.Point(), new Tiny.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.



An array of the points of this polygon


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

Default Value:


Creates a clone of this polygon

Type Description
Tiny.Polygon a copy of the polygon

Closes the polygon, adding points if necessary.

contains(x, y){boolean}

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

Name Type Description
x number

The X coordinate of the point to test

y number

The Y coordinate of the point to test

Type Description
boolean Whether the x/y coordinates are within this polygon
Documentation generated by JSDoc 3.4.3 on Fri Jul 09 2021 19:32:27 GMT+0800 (CST)