chipmunk 5.3.4.0-x86-mingw32 → 5.3.4.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/README +33 -13
  2. data/Rakefile +20 -7
  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 +219 -241
  9. data/ext/chipmunk/rb_cpConstraint.c +173 -185
  10. data/ext/chipmunk/rb_cpShape.c +347 -251
  11. data/ext/chipmunk/rb_cpSpace.c +376 -408
  12. data/ext/chipmunk/rb_cpVect.c +132 -170
  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/1.9/chipmunk.so +0 -0
  69. data/lib/chipmunk.rb +19 -8
  70. metadata +84 -42
  71. data/lib/1.8/chipmunk.so +0 -0
@@ -1,15 +1,15 @@
1
1
  /* Copyright (c) 2007 Scott Lembcke
2
- *
2
+ *
3
3
  * Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  * of this software and associated documentation files (the "Software"), to deal
5
5
  * in the Software without restriction, including without limitation the rights
6
6
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
7
  * copies of the Software, and to permit persons to whom the Software is
8
8
  * furnished to do so, subject to the following conditions:
9
- *
9
+ *
10
10
  * The above copyright notice and this permission notice shall be included in
11
11
  * all copies or substantial portions of the Software.
12
- *
12
+ *
13
13
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
15
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -27,137 +27,121 @@
27
27
 
28
28
  VALUE c_cpBB;
29
29
 
30
- static VALUE BBNEW(cpBB bb) {
30
+ static VALUE
31
+ BBNEW(cpBB bb) {
31
32
  cpBB *ptr = malloc(sizeof(cpBB));
32
33
  *ptr = bb;
33
- return Data_Wrap_Struct(c_cpBB, NULL, free, ptr);
34
+ return Data_Wrap_Struct(c_cpBB, NULL, free, ptr);
34
35
  }
35
36
 
36
37
  static VALUE
37
- rb_cpBBAlloc(VALUE klass)
38
- {
39
- cpBB *bb = malloc(sizeof(cpBB));
40
- return Data_Wrap_Struct(klass, NULL, free, bb);
38
+ rb_cpBBAlloc(VALUE klass) {
39
+ cpBB *bb = calloc(sizeof(cpBB), 1);
40
+ return Data_Wrap_Struct(klass, NULL, free, bb);
41
41
  }
42
42
 
43
43
  static VALUE
44
- rb_cpBBInitialize(VALUE self, VALUE l, VALUE b, VALUE r, VALUE t)
45
- {
46
- cpBB *bb = BBGET(self);
47
- bb->l = NUM2DBL(l);
48
- bb->b = NUM2DBL(b);
49
- bb->r = NUM2DBL(r);
50
- bb->t = NUM2DBL(t);
51
-
52
- return self;
44
+ rb_cpBBInitialize(VALUE self, VALUE l, VALUE b, VALUE r, VALUE t) {
45
+ cpBB *bb = BBGET(self);
46
+ bb->l = NUM2DBL(l);
47
+ bb->b = NUM2DBL(b);
48
+ bb->r = NUM2DBL(r);
49
+ bb->t = NUM2DBL(t);
50
+
51
+ return self;
53
52
  }
54
53
 
55
54
  static VALUE
56
- rb_cpBBintersects(VALUE self, VALUE other)
57
- {
58
- int value = cpBBintersects(*BBGET(self), *BBGET(other));
59
- return value ? Qtrue : Qfalse;
55
+ rb_cpBBintersects(VALUE self, VALUE other) {
56
+ int value = cpBBintersects(*BBGET(self), *BBGET(other));
57
+ return value ? Qtrue : Qfalse;
60
58
  }
61
59
 
62
60
  static VALUE
63
- rb_cpBBcontainsBB(VALUE self, VALUE other)
64
- {
61
+ rb_cpBBcontainsBB(VALUE self, VALUE other) {
65
62
  int value = cpBBcontainsBB(*BBGET(self), *BBGET(other));
66
63
  return value ? Qtrue : Qfalse;
67
64
  }
68
65
 
69
66
  static VALUE
70
- rb_cpBBcontainsVect(VALUE self, VALUE other)
71
- {
67
+ rb_cpBBcontainsVect(VALUE self, VALUE other) {
72
68
  int value = cpBBcontainsVect(*BBGET(self), *VGET(other));
73
69
  return value ? Qtrue : Qfalse;
74
70
  }
75
71
 
76
72
  static VALUE
77
- rb_cpBBcontains(VALUE self, VALUE other)
78
- {
79
- if (rb_class_of(other) == c_cpBB) {
73
+ rb_cpBBcontains(VALUE self, VALUE other) {
74
+ if (rb_class_of(other) == c_cpBB) {
80
75
  return rb_cpBBcontainsBB(self, other);
81
76
  } else if (rb_class_of(other) == c_cpVect) {
82
77
  return rb_cpBBcontainsVect(self, other);
83
- }
78
+ }
84
79
  rb_raise(rb_eArgError, "contains works only with a BB or A Vect2 argument");
85
80
  return Qnil;
86
81
  }
87
82
 
88
83
  static VALUE
89
- rb_cpBBClampVect(VALUE self, VALUE v)
90
- {
91
- return VNEW(cpBBClampVect(*BBGET(self), *VGET(v)));
84
+ rb_cpBBClampVect(VALUE self, VALUE v) {
85
+ return VNEW(cpBBClampVect(*BBGET(self), *VGET(v)));
92
86
  }
93
87
 
94
88
  static VALUE
95
- rb_cpBBWrapVect(VALUE self, VALUE v)
96
- {
97
- return VNEW(cpBBWrapVect(*BBGET(self), *VGET(v)));
89
+ rb_cpBBWrapVect(VALUE self, VALUE v) {
90
+ return VNEW(cpBBWrapVect(*BBGET(self), *VGET(v)));
98
91
  }
99
92
 
100
93
  static VALUE
101
- rb_cpBBGetL(VALUE self)
102
- {
103
- return rb_float_new(BBGET(self)->l);
94
+ rb_cpBBGetL(VALUE self) {
95
+ return rb_float_new(BBGET(self)->l);
104
96
  }
105
97
 
106
98
  static VALUE
107
- rb_cpBBGetB(VALUE self)
108
- {
109
- return rb_float_new(BBGET(self)->b);
99
+ rb_cpBBGetB(VALUE self) {
100
+ return rb_float_new(BBGET(self)->b);
110
101
  }
111
102
 
112
103
  static VALUE
113
- rb_cpBBGetR(VALUE self)
114
- {
115
- return rb_float_new(BBGET(self)->r);
104
+ rb_cpBBGetR(VALUE self) {
105
+ return rb_float_new(BBGET(self)->r);
116
106
  }
117
107
 
118
108
  static VALUE
119
- rb_cpBBGetT(VALUE self)
120
- {
121
- return rb_float_new(BBGET(self)->t);
109
+ rb_cpBBGetT(VALUE self) {
110
+ return rb_float_new(BBGET(self)->t);
122
111
  }
123
112
 
124
113
  static VALUE
125
- rb_cpBBSetL(VALUE self, VALUE val)
126
- {
127
- BBGET(self)->l = NUM2DBL(val);
128
- return val;
114
+ rb_cpBBSetL(VALUE self, VALUE val) {
115
+ BBGET(self)->l = NUM2DBL(val);
116
+ return val;
129
117
  }
130
118
 
131
119
  static VALUE
132
- rb_cpBBSetB(VALUE self, VALUE val)
133
- {
134
- BBGET(self)->b = NUM2DBL(val);
135
- return val;
120
+ rb_cpBBSetB(VALUE self, VALUE val) {
121
+ BBGET(self)->b = NUM2DBL(val);
122
+ return val;
136
123
  }
137
124
 
138
125
  static VALUE
139
- rb_cpBBSetR(VALUE self, VALUE val)
140
- {
141
- BBGET(self)->r = NUM2DBL(val);
142
- return val;
126
+ rb_cpBBSetR(VALUE self, VALUE val) {
127
+ BBGET(self)->r = NUM2DBL(val);
128
+ return val;
143
129
  }
144
130
 
145
131
  static VALUE
146
- rb_cpBBSetT(VALUE self, VALUE val)
147
- {
148
- BBGET(self)->t = NUM2DBL(val);
149
- return val;
132
+ rb_cpBBSetT(VALUE self, VALUE val) {
133
+ BBGET(self)->t = NUM2DBL(val);
134
+ return val;
150
135
  }
151
136
 
152
137
  static VALUE
153
- rb_cpBBToString(VALUE self)
154
- {
155
- char str[256];
156
- cpBB *bb = BBGET(self);
157
-
158
- sprintf(str, "#<CP::BB:(% .3f, % .3f) -> (% .3f, % .3f)>", bb->l, bb->b, bb->r, bb->t);
159
-
160
- return rb_str_new2(str);
138
+ rb_cpBBToString(VALUE self) {
139
+ char str[256];
140
+ cpBB *bb = BBGET(self);
141
+
142
+ sprintf(str, "#<CP::BB:(% .3f, % .3f) -> (% .3f, % .3f)>", bb->l, bb->b, bb->r, bb->t);
143
+
144
+ return rb_str_new2(str);
161
145
  }
162
146
 
163
147
  static VALUE
@@ -172,39 +156,38 @@ rb_cpBBexpand(VALUE self, VALUE other) {
172
156
 
173
157
 
174
158
  void
175
- Init_cpBB(void)
176
- {
177
- c_cpBB = rb_define_class_under(m_Chipmunk, "BB", rb_cObject);
178
- rb_define_alloc_func(c_cpBB, rb_cpBBAlloc);
179
- rb_define_method(c_cpBB, "initialize", rb_cpBBInitialize, 4);
180
-
181
- rb_define_method(c_cpBB, "l", rb_cpBBGetL, 0);
182
- rb_define_method(c_cpBB, "b", rb_cpBBGetB, 0);
183
- rb_define_method(c_cpBB, "r", rb_cpBBGetR, 0);
184
- rb_define_method(c_cpBB, "t", rb_cpBBGetT, 0);
185
-
186
- rb_define_method(c_cpBB, "l=", rb_cpBBSetL, 1);
187
- rb_define_method(c_cpBB, "b=", rb_cpBBSetB, 1);
188
- rb_define_method(c_cpBB, "r=", rb_cpBBSetR, 1);
189
- rb_define_method(c_cpBB, "t=", rb_cpBBSetT, 1);
190
-
191
- rb_define_method(c_cpBB, "intersect?", rb_cpBBintersects, 1);
192
- rb_define_method(c_cpBB, "intersects?", rb_cpBBintersects, 1);
193
- //containsBB
194
- //containsVect
159
+ Init_cpBB(void) {
160
+ c_cpBB = rb_define_class_under(m_Chipmunk, "BB", rb_cObject);
161
+ rb_define_alloc_func(c_cpBB, rb_cpBBAlloc);
162
+ rb_define_method(c_cpBB, "initialize", rb_cpBBInitialize, 4);
163
+
164
+ rb_define_method(c_cpBB, "l", rb_cpBBGetL, 0);
165
+ rb_define_method(c_cpBB, "b", rb_cpBBGetB, 0);
166
+ rb_define_method(c_cpBB, "r", rb_cpBBGetR, 0);
167
+ rb_define_method(c_cpBB, "t", rb_cpBBGetT, 0);
168
+
169
+ rb_define_method(c_cpBB, "l=", rb_cpBBSetL, 1);
170
+ rb_define_method(c_cpBB, "b=", rb_cpBBSetB, 1);
171
+ rb_define_method(c_cpBB, "r=", rb_cpBBSetR, 1);
172
+ rb_define_method(c_cpBB, "t=", rb_cpBBSetT, 1);
173
+
174
+ rb_define_method(c_cpBB, "intersect?", rb_cpBBintersects, 1);
175
+ rb_define_method(c_cpBB, "intersects?", rb_cpBBintersects, 1);
176
+ //containsBB
177
+ //containsVect
195
178
  rb_define_method(c_cpBB, "contains?", rb_cpBBcontains, 1);
196
179
  rb_define_method(c_cpBB, "contain?", rb_cpBBcontains, 1);
197
-
180
+
198
181
  rb_define_method(c_cpBB, "contains_bb?", rb_cpBBcontainsBB, 1);
199
182
  rb_define_method(c_cpBB, "contain_bb?", rb_cpBBcontainsBB, 1);
200
183
  rb_define_method(c_cpBB, "contains_vect?", rb_cpBBcontainsVect, 1);
201
184
  rb_define_method(c_cpBB, "contain_vect?", rb_cpBBcontainsVect, 1);
202
-
203
- rb_define_method(c_cpBB, "clamp_vect", rb_cpBBClampVect, 1);
204
- rb_define_method(c_cpBB, "wrap_vect" , rb_cpBBWrapVect, 1);
205
- rb_define_method(c_cpBB, "merge" , rb_cpBBmerge, 1);
206
- rb_define_method(c_cpBB, "expand" , rb_cpBBexpand, 1);
207
-
208
-
209
- rb_define_method(c_cpBB, "to_s", rb_cpBBToString, 0);
185
+
186
+ rb_define_method(c_cpBB, "clamp_vect", rb_cpBBClampVect, 1);
187
+ rb_define_method(c_cpBB, "wrap_vect", rb_cpBBWrapVect, 1);
188
+ rb_define_method(c_cpBB, "merge", rb_cpBBmerge, 1);
189
+ rb_define_method(c_cpBB, "expand", rb_cpBBexpand, 1);
190
+
191
+
192
+ rb_define_method(c_cpBB, "to_s", rb_cpBBToString, 0);
210
193
  }
@@ -1,15 +1,15 @@
1
1
  /* Copyright (c) 2007 Scott Lembcke
2
- *
2
+ *
3
3
  * Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  * of this software and associated documentation files (the "Software"), to deal
5
5
  * in the Software without restriction, including without limitation the rights
6
6
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
7
  * copies of the Software, and to permit persons to whom the Software is
8
8
  * furnished to do so, subject to the following conditions:
9
- *
9
+ *
10
10
  * The above copyright notice and this permission notice shall be included in
11
11
  * all copies or substantial portions of the Software.
12
- *
12
+ *
13
13
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
15
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -18,7 +18,7 @@
18
18
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  * SOFTWARE.
20
20
  */
21
-
21
+
22
22
  #include <stdlib.h>
23
23
  #include "chipmunk.h"
24
24
 
@@ -29,191 +29,164 @@ VALUE c_cpBody;
29
29
  VALUE c_cpStaticBody;
30
30
 
31
31
  static VALUE
32
- rb_cpBodyAlloc(VALUE klass)
33
- {
34
- cpBody *body = cpBodyNew(1.0f, 1.0f);
35
- return Data_Wrap_Struct(klass, NULL, cpBodyFree, body);
32
+ rb_cpBodyAlloc(VALUE klass) {
33
+ cpBody *body = cpBodyNew(1.0f, 1.0f);
34
+ return Data_Wrap_Struct(klass, NULL, cpBodyFree, body);
36
35
  }
37
36
 
38
37
  static VALUE
39
- rb_cpBodyInitialize(VALUE self, VALUE m, VALUE i)
40
- {
41
- cpBody *body = BODY(self);
42
- cpBodyInit(body, NUM2DBL(m), NUM2DBL(i));
43
- body->data = (void *)self;
44
- return self;
38
+ rb_cpBodyInitialize(VALUE self, VALUE m, VALUE i) {
39
+ cpBody *body = BODY(self);
40
+ cpBodyInit(body, NUM2DBL(m), NUM2DBL(i));
41
+ body->data = (void *)self;
42
+ return self;
45
43
  }
46
44
 
47
45
  static VALUE
48
- rb_cpBodyAllocStatic(VALUE klass)
49
- {
46
+ rb_cpBodyAllocStatic(VALUE klass) {
50
47
  cpBody *body = cpBodyNewStatic();
51
48
  return Data_Wrap_Struct(c_cpStaticBody, NULL, cpBodyFree, body);
52
49
  }
53
50
 
54
51
  static VALUE
55
- rb_cpBodyInitializeStatic(VALUE self)
56
- {
52
+ rb_cpBodyInitializeStatic(VALUE self) {
57
53
  cpBody *body = STATICBODY(self);
58
54
  cpBodyInitStatic(body);
59
- body->data = (void *)self;
55
+ body->data = (void *)self;
60
56
  return self;
61
57
  }
62
58
 
63
- static VALUE
59
+ static VALUE
64
60
  rb_cpStaticBodyNew(VALUE klass) {
65
61
  return rb_cpBodyInitializeStatic(rb_cpBodyAllocStatic(klass));
66
62
  }
67
63
 
68
64
 
69
65
  static VALUE
70
- rb_cpBodyGetMass(VALUE self)
71
- {
72
- return rb_float_new(BODY(self)->m);
66
+ rb_cpBodyGetMass(VALUE self) {
67
+ return rb_float_new(BODY(self)->m);
73
68
  }
74
69
 
75
70
  static VALUE
76
- rb_cpBodyGetMassInv(VALUE self)
77
- {
71
+ rb_cpBodyGetMassInv(VALUE self) {
78
72
  return rb_float_new(BODY(self)->m_inv);
79
73
  }
80
74
 
81
75
  static VALUE
82
- rb_cpBodyGetMoment(VALUE self)
83
- {
84
- return rb_float_new(BODY(self)->i);
76
+ rb_cpBodyGetMoment(VALUE self) {
77
+ return rb_float_new(BODY(self)->i);
85
78
  }
86
79
 
87
80
 
88
81
  static VALUE
89
- rb_cpBodyGetMomentInv(VALUE self)
90
- {
82
+ rb_cpBodyGetMomentInv(VALUE self) {
91
83
  return rb_float_new(BODY(self)->i_inv);
92
84
  }
93
85
 
94
86
  static VALUE
95
- rb_cpBodyGetPos(VALUE self)
96
- {
97
- return VWRAP(self, &BODY(self)->p);
87
+ rb_cpBodyGetPos(VALUE self) {
88
+ return VWRAP(self, &BODY(self)->p);
98
89
  }
99
90
 
100
91
  static VALUE
101
- rb_cpBodyGetVel(VALUE self)
102
- {
103
- return VWRAP(self, &BODY(self)->v);
92
+ rb_cpBodyGetVel(VALUE self) {
93
+ return VWRAP(self, &BODY(self)->v);
104
94
  }
105
95
 
106
96
  static VALUE
107
- rb_cpBodyGetForce(VALUE self)
108
- {
109
- return VWRAP(self, &BODY(self)->f);
97
+ rb_cpBodyGetForce(VALUE self) {
98
+ return VWRAP(self, &BODY(self)->f);
110
99
  }
111
100
 
112
101
  static VALUE
113
- rb_cpBodyGetAngle(VALUE self)
114
- {
115
- return rb_float_new(BODY(self)->a);
102
+ rb_cpBodyGetAngle(VALUE self) {
103
+ return rb_float_new(BODY(self)->a);
116
104
  }
117
105
 
118
106
  static VALUE
119
- rb_cpBodyGetAVel(VALUE self)
120
- {
121
- return rb_float_new(BODY(self)->w);
107
+ rb_cpBodyGetAVel(VALUE self) {
108
+ return rb_float_new(BODY(self)->w);
122
109
  }
123
110
 
124
111
  static VALUE
125
- rb_cpBodyGetTorque(VALUE self)
126
- {
127
- return rb_float_new(BODY(self)->t);
112
+ rb_cpBodyGetTorque(VALUE self) {
113
+ return rb_float_new(BODY(self)->t);
128
114
  }
129
115
 
130
116
  static VALUE
131
- rb_cpBodyGetVLimit(VALUE self)
132
- {
117
+ rb_cpBodyGetVLimit(VALUE self) {
133
118
  return rb_float_new(BODY(self)->v_limit);
134
119
  }
135
120
 
136
121
  static VALUE
137
- rb_cpBodyGetWLimit(VALUE self)
138
- {
122
+ rb_cpBodyGetWLimit(VALUE self) {
139
123
  return rb_float_new(BODY(self)->w_limit);
140
124
  }
141
125
 
142
126
 
143
127
  static VALUE
144
- rb_cpBodyGetRot(VALUE self)
145
- {
146
- return VWRAP(self, &BODY(self)->rot);
128
+ rb_cpBodyGetRot(VALUE self) {
129
+ return VWRAP(self, &BODY(self)->rot);
147
130
  }
148
131
 
149
132
 
150
133
  static VALUE
151
- rb_cpBodySetMass(VALUE self, VALUE val)
152
- {
153
- cpBodySetMass(BODY(self), NUM2DBL(val));
154
- return val;
134
+ rb_cpBodySetMass(VALUE self, VALUE val) {
135
+ cpBodySetMass(BODY(self), NUM2DBL(val));
136
+ return val;
155
137
  }
156
138
 
157
139
  static VALUE
158
- rb_cpBodySetMoment(VALUE self, VALUE val)
159
- {
160
- cpBodySetMoment(BODY(self), NUM2DBL(val));
161
- return val;
140
+ rb_cpBodySetMoment(VALUE self, VALUE val) {
141
+ cpBodySetMoment(BODY(self), NUM2DBL(val));
142
+ return val;
162
143
  }
163
144
 
164
145
  static VALUE
165
- rb_cpBodySetPos(VALUE self, VALUE val)
166
- {
167
- BODY(self)->p = *VGET(val);
168
- return val;
146
+ rb_cpBodySetPos(VALUE self, VALUE val) {
147
+ BODY(self)->p = *VGET(val);
148
+ return val;
169
149
  }
170
150
 
171
151
  static VALUE
172
- rb_cpBodySetVel(VALUE self, VALUE val)
173
- {
174
- BODY(self)->v = *VGET(val);
175
- return val;
152
+ rb_cpBodySetVel(VALUE self, VALUE val) {
153
+ BODY(self)->v = *VGET(val);
154
+ return val;
176
155
  }
177
156
 
178
157
  static VALUE
179
- rb_cpBodySetForce(VALUE self, VALUE val)
180
- {
181
- BODY(self)->f = *VGET(val);
182
- return val;
158
+ rb_cpBodySetForce(VALUE self, VALUE val) {
159
+ BODY(self)->f = *VGET(val);
160
+ return val;
183
161
  }
184
162
 
185
163
  static VALUE
186
- rb_cpBodySetAngle(VALUE self, VALUE val)
187
- {
188
- cpBodySetAngle(BODY(self), NUM2DBL(val));
189
- return val;
164
+ rb_cpBodySetAngle(VALUE self, VALUE val) {
165
+ cpBodySetAngle(BODY(self), NUM2DBL(val));
166
+ return val;
190
167
  }
191
168
 
192
169
  static VALUE
193
- rb_cpBodySetAVel(VALUE self, VALUE val)
194
- {
195
- BODY(self)->w = NUM2DBL(val);
196
- return val;
170
+ rb_cpBodySetAVel(VALUE self, VALUE val) {
171
+ BODY(self)->w = NUM2DBL(val);
172
+ return val;
197
173
  }
198
174
 
199
175
  static VALUE
200
- rb_cpBodySetTorque(VALUE self, VALUE val)
201
- {
202
- BODY(self)->t = NUM2DBL(val);
203
- return val;
176
+ rb_cpBodySetTorque(VALUE self, VALUE val) {
177
+ BODY(self)->t = NUM2DBL(val);
178
+ return val;
204
179
  }
205
180
 
206
181
 
207
182
  static VALUE
208
- rb_cpBodySetVLimit(VALUE self, VALUE val)
209
- {
183
+ rb_cpBodySetVLimit(VALUE self, VALUE val) {
210
184
  BODY(self)->v_limit = NUM2DBL(val);
211
185
  return val;
212
186
  }
213
187
 
214
188
  static VALUE
215
- rb_cpBodySetWLimit(VALUE self, VALUE val)
216
- {
189
+ rb_cpBodySetWLimit(VALUE self, VALUE val) {
217
190
  BODY(self)->w_limit = NUM2DBL(val);
218
191
  return val;
219
192
  }
@@ -221,107 +194,107 @@ rb_cpBodySetWLimit(VALUE self, VALUE val)
221
194
 
222
195
 
223
196
  static VALUE
224
- rb_cpBodyLocal2World(VALUE self, VALUE v)
225
- {
226
- return VNEW(cpBodyLocal2World(BODY(self), *VGET(v)));
197
+ rb_cpBodyLocal2World(VALUE self, VALUE v) {
198
+ return VNEW(cpBodyLocal2World(BODY(self), *VGET(v)));
227
199
  }
228
200
 
229
201
  static VALUE
230
- rb_cpBodyWorld2Local(VALUE self, VALUE v)
231
- {
232
- return VNEW(cpBodyWorld2Local(BODY(self), *VGET(v)));
202
+ rb_cpBodyWorld2Local(VALUE self, VALUE v) {
203
+ return VNEW(cpBodyWorld2Local(BODY(self), *VGET(v)));
233
204
  }
234
205
 
235
206
  static VALUE
236
- rb_cpBodyResetForces(VALUE self)
237
- {
238
- cpBodyResetForces(BODY(self));
239
- return self;
207
+ rb_cpBodyResetForces(VALUE self) {
208
+ cpBodyResetForces(BODY(self));
209
+ return self;
240
210
  }
241
211
 
242
212
  static VALUE
243
- rb_cpBodyApplyForce(VALUE self, VALUE f, VALUE r)
244
- {
245
- cpBodyApplyForce(BODY(self), *VGET(f), *VGET(r));
246
- return self;
213
+ rb_cpBodyApplyForce(VALUE self, VALUE f, VALUE r) {
214
+ cpBodyApplyForce(BODY(self), *VGET(f), *VGET(r));
215
+ return self;
247
216
  }
248
217
 
249
218
  static VALUE
250
- rb_cpBodyApplyImpulse(VALUE self, VALUE j, VALUE r)
251
- {
252
- cpBodyApplyImpulse(BODY(self), *VGET(j), *VGET(r));
253
- return self;
219
+ rb_cpBodyApplyImpulse(VALUE self, VALUE j, VALUE r) {
220
+ cpBodyApplyImpulse(BODY(self), *VGET(j), *VGET(r));
221
+ return self;
254
222
  }
255
223
 
256
224
  static VALUE
257
- rb_cpBodyUpdateVelocity(VALUE self, VALUE g, VALUE dmp, VALUE dt)
258
- {
259
- cpBodyUpdateVelocity(BODY(self), *VGET(g), NUM2DBL(dmp), NUM2DBL(dt));
260
- return self;
225
+ rb_cpBodyUpdateVelocity(VALUE self, VALUE g, VALUE dmp, VALUE dt) {
226
+ cpBodyUpdateVelocity(BODY(self), *VGET(g), NUM2DBL(dmp), NUM2DBL(dt));
227
+ return self;
261
228
  }
262
229
 
263
230
  static VALUE
264
- rb_cpBodyUpdatePosition(VALUE self, VALUE dt)
265
- {
266
- cpBodyUpdatePosition(BODY(self), NUM2DBL(dt));
267
- return self;
231
+ rb_cpBodyUpdatePosition(VALUE self, VALUE dt) {
232
+ cpBodyUpdatePosition(BODY(self), NUM2DBL(dt));
233
+ return self;
268
234
  }
269
235
 
270
- static VALUE rb_cpBodyActivate(VALUE self) {
236
+ static VALUE
237
+ rb_cpBodyActivate(VALUE self) {
271
238
  cpBodyActivate(BODY(self));
272
239
  return self;
273
240
  }
274
241
 
275
- static cpBody * rb_cpBodySleepValidate(VALUE vbody) {
242
+ static cpBody *
243
+ rb_cpBodySleepValidate(VALUE vbody) {
276
244
  cpBody * body = BODY(vbody);
277
- cpSpace *space = body->space;
245
+ cpSpace *space = body->space;
278
246
  if(!space) {
279
247
  rb_raise(rb_eArgError, "Cannot put a body to sleep that has not been added to a space.");
280
248
  return NULL;
281
249
  }
282
- if (cpBodyIsStatic(body) && cpBodyIsRogue(body)) {
250
+ if (cpBodyIsStatic(body) && cpBodyIsRogue(body)) {
283
251
  rb_raise(rb_eArgError, "Rogue AND static bodies cannot be put to sleep.");
284
252
  return NULL;
285
- }
286
- if(space->locked) {
287
- rb_raise(rb_eArgError, "Bodies can not be put to sleep during a query or a call to Space#add_collision_func. Put these calls into a post-step callback using Space#add_collision_handler.");
288
- return NULL;
289
253
  }
290
- return body;
254
+ if(space->locked) {
255
+ rb_raise(rb_eArgError, "Bodies can not be put to sleep during a query or a call to Space#add_collision_func. Put these calls into a post-step callback using Space#add_collision_handler.");
256
+ return NULL;
257
+ }
258
+ return body;
291
259
  }
292
260
 
293
- static VALUE rb_cpBodySleep(VALUE self) {
261
+ static VALUE
262
+ rb_cpBodySleep(VALUE self) {
294
263
  cpBody * body = rb_cpBodySleepValidate(self);
295
264
  cpBodySleep(body);
296
265
  return self;
297
266
  }
298
267
 
299
- static VALUE rb_cpBodySleepWithGroup(VALUE self, VALUE vgroup) {
268
+ static VALUE
269
+ rb_cpBodySleepWithGroup(VALUE self, VALUE vgroup) {
300
270
  cpBody * group = NIL_P(vgroup) ? NULL : rb_cpBodySleepValidate(vgroup);
301
271
  cpBody * body = rb_cpBodySleepValidate(self);
302
-
303
- if (!cpBodyIsSleeping(group)) {
272
+
273
+ if (!cpBodyIsSleeping(group)) {
304
274
  rb_raise(rb_eArgError, "Cannot use a non-sleeping body as a group identifier.");
305
- }
275
+ }
306
276
  cpBodySleepWithGroup(body, group);
307
277
  return self;
308
278
  }
309
279
 
310
280
 
311
- static VALUE rb_cpBodyIsSleeping(VALUE self) {
281
+ static VALUE
282
+ rb_cpBodyIsSleeping(VALUE self) {
312
283
  return cpBodyIsSleeping(BODY(self)) ? Qtrue : Qfalse;
313
284
  }
314
285
 
315
- static VALUE rb_cpBodyIsStatic(VALUE self) {
286
+ static VALUE
287
+ rb_cpBodyIsStatic(VALUE self) {
316
288
  cpBody * body = BODY(self);
317
- cpBool stat = 0;
289
+ cpBool stat = 0;
318
290
  // cpBodyInitStatic(body);
319
- stat = cpBodyIsStatic(body);
291
+ stat = cpBodyIsStatic(body);
320
292
  return stat ? Qtrue : Qfalse;
321
- //
293
+ //
322
294
  }
323
295
 
324
- static VALUE rb_cpBodyIsRogue(VALUE self) {
296
+ static VALUE
297
+ rb_cpBodyIsRogue(VALUE self) {
325
298
  return cpBodyIsRogue(BODY(self)) ? Qtrue : Qfalse;
326
299
  }
327
300
 
@@ -336,25 +309,24 @@ respondsTo(VALUE obj, ID method) {
336
309
 
337
310
  /*
338
311
 
339
- typedef void (*cpBodyVelocityFunc)(struct cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt);
340
- typedef void (*cpBodyPositionFunc)(struct cpBody *body, cpFloat dt);
341
- */
312
+ typedef void (*cpBodyVelocityFunc)(struct cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt);
313
+ typedef void (*cpBodyPositionFunc)(struct cpBody *body, cpFloat dt);
314
+ */
342
315
 
343
316
  static void
344
317
  bodyVelocityCallback(cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt) {
345
- VALUE vbody = (VALUE)(body->data);
346
- VALUE block = rb_iv_get(vbody, "velocity_func");
347
- VALUE vgravity = VNEW(gravity);
348
- VALUE vdamping = rb_float_new(damping);
349
- VALUE vdt = rb_float_new(dt);
318
+ VALUE vbody = (VALUE)(body->data);
319
+ VALUE block = rb_iv_get(vbody, "velocity_func");
320
+ VALUE vgravity = VNEW(gravity);
321
+ VALUE vdamping = rb_float_new(damping);
322
+ VALUE vdt = rb_float_new(dt);
350
323
  rb_funcall(block, rb_intern("call"), 4, vbody, vgravity, vdamping, vdt);
351
324
  }
352
325
 
353
- static VALUE
354
- rb_cpBodySetVelocityFunc(int argc, VALUE *argv, VALUE self)
355
- {
326
+ static VALUE
327
+ rb_cpBodySetVelocityFunc(int argc, VALUE *argv, VALUE self) {
356
328
  VALUE block;
357
- cpBody * body = BODY(self);
329
+ cpBody * body = BODY(self);
358
330
  rb_scan_args(argc, argv, "&", &block);
359
331
  // Restore defaults if no block
360
332
  if (NIL_P(block)) {
@@ -369,17 +341,16 @@ rb_cpBodySetVelocityFunc(int argc, VALUE *argv, VALUE self)
369
341
 
370
342
  static void
371
343
  bodyPositionCallback(cpBody *body, cpFloat dt) {
372
- VALUE vbody = (VALUE)(body->data);
373
- VALUE block = rb_iv_get(vbody, "position_func");
374
- VALUE vdt = rb_float_new(dt);
344
+ VALUE vbody = (VALUE)(body->data);
345
+ VALUE block = rb_iv_get(vbody, "position_func");
346
+ VALUE vdt = rb_float_new(dt);
375
347
  rb_funcall(block, rb_intern("call"), 2, vbody, vdt);
376
348
  }
377
349
 
378
- static VALUE
379
- rb_cpBodySetPositionFunc(int argc, VALUE *argv, VALUE self)
380
- {
350
+ static VALUE
351
+ rb_cpBodySetPositionFunc(int argc, VALUE *argv, VALUE self) {
381
352
  VALUE block;
382
- cpBody * body = BODY(self);
353
+ cpBody * body = BODY(self);
383
354
  rb_scan_args(argc, argv, "&", &block);
384
355
  // Restore defaults if no block
385
356
  if (NIL_P(block)) {
@@ -410,95 +381,102 @@ rb_cpBodySlew(VALUE self, VALUE pos, VALUE dt) {
410
381
  return self;
411
382
  }
412
383
 
384
+ static VALUE
385
+ rb_cpBodyKineticEnergy(VALUE self) {
386
+ return DBL2NUM(cpBodyKineticEnergy(BODY(self)));
387
+ }
388
+
413
389
 
414
390
  void
415
- Init_cpBody(void)
416
- {
417
- c_cpBody = rb_define_class_under(m_Chipmunk, "Body", rb_cObject);
418
- rb_define_alloc_func(c_cpBody, rb_cpBodyAlloc);
419
- rb_define_method(c_cpBody, "initialize", rb_cpBodyInitialize, 2);
420
-
421
- c_cpStaticBody = rb_define_class_under(m_Chipmunk, "StaticBody", c_cpBody);
391
+ Init_cpBody(void) {
392
+ c_cpBody = rb_define_class_under(m_Chipmunk, "Body", rb_cObject);
393
+ rb_define_alloc_func(c_cpBody, rb_cpBodyAlloc);
394
+ rb_define_method(c_cpBody, "initialize", rb_cpBodyInitialize, 2);
395
+
396
+ c_cpStaticBody = rb_define_class_under(m_Chipmunk, "StaticBody", c_cpBody);
397
+ rb_define_alloc_func(c_cpStaticBody, rb_cpBodyAlloc);
422
398
  // rb_define_alloc_func will not work here, since superclass defines this.
423
399
  // so, we define new here in stead.
424
- rb_define_singleton_method(c_cpStaticBody, "new", rb_cpStaticBodyNew, 0);
425
- rb_define_method(c_cpStaticBody, "initialize", rb_cpBodyInitializeStatic, 0);
400
+ // rb_define_singleton_method(c_cpStaticBody, "new", rb_cpStaticBodyNew, 0);
401
+ rb_define_method(c_cpStaticBody, "initialize", rb_cpBodyInitializeStatic, 0);
426
402
  rb_define_singleton_method(c_cpBody, "new_static", rb_cpStaticBodyNew, 0);
427
403
 
428
- rb_define_method(c_cpBody, "m" , rb_cpBodyGetMass, 0);
429
- rb_define_method(c_cpBody, "i" , rb_cpBodyGetMoment, 0);
430
-
431
- rb_define_method(c_cpBody, "p" , rb_cpBodyGetPos, 0);
432
- rb_define_method(c_cpBody, "v" , rb_cpBodyGetVel, 0);
433
- rb_define_method(c_cpBody, "f" , rb_cpBodyGetForce, 0);
434
- rb_define_method(c_cpBody, "a" , rb_cpBodyGetAngle, 0);
435
- rb_define_method(c_cpBody, "w" , rb_cpBodyGetAVel, 0);
436
- rb_define_method(c_cpBody, "t" , rb_cpBodyGetTorque, 0);
437
- rb_define_method(c_cpBody, "rot" , rb_cpBodyGetRot, 0);
438
-
439
- rb_define_method(c_cpBody, "m=", rb_cpBodySetMass, 1);
440
- rb_define_method(c_cpBody, "i=", rb_cpBodySetMoment, 1);
441
- rb_define_method(c_cpBody, "p=", rb_cpBodySetPos, 1);
442
- rb_define_method(c_cpBody, "v=", rb_cpBodySetVel, 1);
443
- rb_define_method(c_cpBody, "f=", rb_cpBodySetForce, 1);
444
- rb_define_method(c_cpBody, "a=", rb_cpBodySetAngle, 1);
445
- rb_define_method(c_cpBody, "w=", rb_cpBodySetAVel, 1);
446
- rb_define_method(c_cpBody, "t=", rb_cpBodySetTorque, 1);
447
-
448
- rb_define_method(c_cpBody, "mass" , rb_cpBodyGetMass, 0);
449
- rb_define_method(c_cpBody, "moment" , rb_cpBodyGetMoment, 0);
450
- rb_define_method(c_cpBody, "pos" , rb_cpBodyGetPos, 0);
451
- rb_define_method(c_cpBody, "vel" , rb_cpBodyGetVel, 0);
452
- rb_define_method(c_cpBody, "force" , rb_cpBodyGetForce, 0);
453
- rb_define_method(c_cpBody, "angle" , rb_cpBodyGetAngle, 0);
454
- rb_define_method(c_cpBody, "ang_vel" , rb_cpBodyGetAVel, 0);
455
- rb_define_method(c_cpBody, "torque" , rb_cpBodyGetTorque, 0);
456
- rb_define_method(c_cpBody, "rot", rb_cpBodyGetRot, 0);
457
-
458
- rb_define_method(c_cpBody, "m_inv" , rb_cpBodyGetMassInv, 0);
459
- rb_define_method(c_cpBody, "mass_inv" , rb_cpBodyGetMassInv, 0);
460
- rb_define_method(c_cpBody, "moment_inv" , rb_cpBodyGetMomentInv, 0);
461
- rb_define_method(c_cpBody, "v_limit" , rb_cpBodyGetVLimit, 0);
462
- rb_define_method(c_cpBody, "w_limit" , rb_cpBodyGetWLimit, 0);
463
-
464
-
465
- rb_define_method(c_cpBody, "mass=" , rb_cpBodySetMass, 1);
466
- rb_define_method(c_cpBody, "moment=" , rb_cpBodySetMoment, 1);
467
- rb_define_method(c_cpBody, "pos=" , rb_cpBodySetPos, 1);
468
- rb_define_method(c_cpBody, "vel=" , rb_cpBodySetVel, 1);
469
- rb_define_method(c_cpBody, "force=" , rb_cpBodySetForce, 1);
470
- rb_define_method(c_cpBody, "angle=" , rb_cpBodySetAngle, 1);
471
- rb_define_method(c_cpBody, "ang_vel=" , rb_cpBodySetAVel, 1);
472
- rb_define_method(c_cpBody, "torque=" , rb_cpBodySetTorque, 1);
473
- rb_define_method(c_cpBody, "v_limit=" , rb_cpBodySetVLimit, 1);
474
- rb_define_method(c_cpBody, "w_limit=" , rb_cpBodySetWLimit, 1);
475
-
476
-
477
- rb_define_method(c_cpBody, "local2world", rb_cpBodyLocal2World, 1);
478
- rb_define_method(c_cpBody, "world2local", rb_cpBodyWorld2Local, 1);
479
-
480
- rb_define_method(c_cpBody, "reset_forces", rb_cpBodyResetForces, 0);
481
- rb_define_method(c_cpBody, "apply_force", rb_cpBodyApplyForce, 2);
482
- rb_define_method(c_cpBody, "apply_impulse", rb_cpBodyApplyImpulse, 2);
483
-
484
- rb_define_method(c_cpBody, "update_velocity", rb_cpBodyUpdateVelocity, 3);
485
- rb_define_method(c_cpBody, "update_position", rb_cpBodyUpdatePosition, 1);
486
- rb_define_method(c_cpBody, "slew" , rb_cpBodySlew , 2);
487
-
488
- rb_define_method(c_cpBody, "static?", rb_cpBodyIsStatic, 0);
489
- rb_define_method(c_cpBody, "rogue?", rb_cpBodyIsRogue, 0);
490
- rb_define_method(c_cpBody, "sleeping?", rb_cpBodyIsSleeping, 0);
491
- rb_define_method(c_cpBody, "sleep?", rb_cpBodyIsSleeping, 0);
492
- rb_define_method(c_cpBody, "sleep_with_self" , rb_cpBodySleep, 0);
493
- rb_define_method(c_cpBody, "sleep_self" , rb_cpBodySleep, 0);
494
- rb_define_method(c_cpBody, "sleep_alone" , rb_cpBodySleep, 0);
495
- rb_define_method(c_cpBody, "sleep_with_group", rb_cpBodySleepWithGroup, 1);
496
- rb_define_method(c_cpBody, "sleep_group" , rb_cpBodySleepWithGroup, 1);
497
- rb_define_method(c_cpBody, "activate" , rb_cpBodyActivate , 0);
498
- rb_define_method(c_cpBody, "velocity_func" , rb_cpBodySetVelocityFunc, -1);
499
- rb_define_method(c_cpBody, "position_func" , rb_cpBodySetPositionFunc, -1);
500
-
501
- rb_define_method(c_cpBody, "object=" , rb_cpBodySetData, 1);
502
- rb_define_method(c_cpBody, "object" , rb_cpBodyGetData, 0);
503
-
404
+ rb_define_method(c_cpBody, "m", rb_cpBodyGetMass, 0);
405
+ rb_define_method(c_cpBody, "i", rb_cpBodyGetMoment, 0);
406
+
407
+ rb_define_method(c_cpBody, "p", rb_cpBodyGetPos, 0);
408
+ rb_define_method(c_cpBody, "v", rb_cpBodyGetVel, 0);
409
+ rb_define_method(c_cpBody, "f", rb_cpBodyGetForce, 0);
410
+ rb_define_method(c_cpBody, "a", rb_cpBodyGetAngle, 0);
411
+ rb_define_method(c_cpBody, "w", rb_cpBodyGetAVel, 0);
412
+ rb_define_method(c_cpBody, "t", rb_cpBodyGetTorque, 0);
413
+ rb_define_method(c_cpBody, "rot", rb_cpBodyGetRot, 0);
414
+
415
+ rb_define_method(c_cpBody, "m=", rb_cpBodySetMass, 1);
416
+ rb_define_method(c_cpBody, "i=", rb_cpBodySetMoment, 1);
417
+ rb_define_method(c_cpBody, "p=", rb_cpBodySetPos, 1);
418
+ rb_define_method(c_cpBody, "v=", rb_cpBodySetVel, 1);
419
+ rb_define_method(c_cpBody, "f=", rb_cpBodySetForce, 1);
420
+ rb_define_method(c_cpBody, "a=", rb_cpBodySetAngle, 1);
421
+ rb_define_method(c_cpBody, "w=", rb_cpBodySetAVel, 1);
422
+ rb_define_method(c_cpBody, "t=", rb_cpBodySetTorque, 1);
423
+
424
+ rb_define_method(c_cpBody, "mass", rb_cpBodyGetMass, 0);
425
+ rb_define_method(c_cpBody, "moment", rb_cpBodyGetMoment, 0);
426
+ rb_define_method(c_cpBody, "pos", rb_cpBodyGetPos, 0);
427
+ rb_define_method(c_cpBody, "vel", rb_cpBodyGetVel, 0);
428
+ rb_define_method(c_cpBody, "force", rb_cpBodyGetForce, 0);
429
+ rb_define_method(c_cpBody, "angle", rb_cpBodyGetAngle, 0);
430
+ rb_define_method(c_cpBody, "ang_vel", rb_cpBodyGetAVel, 0);
431
+ rb_define_method(c_cpBody, "torque", rb_cpBodyGetTorque, 0);
432
+ rb_define_method(c_cpBody, "rot", rb_cpBodyGetRot, 0);
433
+
434
+ rb_define_method(c_cpBody, "m_inv", rb_cpBodyGetMassInv, 0);
435
+ rb_define_method(c_cpBody, "mass_inv", rb_cpBodyGetMassInv, 0);
436
+ rb_define_method(c_cpBody, "moment_inv", rb_cpBodyGetMomentInv, 0);
437
+ rb_define_method(c_cpBody, "v_limit", rb_cpBodyGetVLimit, 0);
438
+ rb_define_method(c_cpBody, "w_limit", rb_cpBodyGetWLimit, 0);
439
+
440
+
441
+ rb_define_method(c_cpBody, "mass=", rb_cpBodySetMass, 1);
442
+ rb_define_method(c_cpBody, "moment=", rb_cpBodySetMoment, 1);
443
+ rb_define_method(c_cpBody, "pos=", rb_cpBodySetPos, 1);
444
+ rb_define_method(c_cpBody, "vel=", rb_cpBodySetVel, 1);
445
+ rb_define_method(c_cpBody, "force=", rb_cpBodySetForce, 1);
446
+ rb_define_method(c_cpBody, "angle=", rb_cpBodySetAngle, 1);
447
+ rb_define_method(c_cpBody, "ang_vel=", rb_cpBodySetAVel, 1);
448
+ rb_define_method(c_cpBody, "torque=", rb_cpBodySetTorque, 1);
449
+ rb_define_method(c_cpBody, "v_limit=", rb_cpBodySetVLimit, 1);
450
+ rb_define_method(c_cpBody, "w_limit=", rb_cpBodySetWLimit, 1);
451
+
452
+
453
+ rb_define_method(c_cpBody, "local2world", rb_cpBodyLocal2World, 1);
454
+ rb_define_method(c_cpBody, "world2local", rb_cpBodyWorld2Local, 1);
455
+
456
+ rb_define_method(c_cpBody, "reset_forces", rb_cpBodyResetForces, 0);
457
+ rb_define_method(c_cpBody, "apply_force", rb_cpBodyApplyForce, 2);
458
+ rb_define_method(c_cpBody, "apply_impulse", rb_cpBodyApplyImpulse, 2);
459
+
460
+ rb_define_method(c_cpBody, "update_velocity", rb_cpBodyUpdateVelocity, 3);
461
+ rb_define_method(c_cpBody, "update_position", rb_cpBodyUpdatePosition, 1);
462
+ rb_define_method(c_cpBody, "slew", rb_cpBodySlew, 2);
463
+
464
+ rb_define_method(c_cpBody, "static?", rb_cpBodyIsStatic, 0);
465
+ rb_define_method(c_cpBody, "rogue?", rb_cpBodyIsRogue, 0);
466
+ rb_define_method(c_cpBody, "sleeping?", rb_cpBodyIsSleeping, 0);
467
+ rb_define_method(c_cpBody, "sleep?", rb_cpBodyIsSleeping, 0);
468
+ rb_define_method(c_cpBody, "sleep_with_self", rb_cpBodySleep, 0);
469
+ rb_define_method(c_cpBody, "sleep_self", rb_cpBodySleep, 0);
470
+ rb_define_method(c_cpBody, "sleep_alone", rb_cpBodySleep, 0);
471
+ rb_define_method(c_cpBody, "sleep_with_group", rb_cpBodySleepWithGroup, 1);
472
+ rb_define_method(c_cpBody, "sleep_group", rb_cpBodySleepWithGroup, 1);
473
+ rb_define_method(c_cpBody, "activate", rb_cpBodyActivate, 0);
474
+ rb_define_method(c_cpBody, "velocity_func", rb_cpBodySetVelocityFunc, -1);
475
+ rb_define_method(c_cpBody, "position_func", rb_cpBodySetPositionFunc, -1);
476
+
477
+ rb_define_method(c_cpBody, "object=", rb_cpBodySetData, 1);
478
+ rb_define_method(c_cpBody, "object", rb_cpBodyGetData, 0);
479
+ rb_define_method(c_cpBody, "kinetic_energy", rb_cpBodyKineticEnergy, 0);
480
+
481
+
504
482
  }