Chipmunk2D Pro API Reference  7.0.0
 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 
34 void cpArbiterSetRestitution(cpArbiter *arb, cpFloat restitution);
38 void cpArbiterSetFriction(cpArbiter *arb, cpFloat friction);
39 
40 // Get the relative surface velocity of the two shapes in contact.
41 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 void cpArbiterSetSurfaceVelocity(cpArbiter *arb, cpVect vr);
46 
51 void cpArbiterSetUserData(cpArbiter *arb, cpDataPointer userData);
52 
59 
63 
67 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 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 
104 
109 
111 int cpArbiterGetCount(const cpArbiter *arb);
115 cpVect cpArbiterGetPointA(const cpArbiter *arb, int i);
117 cpVect cpArbiterGetPointB(const cpArbiter *arb, int i);
119 cpFloat cpArbiterGetDepth(const cpArbiter *arb, int i);
120 
127 
134 
139 
144