| Name | Type | Description |
|---|---|---|
points |
(PointData[] | number[])[] | PointData[] | 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.
|
Implements
Members
false after moveTo, true after closePath. In all other cases it is true.
Get the last X coordinate of the polygon
Get the last Y coordinate of the polygon
An array of the points of this polygon.
type SHAPE_PRIMITIVE readonly
The type of the object, mainly used to avoid instanceof checks
- Default Value:
- 'polygon'
Get the first X coordinate of the polygon
Get the first Y coordinate of the polygon
Methods
Creates a clone of this polygon.
Returns:
| Type | Description |
|---|---|
| Polygon |
|
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. |
Returns:
| Type | Description |
|---|---|
| boolean |
|
Copies another polygon to this one.
| Name | Type | Description |
|---|---|---|
polygon |
Polygon |
The polygon to copy from. |
Returns:
| Type | Description |
|---|---|
| this | Returns itself. |
Copies this polygon to another one.
| Name | Type | Description |
|---|---|---|
polygon |
Polygon |
The polygon to copy to. |
Returns:
| Type | Description |
|---|---|
| Polygon | Returns given parameter. |
Returns the framing rectangle of the polygon as a Rectangle object
| Name | Type | Attributes | Description |
|---|---|---|---|
out |
Rectangle |
<optional> |
optional rectangle to store the result |
Returns:
| Type | Description |
|---|---|
| Rectangle | The framing rectangle |
Checks whether the x and y coordinates given are contained within this polygon including the stroke.
| Name | Type | Description |
|---|---|---|
x |
number |
The X coordinate of the point to test |
y |
number |
The Y coordinate of the point to test |
strokeWidth |
number |
The width of the line to check |
Returns:
| Type | Description |
|---|---|
| boolean | Whether the x/y coordinates are within this polygon |