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

See also:

Variables

@:implread onlylength:Int

The amount of polygons in the IPolygons instance.

@:implread onlypolygons:Array<IPolygon>

An underlying IPolygon array.

Methods

@:value({ isConvex : false })@:implcontains(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.

@:implgetBounds(?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 })@:implinlineintersection(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 })@:imploffset(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.

@:imploptimize(epsilon:Float):IPolygons

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

@:value({ withHoles : true })@:implinlinesubtraction(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. })@:impltoPolygons(scale:Float = 1.):Polygons

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

@:value({ withHoles : true })@:implunion(?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.