[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / chipmunk2d / include / chipmunk / cpConstraint.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
22 /// @defgroup cpConstraint cpConstraint
23 /// @{
24
25 /// Callback function type that gets called before solving a joint.
26 typedef void (*cpConstraintPreSolveFunc)(cpConstraint *constraint, cpSpace *space);
27 /// Callback function type that gets called after solving a joint.
28 typedef void (*cpConstraintPostSolveFunc)(cpConstraint *constraint, cpSpace *space);
29
30 /// Destroy a constraint.
31 CP_EXPORT void cpConstraintDestroy(cpConstraint *constraint);
32 /// Destroy and free a constraint.
33 CP_EXPORT void cpConstraintFree(cpConstraint *constraint);
34
35 /// Get the cpSpace this constraint is added to.
36 CP_EXPORT cpSpace* cpConstraintGetSpace(const cpConstraint *constraint);
37
38 /// Get the first body the constraint is attached to.
39 CP_EXPORT cpBody* cpConstraintGetBodyA(const cpConstraint *constraint);
40
41 /// Get the second body the constraint is attached to.
42 CP_EXPORT cpBody* cpConstraintGetBodyB(const cpConstraint *constraint);
43
44 /// Get the maximum force that this constraint is allowed to use.
45 CP_EXPORT cpFloat cpConstraintGetMaxForce(const cpConstraint *constraint);
46 /// Set the maximum force that this constraint is allowed to use. (defaults to INFINITY)
47 CP_EXPORT void cpConstraintSetMaxForce(cpConstraint *constraint, cpFloat maxForce);
48
49 /// Get rate at which joint error is corrected.
50 CP_EXPORT cpFloat cpConstraintGetErrorBias(const cpConstraint *constraint);
51 /// Set rate at which joint error is corrected.
52 /// Defaults to pow(1.0 - 0.1, 60.0) meaning that it will
53 /// correct 10% of the error every 1/60th of a second.
54 CP_EXPORT void cpConstraintSetErrorBias(cpConstraint *constraint, cpFloat errorBias);
55
56 /// Get the maximum rate at which joint error is corrected.
57 CP_EXPORT cpFloat cpConstraintGetMaxBias(const cpConstraint *constraint);
58 /// Set the maximum rate at which joint error is corrected. (defaults to INFINITY)
59 CP_EXPORT void cpConstraintSetMaxBias(cpConstraint *constraint, cpFloat maxBias);
60
61 /// Get if the two bodies connected by the constraint are allowed to collide or not.
62 CP_EXPORT cpBool cpConstraintGetCollideBodies(const cpConstraint *constraint);
63 /// Set if the two bodies connected by the constraint are allowed to collide or not. (defaults to cpFalse)
64 CP_EXPORT void cpConstraintSetCollideBodies(cpConstraint *constraint, cpBool collideBodies);
65
66 /// Get the pre-solve function that is called before the solver runs.
67 CP_EXPORT cpConstraintPreSolveFunc cpConstraintGetPreSolveFunc(const cpConstraint *constraint);
68 /// Set the pre-solve function that is called before the solver runs.
69 CP_EXPORT void cpConstraintSetPreSolveFunc(cpConstraint *constraint, cpConstraintPreSolveFunc preSolveFunc);
70
71 /// Get the post-solve function that is called before the solver runs.
72 CP_EXPORT cpConstraintPostSolveFunc cpConstraintGetPostSolveFunc(const cpConstraint *constraint);
73 /// Set the post-solve function that is called before the solver runs.
74 CP_EXPORT void cpConstraintSetPostSolveFunc(cpConstraint *constraint, cpConstraintPostSolveFunc postSolveFunc);
75
76 /// Get the user definable data pointer for this constraint
77 CP_EXPORT cpDataPointer cpConstraintGetUserData(const cpConstraint *constraint);
78 /// Set the user definable data pointer for this constraint
79 CP_EXPORT void cpConstraintSetUserData(cpConstraint *constraint, cpDataPointer userData);
80
81 /// Get the last impulse applied by this constraint.
82 CP_EXPORT cpFloat cpConstraintGetImpulse(cpConstraint *constraint);
83
84 #include "cpPinJoint.h"
85 #include "cpSlideJoint.h"
86 #include "cpPivotJoint.h"
87 #include "cpGrooveJoint.h"
88 #include "cpDampedSpring.h"
89 #include "cpDampedRotarySpring.h"
90 #include "cpRotaryLimitJoint.h"
91 #include "cpRatchetJoint.h"
92 #include "cpGearJoint.h"
93 #include "cpSimpleMotor.h"
94
95 ///@}