chipmunk 4.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README +60 -0
- data/Rakefile +47 -40
- data/ext/chipmunk/chipmunk.c +39 -3
- data/ext/chipmunk/cpArbiter.c +91 -80
- data/ext/chipmunk/cpArray.c +24 -10
- data/ext/chipmunk/cpBB.c +5 -4
- data/ext/chipmunk/cpBody.c +30 -22
- data/ext/chipmunk/cpCollision.c +54 -53
- data/ext/chipmunk/cpConstraint.c +54 -0
- data/ext/chipmunk/cpDampedRotarySpring.c +106 -0
- data/ext/chipmunk/cpDampedSpring.c +117 -0
- data/ext/chipmunk/cpGearJoint.c +114 -0
- data/ext/chipmunk/cpGrooveJoint.c +138 -0
- data/ext/chipmunk/cpHashSet.c +74 -40
- data/ext/chipmunk/cpPinJoint.c +117 -0
- data/ext/chipmunk/cpPivotJoint.c +114 -0
- data/ext/chipmunk/cpPolyShape.c +117 -15
- data/ext/chipmunk/cpRatchetJoint.c +128 -0
- data/ext/chipmunk/cpRotaryLimitJoint.c +122 -0
- data/ext/chipmunk/cpShape.c +174 -18
- data/ext/chipmunk/cpSimpleMotor.c +99 -0
- data/ext/chipmunk/cpSlideJoint.c +131 -0
- data/ext/chipmunk/cpSpace.c +584 -215
- data/ext/chipmunk/cpSpaceHash.c +191 -105
- data/ext/chipmunk/cpVect.c +18 -10
- data/ext/chipmunk/extconf.rb +34 -4
- data/ext/chipmunk/{chipmunk.h → include/chipmunk/chipmunk.h} +63 -6
- data/ext/chipmunk/include/chipmunk/chipmunk_ffi.h +42 -0
- data/ext/chipmunk/include/chipmunk/chipmunk_types.h +80 -0
- data/ext/chipmunk/include/chipmunk/chipmunk_unsafe.h +54 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpConstraint.h +92 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpDampedRotarySpring.h +46 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpDampedSpring.h +53 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpGearJoint.h +41 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpGrooveJoint.h +44 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpPinJoint.h +43 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpPivotJoint.h +42 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpRatchetJoint.h +40 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpRotaryLimitJoint.h +39 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpSimpleMotor.h +37 -0
- data/ext/chipmunk/include/chipmunk/constraints/cpSlideJoint.h +44 -0
- data/ext/chipmunk/include/chipmunk/constraints/util.h +116 -0
- data/ext/chipmunk/{cpArbiter.h → include/chipmunk/cpArbiter.h} +66 -15
- data/ext/chipmunk/{cpArray.h → include/chipmunk/cpArray.h} +2 -1
- data/ext/chipmunk/{cpBB.h → include/chipmunk/cpBB.h} +21 -0
- data/ext/chipmunk/{cpBody.h → include/chipmunk/cpBody.h} +37 -9
- data/ext/chipmunk/{cpCollision.h → include/chipmunk/cpCollision.h} +1 -1
- data/ext/chipmunk/{cpHashSet.h → include/chipmunk/cpHashSet.h} +12 -9
- data/ext/chipmunk/{cpPolyShape.h → include/chipmunk/cpPolyShape.h} +13 -2
- data/ext/chipmunk/{cpShape.h → include/chipmunk/cpShape.h} +51 -18
- data/ext/chipmunk/include/chipmunk/cpSpace.h +180 -0
- data/ext/chipmunk/{cpSpaceHash.h → include/chipmunk/cpSpaceHash.h} +18 -9
- data/ext/chipmunk/{cpVect.h → include/chipmunk/cpVect.h} +61 -10
- data/ext/chipmunk/prime.h +32 -32
- data/ext/chipmunk/rb_chipmunk.c +125 -109
- data/ext/chipmunk/rb_chipmunk.h +96 -77
- data/ext/chipmunk/rb_cpArbiter.c +225 -0
- data/ext/chipmunk/rb_cpBB.c +174 -154
- data/ext/chipmunk/rb_cpBody.c +347 -239
- data/ext/chipmunk/rb_cpConstraint.c +346 -0
- data/ext/chipmunk/rb_cpShape.c +455 -292
- data/ext/chipmunk/rb_cpSpace.c +544 -330
- data/ext/chipmunk/rb_cpVect.c +321 -250
- data/lib/chipmunk.rb +28 -15
- data/lib/chipmunk/version.rb +3 -0
- metadata +74 -34
- data/ext/chipmunk/cpJoint.c +0 -553
- data/ext/chipmunk/cpJoint.h +0 -122
- data/ext/chipmunk/cpSpace.h +0 -120
- data/ext/chipmunk/rb_cpJoint.c +0 -136
data/ext/chipmunk/rb_cpBody.c
CHANGED
@@ -1,239 +1,347 @@
|
|
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
|
-
#include
|
23
|
-
|
24
|
-
|
25
|
-
#include "
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
static VALUE
|
101
|
-
|
102
|
-
{
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
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
|
+
#include <stdlib.h>
|
23
|
+
#include "chipmunk.h"
|
24
|
+
|
25
|
+
#include "ruby.h"
|
26
|
+
#include "rb_chipmunk.h"
|
27
|
+
|
28
|
+
VALUE c_cpBody;
|
29
|
+
|
30
|
+
static VALUE
|
31
|
+
rb_cpBodyAlloc(VALUE klass)
|
32
|
+
{
|
33
|
+
cpBody *body = cpBodyNew(1.0f, 1.0f);
|
34
|
+
return Data_Wrap_Struct(klass, NULL, cpBodyFree, body);
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
rb_cpBodyInitialize(VALUE self, VALUE m, VALUE i)
|
39
|
+
{
|
40
|
+
cpBody *body = BODY(self);
|
41
|
+
cpBodyInit(body, NUM2DBL(m), NUM2DBL(i));
|
42
|
+
|
43
|
+
return self;
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
rb_cpBodyGetMass(VALUE self)
|
48
|
+
{
|
49
|
+
return rb_float_new(BODY(self)->m);
|
50
|
+
}
|
51
|
+
|
52
|
+
static VALUE
|
53
|
+
rb_cpBodyGetMassInv(VALUE self)
|
54
|
+
{
|
55
|
+
return rb_float_new(BODY(self)->m_inv);
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE
|
59
|
+
rb_cpBodyGetMoment(VALUE self)
|
60
|
+
{
|
61
|
+
return rb_float_new(BODY(self)->i);
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
rb_cpBodyGetMomentInv(VALUE self)
|
66
|
+
{
|
67
|
+
return rb_float_new(BODY(self)->i_inv);
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
rb_cpBodyGetPos(VALUE self)
|
72
|
+
{
|
73
|
+
return VWRAP(self, &BODY(self)->p);
|
74
|
+
}
|
75
|
+
|
76
|
+
static VALUE
|
77
|
+
rb_cpBodyGetVel(VALUE self)
|
78
|
+
{
|
79
|
+
return VWRAP(self, &BODY(self)->v);
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
rb_cpBodyGetForce(VALUE self)
|
84
|
+
{
|
85
|
+
return VWRAP(self, &BODY(self)->f);
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
rb_cpBodyGetAngle(VALUE self)
|
90
|
+
{
|
91
|
+
return rb_float_new(BODY(self)->a);
|
92
|
+
}
|
93
|
+
|
94
|
+
static VALUE
|
95
|
+
rb_cpBodyGetAVel(VALUE self)
|
96
|
+
{
|
97
|
+
return rb_float_new(BODY(self)->w);
|
98
|
+
}
|
99
|
+
|
100
|
+
static VALUE
|
101
|
+
rb_cpBodyGetTorque(VALUE self)
|
102
|
+
{
|
103
|
+
return rb_float_new(BODY(self)->t);
|
104
|
+
}
|
105
|
+
|
106
|
+
static VALUE
|
107
|
+
rb_cpBodyGetRot(VALUE self)
|
108
|
+
{
|
109
|
+
return VWRAP(self, &BODY(self)->rot);
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
rb_cpBodyGetVelLimit(VALUE self)
|
114
|
+
{
|
115
|
+
return rb_float_new(BODY(self)->v_limit);
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
rb_cpBodyGetAVelLimit(VALUE self)
|
120
|
+
{
|
121
|
+
return rb_float_new(BODY(self)->w_limit);
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
static VALUE
|
126
|
+
rb_cpBodySetMass(VALUE self, VALUE val)
|
127
|
+
{
|
128
|
+
cpBodySetMass(BODY(self), NUM2DBL(val));
|
129
|
+
return val;
|
130
|
+
}
|
131
|
+
|
132
|
+
static VALUE
|
133
|
+
rb_cpBodySetMoment(VALUE self, VALUE val)
|
134
|
+
{
|
135
|
+
cpBodySetMoment(BODY(self), NUM2DBL(val));
|
136
|
+
return val;
|
137
|
+
}
|
138
|
+
|
139
|
+
static VALUE
|
140
|
+
rb_cpBodySetMomentInv(VALUE self, VALUE val)
|
141
|
+
{
|
142
|
+
cpBodySetMoment(BODY(self), 1.0 / NUM2DBL(val));
|
143
|
+
return val;
|
144
|
+
}
|
145
|
+
|
146
|
+
static VALUE
|
147
|
+
rb_cpBodySetPos(VALUE self, VALUE val)
|
148
|
+
{
|
149
|
+
BODY(self)->p = *VGET(val);
|
150
|
+
return val;
|
151
|
+
}
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
rb_cpBodySetVel(VALUE self, VALUE val)
|
155
|
+
{
|
156
|
+
BODY(self)->v = *VGET(val);
|
157
|
+
return val;
|
158
|
+
}
|
159
|
+
|
160
|
+
static VALUE
|
161
|
+
rb_cpBodySetForce(VALUE self, VALUE val)
|
162
|
+
{
|
163
|
+
BODY(self)->f = *VGET(val);
|
164
|
+
return val;
|
165
|
+
}
|
166
|
+
|
167
|
+
static VALUE
|
168
|
+
rb_cpBodySetAngle(VALUE self, VALUE val)
|
169
|
+
{
|
170
|
+
cpBodySetAngle(BODY(self), NUM2DBL(val));
|
171
|
+
return val;
|
172
|
+
}
|
173
|
+
|
174
|
+
static VALUE
|
175
|
+
rb_cpBodySetAVel(VALUE self, VALUE val)
|
176
|
+
{
|
177
|
+
BODY(self)->w = NUM2DBL(val);
|
178
|
+
return val;
|
179
|
+
}
|
180
|
+
|
181
|
+
static VALUE
|
182
|
+
rb_cpBodySetTorque(VALUE self, VALUE val)
|
183
|
+
{
|
184
|
+
BODY(self)->t = NUM2DBL(val);
|
185
|
+
return val;
|
186
|
+
}
|
187
|
+
|
188
|
+
static VALUE
|
189
|
+
rb_cpBodySetVelLimit(VALUE self, VALUE val)
|
190
|
+
{
|
191
|
+
BODY(self)->v_limit = NUM2DBL(val);
|
192
|
+
return val;
|
193
|
+
}
|
194
|
+
|
195
|
+
static VALUE
|
196
|
+
rb_cpBodySetAVelLimit(VALUE self, VALUE val)
|
197
|
+
{
|
198
|
+
BODY(self)->w_limit = NUM2DBL(val);
|
199
|
+
return val;
|
200
|
+
}
|
201
|
+
|
202
|
+
|
203
|
+
static VALUE
|
204
|
+
rb_cpBodyLocal2World(VALUE self, VALUE v)
|
205
|
+
{
|
206
|
+
return VNEW(cpBodyLocal2World(BODY(self), *VGET(v)));
|
207
|
+
}
|
208
|
+
|
209
|
+
static VALUE
|
210
|
+
rb_cpBodyWorld2Local(VALUE self, VALUE v)
|
211
|
+
{
|
212
|
+
return VNEW(cpBodyWorld2Local(BODY(self), *VGET(v)));
|
213
|
+
}
|
214
|
+
|
215
|
+
static VALUE
|
216
|
+
rb_cpBodyResetForces(VALUE self)
|
217
|
+
{
|
218
|
+
cpBodyResetForces(BODY(self));
|
219
|
+
return self;
|
220
|
+
}
|
221
|
+
|
222
|
+
static VALUE
|
223
|
+
rb_cpBodyApplyForce(VALUE self, VALUE f, VALUE r)
|
224
|
+
{
|
225
|
+
cpBodyApplyForce(BODY(self), *VGET(f), *VGET(r));
|
226
|
+
return self;
|
227
|
+
}
|
228
|
+
|
229
|
+
static VALUE
|
230
|
+
rb_cpBodyApplyImpulse(VALUE self, VALUE j, VALUE r)
|
231
|
+
{
|
232
|
+
cpBodyApplyImpulse(BODY(self), *VGET(j), *VGET(r));
|
233
|
+
return self;
|
234
|
+
}
|
235
|
+
|
236
|
+
static VALUE
|
237
|
+
rb_cpBodyUpdateVelocity(VALUE self, VALUE g, VALUE dmp, VALUE dt)
|
238
|
+
{
|
239
|
+
cpBodyUpdateVelocity(BODY(self), *VGET(g), NUM2DBL(dmp), NUM2DBL(dt));
|
240
|
+
return self;
|
241
|
+
}
|
242
|
+
|
243
|
+
static VALUE
|
244
|
+
rb_cpBodyUpdatePosition(VALUE self, VALUE dt)
|
245
|
+
{
|
246
|
+
cpBodyUpdatePosition(BODY(self), NUM2DBL(dt));
|
247
|
+
return self;
|
248
|
+
}
|
249
|
+
|
250
|
+
// Intended for objects that are moved manually with a custom velocity integration function.
|
251
|
+
static VALUE
|
252
|
+
rb_cpBodySlew(VALUE self, VALUE pos, VALUE dt)
|
253
|
+
{
|
254
|
+
cpBodySlew(BODY(self), *VGET(pos), NUM2DBL(dt));
|
255
|
+
return self;
|
256
|
+
}
|
257
|
+
|
258
|
+
static VALUE
|
259
|
+
rb_cpApplyDampedSpring(VALUE klass, VALUE a, VALUE b,
|
260
|
+
VALUE anchr1, VALUE anchr2, VALUE rlen, VALUE k, VALUE dmp, VALUE dt)
|
261
|
+
{
|
262
|
+
cpApplyDampedSpring(BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2),
|
263
|
+
NUM2DBL(rlen), NUM2DBL(k), NUM2DBL(dmp), NUM2DBL(dt));
|
264
|
+
return klass;
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
void cpApplyDampedSpring(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat rlen, cpFloat k, cpFloat dmp, cpFloat dt);
|
269
|
+
|
270
|
+
void
|
271
|
+
Init_cpBody(void)
|
272
|
+
{
|
273
|
+
c_cpBody = rb_define_class_under(m_Chipmunk, "Body", rb_cObject);
|
274
|
+
rb_define_alloc_func(c_cpBody, rb_cpBodyAlloc);
|
275
|
+
rb_define_method(c_cpBody, "initialize", rb_cpBodyInitialize, 2);
|
276
|
+
|
277
|
+
rb_define_method(c_cpBody, "m" , rb_cpBodyGetMass, 0);
|
278
|
+
rb_define_method(c_cpBody, "m_inv" , rb_cpBodyGetMassInv, 0);
|
279
|
+
rb_define_method(c_cpBody, "i" , rb_cpBodyGetMoment, 0);
|
280
|
+
rb_define_method(c_cpBody, "i_inv" , rb_cpBodyGetMomentInv, 0);
|
281
|
+
rb_define_method(c_cpBody, "p" , rb_cpBodyGetPos, 0);
|
282
|
+
rb_define_method(c_cpBody, "v" , rb_cpBodyGetVel, 0);
|
283
|
+
rb_define_method(c_cpBody, "f" , rb_cpBodyGetForce, 0);
|
284
|
+
rb_define_method(c_cpBody, "a" , rb_cpBodyGetAngle, 0);
|
285
|
+
rb_define_method(c_cpBody, "w" , rb_cpBodyGetAVel, 0);
|
286
|
+
rb_define_method(c_cpBody, "t" , rb_cpBodyGetTorque, 0);
|
287
|
+
rb_define_method(c_cpBody, "rot" , rb_cpBodyGetRot, 0);
|
288
|
+
|
289
|
+
rb_define_method(c_cpBody, "m=" , rb_cpBodySetMass, 1);
|
290
|
+
rb_define_method(c_cpBody, "i=" , rb_cpBodySetMoment, 1);
|
291
|
+
rb_define_method(c_cpBody, "p=" , rb_cpBodySetPos, 1);
|
292
|
+
rb_define_method(c_cpBody, "v=" , rb_cpBodySetVel, 1);
|
293
|
+
rb_define_method(c_cpBody, "f=" , rb_cpBodySetForce, 1);
|
294
|
+
rb_define_method(c_cpBody, "a=" , rb_cpBodySetAngle, 1);
|
295
|
+
rb_define_method(c_cpBody, "w=" , rb_cpBodySetAVel, 1);
|
296
|
+
rb_define_method(c_cpBody, "t=" , rb_cpBodySetTorque, 1);
|
297
|
+
|
298
|
+
rb_define_method(c_cpBody, "mass" , rb_cpBodyGetMass, 0);
|
299
|
+
rb_define_method(c_cpBody, "moment" , rb_cpBodyGetMoment, 0);
|
300
|
+
rb_define_method(c_cpBody, "pos" , rb_cpBodyGetPos, 0);
|
301
|
+
rb_define_method(c_cpBody, "vel" , rb_cpBodyGetVel, 0);
|
302
|
+
rb_define_method(c_cpBody, "force" , rb_cpBodyGetForce, 0);
|
303
|
+
rb_define_method(c_cpBody, "angle" , rb_cpBodyGetAngle, 0);
|
304
|
+
rb_define_method(c_cpBody, "ang_vel" , rb_cpBodyGetAVel, 0);
|
305
|
+
rb_define_method(c_cpBody, "torque" , rb_cpBodyGetTorque, 0);
|
306
|
+
rb_define_method(c_cpBody, "rot" , rb_cpBodyGetRot, 0);
|
307
|
+
rb_define_method(c_cpBody, "v_limit" , rb_cpBodyGetVelLimit, 0);
|
308
|
+
rb_define_method(c_cpBody, "w_limit" , rb_cpBodyGetAVelLimit, 0);
|
309
|
+
|
310
|
+
rb_define_method(c_cpBody, "mass=" , rb_cpBodySetMass, 1);
|
311
|
+
rb_define_method(c_cpBody, "moment=" , rb_cpBodySetMoment, 1);
|
312
|
+
rb_define_method(c_cpBody, "pos=" , rb_cpBodySetPos, 1);
|
313
|
+
rb_define_method(c_cpBody, "vel=" , rb_cpBodySetVel, 1);
|
314
|
+
rb_define_method(c_cpBody, "force=" , rb_cpBodySetForce, 1);
|
315
|
+
rb_define_method(c_cpBody, "angle=" , rb_cpBodySetAngle, 1);
|
316
|
+
rb_define_method(c_cpBody, "ang_vel=", rb_cpBodySetAVel, 1);
|
317
|
+
rb_define_method(c_cpBody, "torque=" , rb_cpBodySetTorque, 1);
|
318
|
+
rb_define_method(c_cpBody, "v_limit=", rb_cpBodySetVelLimit, 1);
|
319
|
+
rb_define_method(c_cpBody, "w_limit=", rb_cpBodySetAVelLimit, 1);
|
320
|
+
|
321
|
+
/* Some more aliases */
|
322
|
+
rb_define_method(c_cpBody, "moment_inv" , rb_cpBodyGetMomentInv, 1);
|
323
|
+
rb_define_method(c_cpBody, "moment_inv=" , rb_cpBodySetMomentInv, 1);
|
324
|
+
rb_define_method(c_cpBody, "ang_vel_limit" , rb_cpBodyGetAVelLimit, 0);
|
325
|
+
rb_define_method(c_cpBody, "vel_limit" , rb_cpBodyGetVelLimit, 0);
|
326
|
+
rb_define_method(c_cpBody, "ang_vel_limit=" , rb_cpBodySetAVelLimit, 1);
|
327
|
+
rb_define_method(c_cpBody, "vel_limit=" , rb_cpBodySetVelLimit, 1);
|
328
|
+
|
329
|
+
|
330
|
+
rb_define_method(c_cpBody, "local2world", rb_cpBodyLocal2World, 1);
|
331
|
+
rb_define_method(c_cpBody, "world2local", rb_cpBodyWorld2Local, 1);
|
332
|
+
|
333
|
+
rb_define_method(c_cpBody, "reset_forces", rb_cpBodyResetForces, 0);
|
334
|
+
rb_define_method(c_cpBody, "apply_force", rb_cpBodyApplyForce, 2);
|
335
|
+
rb_define_method(c_cpBody, "apply_impulse", rb_cpBodyApplyImpulse, 2);
|
336
|
+
|
337
|
+
rb_define_method(c_cpBody, "update_velocity", rb_cpBodyUpdateVelocity, 3);
|
338
|
+
rb_define_method(c_cpBody, "update_position", rb_cpBodyUpdatePosition, 1);
|
339
|
+
|
340
|
+
/* Manual integration function */
|
341
|
+
rb_define_method(c_cpBody, "slew", rb_cpBodySlew, 2);
|
342
|
+
|
343
|
+
/* Damped spring function */
|
344
|
+
rb_define_singleton_method(c_cpBody,
|
345
|
+
"apply_damped_spring", rb_cpApplyDampedSpring, 8);
|
346
|
+
|
347
|
+
}
|