nape.geom

..
AABB

Axis Aligned Bounding Box (AABB)

Note that in many cases of an AABB object being returned by a Nape function the AABB object will be marked internally as an 'immutable' AABB. This will always be documented and trying to mutate such an AABB will result in an error being thrown.

ConvexResult

Class representing the results of a convex cast operation.

These objects are allocated from an object pool and can be released back to that pool by calling its dispose method.

ConvexResultIterator

Haxe Iterator compatible iterator over Nape list.

ConvexResultList

Nape list of ConvexResult type objects

Internally this list is at present implemented as a linked list with object pooled nodes and iterators with various fast paths made for standard access patterns (For instance accessing successive elements runs in constant time when using random access functions)

Iteration of this list can be done in various ways, but the preferred way on all targets, is through use of the foreach function:

list.foreach(function (obj) {
});
This method is inlined so that in haxe no closure will need to be created.

In AS3, a closure would need to be created in general, so for performance reasons you 'may' choose to use iteration as follows:
for (var i:int = 0; i < list.length; i++) {

Geom

Geom class provides interface to collision detection routines in nape.

GeomPoly

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.

GeomPolyIterator

Haxe Iterator compatible iterator over Nape list.

GeomPolyList

Nape list of GeomPoly type objects

Internally this list is at present implemented as a linked list with object pooled nodes and iterators with various fast paths made for standard access patterns (For instance accessing successive elements runs in constant time when using random access functions)

Iteration of this list can be done in various ways, but the preferred way on all targets, is through use of the foreach function:

list.foreach(function (obj) {
});
This method is inlined so that in haxe no closure will need to be created.

In AS3, a closure would need to be created in general, so for performance reasons you 'may' choose to use iteration as follows:
for (var i:int = 0; i < list.length; i++) {

GeomVertexIterator

Haxe compatible iterator over vertices of GeomPoly.

Vec2's intrinsically tied to the vertices are exposed through the iterator which does not modify the state of the polygon.

IsoFunctionDef

Typedef defining iso-function type for MarchingSquares. typedef IsoFunctionDef = #if flash IsoFunction #else Float->Float->Float #end;

MarchingSquares

Iso-surface extraction into polygons.

This class, with only one static method provides an interface to an algorithm which will, when given a function mapping each point in a given AABB to a scalar value extract approximated polygons which represent the region of the AABB where the function returns a negative value.

This function could be a mathematical function like the equation of a circle: function (x, y) return (xx + yy) - r*r
Or something more practical like the biased alpha value interpolated from a Bitmap:

function (x, y) {
var ix = if (x < 0) 0 else if (x >= bitmap.width - 1) bitmap.width - 2 else Std.int(x);
var iy = if (y < 0) 0 else if (y >= bitmap.height - 1) bitmap.height - 2 else Std.int(y);
var fx = x - ix;
var fy = y - iy;
var gx = 1 - fx;
var gy = 1 - fy;

Mat23

2D Matrix class representing affine transformations:

[ a  b  tx ]
[ c  d  ty ]
[ 0  0  1  ]

MatMN

A general MxN dimensional matrix.

This object is not often used in Nape :)

Ray

Parametrically defined ray used in ray casting functions.

RayResult

Class representing the results of a ray cast operation.

These objects are allocated from an object pool and can be released back to that pool by calling its dispose method.

RayResultIterator

Haxe Iterator compatible iterator over Nape list.

RayResultList

Nape list of RayResult type objects

Internally this list is at present implemented as a linked list with object pooled nodes and iterators with various fast paths made for standard access patterns (For instance accessing successive elements runs in constant time when using random access functions)

Iteration of this list can be done in various ways, but the preferred way on all targets, is through use of the foreach function:

list.foreach(function (obj) {
});
This method is inlined so that in haxe no closure will need to be created.

In AS3, a closure would need to be created in general, so for performance reasons you 'may' choose to use iteration as follows:
for (var i:int = 0; i < list.length; i++) {

Vec2

2 Dimensional vector.

Note that in many cases of a Vec2 object being returned by a Nape function the Vec2 object will be marked internally as an 'immutable' Vec2. This will always be documented and trying to mutate such a Vec2 will result in an error being thrown.

Vec2 objects can make use of a global object pool, attempting to make use of a disposed Vec2 will also result in an error with the object pool working in a FILO order to increase the likelihood of such misuse being caught.

Additionally Vec2 objects can be created as 'weak'. Passing a weak Vec2 to any Nape function as an argument will result in the automatic disposal of the Vec2 once the method has finished with it. There may be exceptions to this rule which will also be documented; a notable case being the appending of a weak Vec2 to a Nape Vec2List in which case the disposal of the weak Vec2 is performed when that Vec2List is handed to a Nape function instead.

Example:

var vertices = Polygon.box(20, 20, true);
var polygon = new Polygon(vertices);
In this example, passing true to the Polygon.box method means that we will be returned a Vec2List containing only 'weak' Vec2s. Upon passing this Vec2List to the Polygon constructor, all of the Vec2s from that list will be automatically disposed.

Vec2Iterator

Haxe Iterator compatible iterator over Nape list.

Vec2List

Nape list of Vec2 type objects

Internally this list is at present implemented as a linked list with object pooled nodes and iterators with various fast paths made for standard access patterns (For instance accessing successive elements runs in constant time when using random access functions)

Iteration of this list can be done in various ways, but the preferred way on all targets, is through use of the foreach function:

list.foreach(function (obj) {
});
This method is inlined so that in haxe no closure will need to be created.

In AS3, a closure would need to be created in general, so for performance reasons you 'may' choose to use iteration as follows:
for (var i:int = 0; i < list.length; i++) {

Vec3

A 3 dimensional vector object.

In many instances a Vec3 will be accessible from Nape which is marked as immutable, these cases will be documented and modifying such a Vec3 will result in an error.

Winding

Enumeration represents the winding of a Polygon.

To appreciate what the winding of a polygon means, think of a polygon who's vertices are the numbers on a clock face.