chipmunk 5.3.4.0 → 5.3.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/README +36 -13
  2. data/Rakefile +23 -9
  3. data/ext/chipmunk/extconf.rb +55 -12
  4. data/ext/chipmunk/rb_chipmunk.c +92 -98
  5. data/ext/chipmunk/rb_chipmunk.h +44 -34
  6. data/ext/chipmunk/rb_cpArbiter.c +135 -98
  7. data/ext/chipmunk/rb_cpBB.c +84 -101
  8. data/ext/chipmunk/rb_cpBody.c +221 -243
  9. data/ext/chipmunk/rb_cpConstraint.c +173 -185
  10. data/ext/chipmunk/rb_cpShape.c +353 -240
  11. data/ext/chipmunk/rb_cpSpace.c +376 -408
  12. data/ext/chipmunk/rb_cpVect.c +135 -173
  13. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk.h +163 -0
  14. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_ffi.h +59 -0
  15. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_private.h +49 -0
  16. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_types.h +151 -0
  17. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_unsafe.h +54 -0
  18. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpConstraint.h +105 -0
  19. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpDampedRotarySpring.h +46 -0
  20. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpDampedSpring.h +53 -0
  21. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpGearJoint.h +41 -0
  22. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpGrooveJoint.h +48 -0
  23. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpPinJoint.h +43 -0
  24. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpPivotJoint.h +42 -0
  25. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpRatchetJoint.h +40 -0
  26. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpRotaryLimitJoint.h +39 -0
  27. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpSimpleMotor.h +37 -0
  28. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpSlideJoint.h +44 -0
  29. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/util.h +134 -0
  30. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpArbiter.h +188 -0
  31. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpArray.h +49 -0
  32. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpBB.h +74 -0
  33. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpBody.h +219 -0
  34. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpCollision.h +28 -0
  35. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpHashSet.h +82 -0
  36. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpPolyShape.h +103 -0
  37. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpShape.h +177 -0
  38. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpSpace.h +206 -0
  39. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpSpaceHash.h +110 -0
  40. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpVect.h +207 -0
  41. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/chipmunk.c +151 -0
  42. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpConstraint.c +54 -0
  43. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpDampedRotarySpring.c +105 -0
  44. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpDampedSpring.c +115 -0
  45. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpGearJoint.c +113 -0
  46. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpGrooveJoint.c +161 -0
  47. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpPinJoint.c +116 -0
  48. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpPivotJoint.c +114 -0
  49. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpRatchetJoint.c +126 -0
  50. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpRotaryLimitJoint.c +120 -0
  51. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpSimpleMotor.c +97 -0
  52. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpSlideJoint.c +129 -0
  53. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpArbiter.c +280 -0
  54. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpArray.c +143 -0
  55. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpBB.c +47 -0
  56. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpBody.c +192 -0
  57. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpCollision.c +411 -0
  58. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpHashSet.c +253 -0
  59. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpPolyShape.c +240 -0
  60. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpShape.c +405 -0
  61. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpace.c +499 -0
  62. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceComponent.c +279 -0
  63. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceHash.c +534 -0
  64. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceQuery.c +246 -0
  65. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceStep.c +398 -0
  66. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpVect.c +71 -0
  67. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/prime.h +68 -0
  68. data/lib/chipmunk.rb +19 -8
  69. metadata +85 -38
@@ -0,0 +1,105 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ // TODO: Comment me!
23
+
24
+ extern cpFloat cp_constraint_bias_coef;
25
+
26
+ struct cpConstraintClass;
27
+ struct cpConstraint;
28
+
29
+ typedef void (*cpConstraintPreStepFunction)(struct cpConstraint *constraint, cpFloat dt, cpFloat dt_inv);
30
+ typedef void (*cpConstraintApplyImpulseFunction)(struct cpConstraint *constraint);
31
+ typedef cpFloat (*cpConstraintGetImpulseFunction)(struct cpConstraint *constraint);
32
+
33
+ typedef struct cpConstraintClass {
34
+ cpConstraintPreStepFunction preStep;
35
+ cpConstraintApplyImpulseFunction applyImpulse;
36
+ cpConstraintGetImpulseFunction getImpulse;
37
+ } cpConstraintClass;
38
+
39
+
40
+
41
+ typedef struct cpConstraint {
42
+ CP_PRIVATE(const cpConstraintClass *klass);
43
+
44
+ cpBody *a, *b;
45
+ cpFloat maxForce;
46
+ cpFloat biasCoef;
47
+ cpFloat maxBias;
48
+
49
+ cpDataPointer data;
50
+ } cpConstraint;
51
+
52
+ #ifdef CP_USE_DEPRECATED_API_4
53
+ typedef cpConstraint cpJoint;
54
+ #endif
55
+
56
+ void cpConstraintDestroy(cpConstraint *constraint);
57
+ void cpConstraintFree(cpConstraint *constraint);
58
+
59
+ static inline void
60
+ cpConstraintActivateBodies(cpConstraint *constraint)
61
+ {
62
+ cpBody *a = constraint->a; if(a) cpBodyActivate(a);
63
+ cpBody *b = constraint->b; if(b) cpBodyActivate(b);
64
+ }
65
+
66
+ static inline cpFloat
67
+ cpConstraintGetImpulse(cpConstraint *constraint)
68
+ {
69
+ return constraint->CP_PRIVATE(klass)->getImpulse(constraint);
70
+ }
71
+
72
+ #define cpConstraintCheckCast(constraint, struct) \
73
+ cpAssert(constraint->CP_PRIVATE(klass) == struct##GetClass(), "Constraint is not a "#struct);
74
+
75
+
76
+ #define CP_DefineConstraintGetter(struct, type, member, name) \
77
+ static inline type \
78
+ struct##Get##name(const cpConstraint *constraint){ \
79
+ cpConstraintCheckCast(constraint, struct); \
80
+ return ((struct *)constraint)->member; \
81
+ } \
82
+
83
+ #define CP_DefineConstraintSetter(struct, type, member, name) \
84
+ static inline void \
85
+ struct##Set##name(cpConstraint *constraint, type value){ \
86
+ cpConstraintCheckCast(constraint, struct); \
87
+ cpConstraintActivateBodies(constraint); \
88
+ ((struct *)constraint)->member = value; \
89
+ } \
90
+
91
+ #define CP_DefineConstraintProperty(struct, type, member, name) \
92
+ CP_DefineConstraintGetter(struct, type, member, name) \
93
+ CP_DefineConstraintSetter(struct, type, member, name)
94
+
95
+ // Built in Joint types
96
+ #include "cpPinJoint.h"
97
+ #include "cpSlideJoint.h"
98
+ #include "cpPivotJoint.h"
99
+ #include "cpGrooveJoint.h"
100
+ #include "cpDampedSpring.h"
101
+ #include "cpDampedRotarySpring.h"
102
+ #include "cpRotaryLimitJoint.h"
103
+ #include "cpRatchetJoint.h"
104
+ #include "cpGearJoint.h"
105
+ #include "cpSimpleMotor.h"
@@ -0,0 +1,46 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ typedef cpFloat (*cpDampedRotarySpringTorqueFunc)(struct cpConstraint *spring, cpFloat relativeAngle);
23
+
24
+ const cpConstraintClass *cpDampedRotarySpringGetClass();
25
+
26
+ typedef struct cpDampedRotarySpring {
27
+ cpConstraint constraint;
28
+ cpFloat restAngle;
29
+ cpFloat stiffness;
30
+ cpFloat damping;
31
+ cpDampedRotarySpringTorqueFunc springTorqueFunc;
32
+
33
+ cpFloat target_wrn;
34
+ cpFloat w_coef;
35
+
36
+ cpFloat iSum;
37
+ } cpDampedRotarySpring;
38
+
39
+ cpDampedRotarySpring *cpDampedRotarySpringAlloc(void);
40
+ cpDampedRotarySpring *cpDampedRotarySpringInit(cpDampedRotarySpring *joint, cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping);
41
+ cpConstraint *cpDampedRotarySpringNew(cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping);
42
+
43
+ CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, restAngle, RestAngle);
44
+ CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, stiffness, Stiffness);
45
+ CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, damping, Damping);
46
+ CP_DefineConstraintProperty(cpDampedRotarySpring, cpDampedRotarySpringTorqueFunc, springTorqueFunc, SpringTorqueFunc);
@@ -0,0 +1,53 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ struct cpDampedSpring;
23
+
24
+ typedef cpFloat (*cpDampedSpringForceFunc)(struct cpConstraint *spring, cpFloat dist);
25
+
26
+ const cpConstraintClass *cpDampedSpringGetClass();
27
+
28
+ typedef struct cpDampedSpring {
29
+ cpConstraint constraint;
30
+ cpVect anchr1, anchr2;
31
+ cpFloat restLength;
32
+ cpFloat stiffness;
33
+ cpFloat damping;
34
+ cpDampedSpringForceFunc springForceFunc;
35
+
36
+ cpFloat target_vrn;
37
+ cpFloat v_coef;
38
+
39
+ cpVect r1, r2;
40
+ cpFloat nMass;
41
+ cpVect n;
42
+ } cpDampedSpring;
43
+
44
+ cpDampedSpring *cpDampedSpringAlloc(void);
45
+ cpDampedSpring *cpDampedSpringInit(cpDampedSpring *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
46
+ cpConstraint *cpDampedSpringNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
47
+
48
+ CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr1, Anchr1);
49
+ CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr2, Anchr2);
50
+ CP_DefineConstraintProperty(cpDampedSpring, cpFloat, restLength, RestLength);
51
+ CP_DefineConstraintProperty(cpDampedSpring, cpFloat, stiffness, Stiffness);
52
+ CP_DefineConstraintProperty(cpDampedSpring, cpFloat, damping, Damping);
53
+ CP_DefineConstraintProperty(cpDampedSpring, cpDampedSpringForceFunc, springForceFunc, SpringForceFunc);
@@ -0,0 +1,41 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ const cpConstraintClass *cpGearJointGetClass();
23
+
24
+ typedef struct cpGearJoint {
25
+ cpConstraint constraint;
26
+ cpFloat phase, ratio;
27
+ cpFloat ratio_inv;
28
+
29
+ cpFloat iSum;
30
+
31
+ cpFloat bias;
32
+ cpFloat jAcc, jMax;
33
+ } cpGearJoint;
34
+
35
+ cpGearJoint *cpGearJointAlloc(void);
36
+ cpGearJoint *cpGearJointInit(cpGearJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio);
37
+ cpConstraint *cpGearJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio);
38
+
39
+ CP_DefineConstraintProperty(cpGearJoint, cpFloat, phase, Phase);
40
+ CP_DefineConstraintGetter(cpGearJoint, cpFloat, ratio, Ratio);
41
+ void cpGearJointSetRatio(cpConstraint *constraint, cpFloat value);
@@ -0,0 +1,48 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ const cpConstraintClass *cpGrooveJointGetClass();
23
+
24
+ typedef struct cpGrooveJoint {
25
+ cpConstraint constraint;
26
+ cpVect grv_n, grv_a, grv_b;
27
+ cpVect anchr2;
28
+
29
+ cpVect grv_tn;
30
+ cpFloat clamp;
31
+ cpVect r1, r2;
32
+ cpVect k1, k2;
33
+
34
+ cpVect jAcc;
35
+ cpFloat jMaxLen;
36
+ cpVect bias;
37
+ } cpGrooveJoint;
38
+
39
+ cpGrooveJoint *cpGrooveJointAlloc(void);
40
+ cpGrooveJoint *cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
41
+ cpConstraint *cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
42
+
43
+
44
+ CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_a, GrooveA);
45
+ void cpGrooveJointSetGrooveA(cpConstraint *constraint, cpVect value);
46
+ CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_b, GrooveB);
47
+ void cpGrooveJointSetGrooveB(cpConstraint *constraint, cpVect value);
48
+ CP_DefineConstraintProperty(cpGrooveJoint, cpVect, anchr2, Anchr2);
@@ -0,0 +1,43 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ const cpConstraintClass *cpPinJointGetClass();
23
+
24
+ typedef struct cpPinJoint {
25
+ cpConstraint constraint;
26
+ cpVect anchr1, anchr2;
27
+ cpFloat dist;
28
+
29
+ cpVect r1, r2;
30
+ cpVect n;
31
+ cpFloat nMass;
32
+
33
+ cpFloat jnAcc, jnMax;
34
+ cpFloat bias;
35
+ } cpPinJoint;
36
+
37
+ cpPinJoint *cpPinJointAlloc(void);
38
+ cpPinJoint *cpPinJointInit(cpPinJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
39
+ cpConstraint *cpPinJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
40
+
41
+ CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr1, Anchr1);
42
+ CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr2, Anchr2);
43
+ CP_DefineConstraintProperty(cpPinJoint, cpFloat, dist, Dist);
@@ -0,0 +1,42 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ const cpConstraintClass *cpPivotJointGetClass();
23
+
24
+ typedef struct cpPivotJoint {
25
+ cpConstraint constraint;
26
+ cpVect anchr1, anchr2;
27
+
28
+ cpVect r1, r2;
29
+ cpVect k1, k2;
30
+
31
+ cpVect jAcc;
32
+ cpFloat jMaxLen;
33
+ cpVect bias;
34
+ } cpPivotJoint;
35
+
36
+ cpPivotJoint *cpPivotJointAlloc(void);
37
+ cpPivotJoint *cpPivotJointInit(cpPivotJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
38
+ cpConstraint *cpPivotJointNew(cpBody *a, cpBody *b, cpVect pivot);
39
+ cpConstraint *cpPivotJointNew2(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
40
+
41
+ CP_DefineConstraintProperty(cpPivotJoint, cpVect, anchr1, Anchr1);
42
+ CP_DefineConstraintProperty(cpPivotJoint, cpVect, anchr2, Anchr2);
@@ -0,0 +1,40 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ const cpConstraintClass *cpRatchetJointGetClass();
23
+
24
+ typedef struct cpRatchetJoint {
25
+ cpConstraint constraint;
26
+ cpFloat angle, phase, ratchet;
27
+
28
+ cpFloat iSum;
29
+
30
+ cpFloat bias;
31
+ cpFloat jAcc, jMax;
32
+ } cpRatchetJoint;
33
+
34
+ cpRatchetJoint *cpRatchetJointAlloc(void);
35
+ cpRatchetJoint *cpRatchetJointInit(cpRatchetJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet);
36
+ cpConstraint *cpRatchetJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet);
37
+
38
+ CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, angle, Angle);
39
+ CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, phase, Phase);
40
+ CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, ratchet, Ratchet);
@@ -0,0 +1,39 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
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
+ const cpConstraintClass *cpRotaryLimitJointGetClass();
23
+
24
+ typedef struct cpRotaryLimitJoint {
25
+ cpConstraint constraint;
26
+ cpFloat min, max;
27
+
28
+ cpFloat iSum;
29
+
30
+ cpFloat bias;
31
+ cpFloat jAcc, jMax;
32
+ } cpRotaryLimitJoint;
33
+
34
+ cpRotaryLimitJoint *cpRotaryLimitJointAlloc(void);
35
+ cpRotaryLimitJoint *cpRotaryLimitJointInit(cpRotaryLimitJoint *joint, cpBody *a, cpBody *b, cpFloat min, cpFloat max);
36
+ cpConstraint *cpRotaryLimitJointNew(cpBody *a, cpBody *b, cpFloat min, cpFloat max);
37
+
38
+ CP_DefineConstraintProperty(cpRotaryLimitJoint, cpFloat, min, Min);
39
+ CP_DefineConstraintProperty(cpRotaryLimitJoint, cpFloat, max, Max);