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

See also:

Variables

@:implread onlylength:Int

The amount of polygons in the Polygons instance.

@:implread onlypolygons:Array<Polygon>

An underlying Polygon array.

Methods

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

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

@:imploptimize(epsilon:Float):Polygons

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

@:value({ scale : 1. })@:impltoIPolygons(scale:Float = 1.):IPolygons

Converts Polygons instance to Int-based IPolygons.