Class: Polygon

Polygon

new Polygon(center)

Creates an instance of Polygon.

Name Type Default Description
center Vector average(verticies) optional The center of the polygon. If a value is not provided the default value becomes the centroid of the verticies.
Properties:
Name Type Description
center Vector The center of the polygon. If not otherwise stated, the center defaults to the centriod. Any transformations on the polygon are done about the center of the polygon.

Extends

  • Array

Methods

Get the centroid of the polygon. This is the vector average of all the points that make up the polygon.
Returns:
Type Description
Vector The centroid of the polygon
Get the polygon inset of the current polygon by the input ammount
Name Type Description
ammount
Returns:
Type Description
Polygon The inset of the current polygon by

isConvex(){boolean}

Returns wheither or not this polygon is a convex polygon. If this is not true then the polygon is convace or more complex.
Returns:
Type Description
boolean If the polygon is convex