nape.geom.GeomPoly

type
class
Polygon class with various geometric methods

This class represents a general Polygon, rather than the Polygon class which is physics shape.

Internally this polygon is stored as a circularly linked list of special vertex types that are exposed via a Vec2 that is lazily constructed whenever necessary to the API.

Static Methods

static function get(vertices:Dynamic = null):GeomPoly

+ Allocate GeomPoly from object pool.

Constructor

function new(vertices:Dynamic = null)
+ Create a new GeomPoly polygon.

Instance Methods

function area():Float

+ Compute area of weakly-simple polygon.

inline function backwardsIterator():GeomVertexIterator

+ Haxe iterator over vertices of polygon.

function bottom():Vec2

+ Find bottom most vertex of polygon.

function bounds():AABB

+ Determine bounds of polygon.

function clear():GeomPoly

+ Clear all vertices from polygon.

function contains(point:Vec2):Bool

+ Determine if point is contained in polygon.

function convexDecomposition(delaunay:Bool = false, output:GeomPolyList = null):GeomPolyList

+ Produce a decomposition of weakly-simple polygon into convex components.

function copy():GeomPoly

+ Copy this polygon.

inline function current():Vec2

+ Current vertex at head of polygon.

function cut(start:Vec2, end:Vec2, boundedStart:Bool = false, boundedEnd:Bool = false, output:GeomPolyList = null):GeomPolyList

+ Cut simple polygon with line.

function dispose():Void

+ Release this GeomPoly to global object pool.

inline function empty():Bool

+ Determine if polygon is empty.

function erase(count:Int):GeomPoly

+ Erase count number of elements

inline function forwardIterator():GeomVertexIterator

+ Haxe iterator over vertices of polygon.

function inflate(inflation:Float):GeomPoly

+ Inflate/Deflate polygon.

inline function isClockwise():Bool

+ Determine if polygon is clockwise wound.

function isConvex():Bool

+ Determine if weakly-simple polygon is convex.

inline function isDegenerate():Bool

+ Determine if weakly-simple polygon is degenerate.

inline function isMonotone():Bool

+ Determine if polygon is y-monotone.

inline function isSimple():Bool

+ Determine if polygon is strictly simple.

inline function iterator():GeomVertexIterator

+ Haxe iterator over vertices of polygon.

function left():Vec2

+ Find left most vertex of polygon.

function monotoneDecomposition(output:GeomPolyList = null):GeomPolyList

+ Produce a decomposition of weakly-simple polygon into monotone components.

function pop():GeomPoly

+ Pop vertex from polygon.

function push(vertex:Vec2):GeomPoly

+ Push vertex to polygon.

function right():Vec2

+ Find right most vertex of polygon.

function shift():GeomPoly

+ Shift vertex from polygon.

function simpleDecomposition(output:GeomPolyList = null):GeomPolyList

+ Produce a decomposition of complex polygon into simple components.

function simplify(epsilon:Float):GeomPoly

+ Simplify polygon.

function size():Int

+ Determine number of vertices in polygon

inline function skipBackwards(times:Int):GeomPoly

+ Advance head of polygon backwards.

function skipForward(times:Int):GeomPoly

+ Advance head of polygon forward.

function top():Vec2

+ Find top most vertex of polygon.

function transform(matrix:Mat23):GeomPoly

+ Transform polygon by given matrix.

function triangularDecomposition(delaunay:Bool = false, output:GeomPolyList = null):GeomPolyList

+ Produce a decomposition of weakly-simple polygon into triangles.

function unshift(vertex:Vec2):GeomPoly

+ Unshift vertex to polygon.

function winding():Winding

+ Compute the winding order for this polygon.