Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
cpArbiter.h
1 /* Copyright (c) 2013 Scott Lembcke and Howling Moon Software
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19  * SOFTWARE.
20  */
21 
28 
29 #define CP_MAX_CONTACTS_PER_ARBITER 2
30 
32 CP_EXPORT cpFloat cpArbiterGetRestitution(const cpArbiter *arb);
34 CP_EXPORT void cpArbiterSetRestitution(cpArbiter *arb, cpFloat restitution);
36 CP_EXPORT cpFloat cpArbiterGetFriction(const cpArbiter *arb);
38 CP_EXPORT void cpArbiterSetFriction(cpArbiter *arb, cpFloat friction);
39 
40 // Get the relative surface velocity of the two shapes in contact.
41 CP_EXPORT cpVect cpArbiterGetSurfaceVelocity(cpArbiter *arb);
42 
43 // Override the relative surface velocity of the two shapes in contact.
44 // By default this is calculated to be the difference of the two surface velocities clamped to the tangent plane.
45 CP_EXPORT void cpArbiterSetSurfaceVelocity(cpArbiter *arb, cpVect vr);
46 
48 CP_EXPORT cpDataPointer cpArbiterGetUserData(const cpArbiter *arb);
51 CP_EXPORT void cpArbiterSetUserData(cpArbiter *arb, cpDataPointer userData);
52 
55 CP_EXPORT cpVect cpArbiterTotalImpulse(const cpArbiter *arb);
58 CP_EXPORT cpFloat cpArbiterTotalKE(const cpArbiter *arb);
59 
62 CP_EXPORT cpBool cpArbiterIgnore(cpArbiter *arb);
63 
67 CP_EXPORT void cpArbiterGetShapes(const cpArbiter *arb, cpShape **a, cpShape **b);
68 
70 #define CP_ARBITER_GET_SHAPES(__arb__, __a__, __b__) cpShape *__a__, *__b__; cpArbiterGetShapes(__arb__, &__a__, &__b__);
71 
75 CP_EXPORT void cpArbiterGetBodies(const cpArbiter *arb, cpBody **a, cpBody **b);
76 
78 #define CP_ARBITER_GET_BODIES(__arb__, __a__, __b__) cpBody *__a__, *__b__; cpArbiterGetBodies(__arb__, &__a__, &__b__);
79 
83  int count;
84 
87 
89  struct {
91  cpVect pointA, pointB;
95  } points[CP_MAX_CONTACTS_PER_ARBITER];
96 };
97 
100 
103 CP_EXPORT void cpArbiterSetContactPointSet(cpArbiter *arb, cpContactPointSet *set);
104 
106 CP_EXPORT cpBool cpArbiterIsFirstContact(const cpArbiter *arb);
108 CP_EXPORT cpBool cpArbiterIsRemoval(const cpArbiter *arb);
109 
111 CP_EXPORT int cpArbiterGetCount(const cpArbiter *arb);
113 CP_EXPORT cpVect cpArbiterGetNormal(const cpArbiter *arb);
115 CP_EXPORT cpVect cpArbiterGetPointA(const cpArbiter *arb, int i);
117 CP_EXPORT cpVect cpArbiterGetPointB(const cpArbiter *arb, int i);
119 CP_EXPORT cpFloat cpArbiterGetDepth(const cpArbiter *arb, int i);
120 
123 CP_EXPORT cpBool cpArbiterCallWildcardBeginA(cpArbiter *arb, cpSpace *space);
126 CP_EXPORT cpBool cpArbiterCallWildcardBeginB(cpArbiter *arb, cpSpace *space);
127 
134 
136 CP_EXPORT void cpArbiterCallWildcardPostSolveA(cpArbiter *arb, cpSpace *space);
138 CP_EXPORT void cpArbiterCallWildcardPostSolveB(cpArbiter *arb, cpSpace *space);
139 
141 CP_EXPORT void cpArbiterCallWildcardSeparateA(cpArbiter *arb, cpSpace *space);
143 CP_EXPORT void cpArbiterCallWildcardSeparateB(cpArbiter *arb, cpSpace *space);
144