Uses a convex polygonal structure to check for collisions.
Static functions
static createFromArray (points : Array<Float>) : Polygon
Creates a polygon from an array were even numbers are x and odd are y
Parameters:
points | Array containing the polygon's points. |
Returns:
The polygon
static createPolygon (sides : Int = 3, radius : Float = 100, angle : Float = 0) : Polygon
Creates a regular polygon (edges of same length).
Parameters:
sides | The number of sides in the polygon. | |
radius | The distance that the vertices are at. | |
angle | How much the polygon is rotated (in degrees). |
Returns:
The polygon
static fromPoints (points : Array<Vector2>, origin : Vector2) : Masklist
Creates a list of convex polygonal masks based on an array of vertices defined counter-clockwise. The polygon must be simple (non-self-intersecting), but not necessarily convex.
Parameters:
points | An array of coordinates that define the polygon (must have at least 3 and defined counter-clockwise). | |
origin | Pivot point for rotations. |