An abstract around an Array of IPoint
s that define a polygonal shape that can be collision-tested against.
See also:
Static variables
Static methods
staticcontains(this:Array<IPoint>, p:Point, isConvex:Bool = false):Bool
Tests if Point p
is inside this IPolygon.
Parameters:
p | The point to test against. |
---|---|
isConvex | Use simplified collision test suited for convex polygons. Results are undefined if polygon is concave. |
staticconvexHull(this:Array<IPoint>):Array<IPoint>
Returns a new IPolygon containing a convex hull of this IPolygon. See Monotone chain algorithm for more details.
staticinlineintersection(this:Array<IPoint>, p:IPolygon, withHoles:Bool = true):IPolygons
Calculates an intersection areas between this IPolygon and a given IPolygon p
and returns the resulting IPolygons.
Parameters:
p | The IPolygon to intersect with. |
---|---|
withHoles | When enabled, keeps the holes in resulting polygons as a separate IPolygon. |
staticoffset(this:Array<IPoint>, delta:Float, kind:OffsetKind, withHoles:Bool = true):IPolygons
Offsets the polygon edges by specified amount and returns the 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<IPoint>, epsilon:Float):IPolygon
Creates a new optimized polygon by eliminating almost colinear edges according to the epsilon distance.
staticreverse(this:Array<IPoint>):Void
Reverses the IPolygon points ordering. Can be used to change polygon from anti-clockwise to clockwise.
staticinlinesubtraction(this:Array<IPoint>, p:IPolygon, withHoles:Bool = true):IPolygons
Subtracts the area of a given IPolygon p
from this IPolygon and returns the resulting IPolygons.
Parameters:
p | The IPolygon to subtract with. |
---|---|
withHoles | When enabled, keeps the holes in resulting polygons as a separate IPolygon. |