An abstract over an Array of Polygon 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 Polygons instance.

staticread onlypolygons:Array<Polygon>

An underlying Polygon array.

Static methods

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

Tests if Point p is inside any of the Polygon instances in Polygons.

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<Polygon>, ?b:Bounds):Null<Bounds>

Returns bounding box of all Polygon instances in Polygons.

Parameters:

b

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

@:value({ isConvex : false })staticgetCollider(this:Array<Polygon>, isConvex:Bool = false):PolygonCollider

Returns new PolygonCollider instance containing this Polygons.

Parameters:

isConvex

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

staticoptimize(this:Array<Polygon>, epsilon:Float):Polygons

Optimizes all polygons and returns new Polygons instances. See [h2d.col.Polygon.optimize].

@:value({ scale : 1. })statictoIPolygons(this:Array<Polygon>, scale:Float = 1.):IPolygons

Converts Polygons instance to Int-based IPolygons.