An abstract around an Array of `IPoint`

s that define a polygonal shape that can be collision-tested against.

See also:

### Variables

### Methods

`contains(p:Point, isConvex:Bool = false):Bool`

Tests if Point `p`

is inside this IPolygon.

Parameters:

`p` | The point to test against. |
---|---|

`isConvex` | Use simplified collision test suited for convex polygons. Results are undefined if polygon is concave. |

`convexHull():Array<IPoint>`

Returns a new IPolygon containing a convex hull of this IPolygon. See Monotone chain algorithm for more details.

`inlineintersection(p:IPolygon, withHoles:Bool = true):IPolygons`

Calculates an intersection areas between this IPolygon and a given IPolygon `p`

and returns the resulting IPolygons.

Parameters:

`p` | The IPolygon to intersect with. |
---|---|

`withHoles` | When enabled, keeps the holes in resulting polygons as a separate IPolygon. |

`offset(delta:Float, kind:OffsetKind, withHoles:Bool = true):IPolygons`

Offsets the polygon edges by specified amount and returns the resulting IPolygons.

Parameters:

`delta` | The offset amount. |
---|---|

`kind` | The corner rounding method. |

`withHoles` | When enabled, keeps the holes in resulting polygons as a separate IPolygon. |

`optimize(epsilon:Float):IPolygon`

Creates a new optimized polygon by eliminating almost colinear edges according to the epsilon distance.

`reverse():Void`

Reverses the IPolygon points ordering. Can be used to change polygon from anti-clockwise to clockwise.

`inlinesubtraction(p:IPolygon, withHoles:Bool = true):IPolygons`

Subtracts the area of a given IPolygon `p`

from this IPolygon and returns the resulting IPolygons.

Parameters:

`p` | The IPolygon to subtract with. |
---|---|

`withHoles` | When enabled, keeps the holes in resulting polygons as a separate IPolygon. |