package nape.constraint

AngleJoint

AngleJoint constraining the relative angles of two Bodies. *

* The equation for this constraint is: *

 * jointMin <= ratio * body2.rotation - body1.rotation <= jointMax
 * 

Constraint

Base type for all Nape joints and constraints

ConstraintIterator

Haxe Iterator compatible iterator over Nape list.

ConstraintList

Nape list of Constraint 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:Constraint = 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:Constraint = 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:Constraint = list.pop();
 *     // operate on object.
 *     // ...
 * }
 * 

DistanceJoint

DistanceJoint limiting the distance between two local anchor points of Bodies. *

* The equation for this constraint could be written like: *

 * jointMin <= distance(body2.localPointToWorld(anchor2), body1.localPointToWorld(anchor1)) <= jointMax
 * 
* This joint is not designed to work when jointMin = jointMax = 0 and constraint is * stiff. In this instance you should use a PivotJoint instead.

LineJoint

LineJoint constraining anchor of one body, to a line segment of the other. *

* The equation for this constraint could be written like: *

 *        0  = [dir.cross(delta)]  = 0
 * jointMin <= [dor.dot  (delta)] <= jointMax
 * 
* where: *
 * dir   = body1.localVectorToWorld(direction).unit();
 * delta = body2.localPointToWorld(anchor2).sub(body1.localPointToWorld(anchor1));
 * 
* This is a 2 dimensional constraint, and is (when at the limits) solved as a * block constraint for better stability. This is however not the most stable * of joint when chained and put under stress and is a rather rare case where * using a non-stiff joint can actually be more stable than * using a stiff one. *

* When jointMin = jointMax , it would be better to use a PivotJoint *instead with suitable * placed anchors. *

* The line segment is defined implicitly via the * anchor1, direction, jointMin and jointMax properties with end * points defined in local coordinate system of body1 like: *
 * start = anchor1.add(direction.unit().mul(jointMin))
 * end   = anchor1.add(direction.unit().mul(jointMax))
 * 
* The reason for this more general description of a line segment is that one or * both of jointMin, jointMax are permitted to be infinite and a line segment * defined with a start and end point is not sufficient to describe such lines.

MotorJoint

MotorJoint constraining the angular velocities of two bodies *

* The equation for this constraint is: *

 * (ratio * body2.angularVel) - body1.angularVel = rate
 * 
* This constraint operates only on the velocities of objects.

PivotJoint

PivotJoint constraining two anchors points of bodies to be equal. *

* The equation for this constraint is: *

 * body2.localPointToWorld(anchor2) = body1.localPointToWorld(anchor1)
 * 
* You may view this constraint as being equal to the DistanceJoint constraint * when both its jointMin and jointMax are exactly 0 (In such a case a * DistanceJoint becomes degenerate). Compared to the DistanceJoint this is * a 2 dimensional constraint.

PulleyJoint

PulleyJoint limiting the weighted sum of distances between 2 pairs of 4 local anchor points of Bodies. *

* The equation for this constraint could be written like: *

 * jointMin <= distance(body2.localPointToWorld(anchor2), body1.localPointToWorld(anchor1))
 *   + ratio * distance(body4.localPointToWorld(anchor4), body3.localPointToWorld(anchor3)) <= jointMax
 * 
* This joint is not designed to work when either of these pairs achieves a distance of 0, it will still work * but may not be entirely ideal. !1*

* This constraint can be used in a full 4-body set up, or a 3-body set up or a 2-body set up permitting * any arrangement as long as body1 != body2 and body3 != body4

UserConstraint

UserConstraint providing a low-level API for user-defined Constraints. *

* This API is intended to be powerful enough to model any constraint that * Nape can handle, but not so low level as to be completely prohibitive. *
* For instance, things like soft-constraints are automatically provided * by this API. *

* Working with this API will require mathematical skills. A full manual * for this API is provided at: http://napephys.com/help/Constraints.pdf *

* You may also be interested in the nape-symbolic module that is available * on github/haxelib/nape downloads. Which provides a run-time compiled DSL * using this API to make prototyping (or creating non-performance critical) * user-defined constraints simple without the need for great mathematical * skills as well as being much quicker to work with.

WeldJoint

WeldJoint constraining two bodies to be exactly locked together. *

* The equation for this constraint is: *

 * [ body2.localPointToWorld(anchor2) ] = [ body1.localPointToWorld(anchor1) ]
 * [          body2.rotation          ]   [      body1.rotation + phase      ]
 * 
* This constraint is equivalent to using a PivotJoint and AngleJoint * together except that it is solved as a single constraint and thus * will be more stable. *

* This constraint is 3 dimensional. *

* Although this constraint is very stable, if you chain bodies together * using this constraint, you should except to see a small amount of rotation * about the anchor points so you should chose them accordingly.