An abstract over an Array of IPolygon instances that define multiple polygonal shapes that can be collision-tested against.

See also:

Static variables

staticread onlylength:Int

The amount of polygons in the IPolygons instance.

staticread onlypolygons:Array<IPolygon>

An underlying IPolygon array.

Static methods

@:value({ isConvex : false })staticcontains(this:Array<IPolygon>, p:Point, isConvex:Bool = false):Bool

Tests if Point p is inside this IPolygons.

Parameters:

p

The point to test against.

isConvex

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

staticgetBounds(this:Array<IPolygon>, ?b:IBounds):Null<IBounds>

Returns bounding box of all IPolygon instances in IPolygons.

Parameters:

b

Optional Bounds instance to be filled. Returns new Bounds instance if null.

@:value({ withHoles : true })staticinlineintersection(this:Array<IPolygon>, p:IPolygons, withHoles:Bool = true):IPolygons

Calculates an intersection areas between this IPolygons and given IPolygons p and returns resulting IPolygons.

Parameters:

p

The IPolygons to intersect with.

withHoles

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

@:value({ withHoles : true })staticoffset(this:Array<IPolygon>, delta:Float, kind:OffsetKind, withHoles:Bool = true):IPolygons

Offsets polygon edges by specified amount and returns 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.

staticoptimize(this:Array<IPolygon>, epsilon:Float):IPolygons

Creates a set of new optimized polygons by eliminating almost colinear edges according to the epsilon distance.

@:value({ withHoles : true })staticinlinesubtraction(this:Array<IPolygon>, p:IPolygons, withHoles:Bool = true):IPolygons

Subtracts the area of given IPolygons p from this IPolygons and returns resulting IPolygons.

Parameters:

p

The IPolygons to subtract with.

withHoles

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

@:value({ scale : 1. })statictoPolygons(this:Array<IPolygon>, scale:Float = 1.):Polygons

Converts the IPolygons instance to the floating point-based Polygons.

@:value({ withHoles : true })staticunion(this:Array<IPolygon>, ?p:IPolygons, withHoles:Bool = true):IPolygons

Combines this IPolygons and given IPolygons p and returns resulting IPolygons.

Parameters:

p

Optional IPolygons to union with. When not set, unions all polygons in this IPolygons.

withHoles

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