abstract IPolygons(Array<IPolygon>)
package h2d.col
from Array<IPolygon> to Array<IPolygon>
An abstract over an Array of IPolygon
instances that define multiple polygonal shapes that can be collision-tested against.
See also:
Static variables
Static methods
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 |
---|
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. |
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.
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. |
statictoPolygons(this:Array<IPolygon>, scale:Float = 1.):Polygons
Converts the IPolygons instance to the floating point-based Polygons.
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. |