package 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++) {
 *     var obj:ConvexResult = list.at(i);
 * }
 * 
*
* NOTE: It is 'not' safe to modify a list whilst iterating over it. * If you wish to remove elements during an iteration you should use the * filter method, for example: *
 * list.filter(function (obj) {
 *     // operate on object.
 *     // ...
 *     return (false if you want object to be removed);
 * });
 * 
*

* In AS3, if you wish to avoid a closure generation, you can perform such * an iteration in a safe manner as follows: *
 * var i:int = 0;
 * while (i < list.length) {
 *     var obj:ConvexResult = list.at(i);
 *     // operate on object.
 *     // ...
 *     if (should remove obj) {
 *         list.remove(obj);
 *         continue;
 *     }
 *     else i++;
 * }
 * 
* Or if you are always clearing the list entirely you could write: *
 * while (!list.empty()) {
 *     var obj:ConvexResult = list.pop();
 *     // operate on object.
 *     // ...
 * }
 * 

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++) {
 *     var obj:GeomPoly = list.at(i);
 * }
 * 
*
* NOTE: It is 'not' safe to modify a list whilst iterating over it. * If you wish to remove elements during an iteration you should use the * filter method, for example: *
 * list.filter(function (obj) {
 *     // operate on object.
 *     // ...
 *     return (false if you want object to be removed);
 * });
 * 
*

* In AS3, if you wish to avoid a closure generation, you can perform such * an iteration in a safe manner as follows: *
 * var i:int = 0;
 * while (i < list.length) {
 *     var obj:GeomPoly = list.at(i);
 *     // operate on object.
 *     // ...
 *     if (should remove obj) {
 *         list.remove(obj);
 *         continue;
 *     }
 *     else i++;
 * }
 * 
* Or if you are always clearing the list entirely you could write: *
 * while (!list.empty()) {
 *     var obj:GeomPoly = list.pop();
 *     // operate on object.
 *     // ...
 * }
 * 

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.

IsoFunction

For 'flash' targets only. *

* Iso-functions for MarchingSquares must be given * as an object implementing this IsoFunction interface. This is for * reasons of avoiding excessive memory allocations that occur through * automatic boxing of arguments/return values when using function values. *
* Since iso-functions may be called 10,000's of times per-invocation of * marching-squares, this can quickly accumulate into a lot of GC activity.

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) - rr *
* 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;
 
 *    var a00 = bitmap.getPixel32(ix, iy) >>> 24;
 *    var a01 = bitmap.getPixel32(ix, iy + 1) >>> 24;
 *    var a10 = bitmap.getPixel32(ix + 1, iy) >>> 24;
 *    var a11 = bitmap.getPixel32(ix + 1, iy + 1) >>> 24;
 
 *    return 0x80 - (gxgya00 + fxgya10 + gxfya01 + fxfy*a11);
 * }
 * 
* For 'flash', we must wrap this in an IsoFunction interface to be used * by MarchingSquares for performance reasons: *
 * class BitmapIsoFunction implements nape.geom.IsoFunction {
 *     public function iso(x:Float, y:Float):Float {
 *         ...
 *     }
 * }
 * 
* This function is converted into a set of polygons by sampling along regular * grid points, and then recursively interpolating along cell edges based on * the function provided to find the point in space along that edge where the * function is approximately 0. *

* From this we generate polygons in each grid cell, which are then by default * combined into larger, weakly simply polygons suitable for use in the * decomposition routines of GeomPoly like convexDecomposition! *

* The runtime of the algorithm is O(N+K) for N number of cells and K number * of output vertices (A final pass is made to remove unnecessary vertices).

Mat23

2D Matrix class representing affine transformations: *

 * [ a  b  tx ]
 * [ c  d  ty ]
 * [ 0  0  1  ]
 * 
* * Note that in AS3, flash.geom.Matrix has 'b' and 'c' swapped! so if you are * converting between flash.geom.Matrix and nape.geom.Mat23 you should use the * methods provided to avoid any mistakes with this.

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++) {
 *     var obj:RayResult = list.at(i);
 * }
 * 
*
* NOTE: It is 'not' safe to modify a list whilst iterating over it. * If you wish to remove elements during an iteration you should use the * filter method, for example: *
 * list.filter(function (obj) {
 *     // operate on object.
 *     // ...
 *     return (false if you want object to be removed);
 * });
 * 
*

* In AS3, if you wish to avoid a closure generation, you can perform such * an iteration in a safe manner as follows: *
 * var i:int = 0;
 * while (i < list.length) {
 *     var obj:RayResult = list.at(i);
 *     // operate on object.
 *     // ...
 *     if (should remove obj) {
 *         list.remove(obj);
 *         continue;
 *     }
 *     else i++;
 * }
 * 
* Or if you are always clearing the list entirely you could write: *
 * while (!list.empty()) {
 *     var obj:RayResult = list.pop();
 *     // operate on object.
 *     // ...
 * }
 * 

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++) {
 *     var obj:Vec2 = list.at(i);
 * }
 * 
*
* NOTE: It is 'not' safe to modify a list whilst iterating over it. * If you wish to remove elements during an iteration you should use the * filter method, for example: *
 * list.filter(function (obj) {
 *     // operate on object.
 *     // ...
 *     return (false if you want object to be removed);
 * });
 * 
*

* In AS3, if you wish to avoid a closure generation, you can perform such * an iteration in a safe manner as follows: *
 * var i:int = 0;
 * while (i < list.length) {
 *     var obj:Vec2 = list.at(i);
 *     // operate on object.
 *     // ...
 *     if (should remove obj) {
 *         list.remove(obj);
 *         continue;
 *     }
 *     else i++;
 * }
 * 
* Or if you are always clearing the list entirely you could write: *
 * while (!list.empty()) {
 *     var obj:Vec2 = list.pop();
 *     // operate on object.
 *     // ...
 * }
 * 

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. * * If the vertices are ordered 12 -> 1 -> 2 ... -> 12 * then this polygon is clockwise wound. The reverse order would mean the * polygon is wound anticlockwise.