File: declarations.pxd

package info (click to toggle)
soya 0.12-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,580 kB
  • ctags: 20,171
  • sloc: cpp: 45,252; python: 7,241; ansic: 5,226; perl: 273; makefile: 227; sh: 65
file content (450 lines) | stat: -rw-r--r-- 16,875 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# -*- indent-tabs-mode: t -*-

####################################################################
# Python Open Dynamics Engine Wrapper
#
# Copyright (C) 2003, Matthias Baas (baas@ira.uka.de)
#
# You may distribute under the terms of the BSD license, as
# specified in the files license*.txt.
# -------------------------------------------------------------
# Open Dynamics Engine
# Copyright (c) 2001-2003, Russell L. Smith.
# All rights reserved. 
####################################################################

cdef extern from "ode/ode.h":

		ctypedef double dReal
		
		# Dummy structs
		cdef struct dxWorld:
				int _dummy
		cdef struct dxSpace:
				int _dummy
		cdef struct dxBody:
				int _dummy
		cdef struct dxGeom:
				int _dummy
		cdef struct dxJoint:
				int _dummy
		cdef struct dxJointGroup:
				int _dummy
		cdef struct dxTriMeshData:
				int _dummy

		# Types
		ctypedef dxWorld* dWorldID
		ctypedef dxSpace* dSpaceID
		ctypedef dxBody* dBodyID
		ctypedef dxGeom* dGeomID
		ctypedef dxJoint* dJointID
		ctypedef dxJointGroup* dJointGroupID
		ctypedef dxTriMeshData* dTriMeshDataID
		ctypedef dReal dVector3[4]
		ctypedef dReal dVector4[4]
		ctypedef dReal dMatrix3[4*3]
		ctypedef dReal dMatrix4[4*4]
		ctypedef dReal dMatrix6[8*6]
		ctypedef dReal dQuaternion[4]

		cdef extern dReal dInfinity
		cdef extern int dAMotorUser
		cdef extern int dAMotorEuler

		ctypedef struct dMass:
				dReal    mass
				dVector4 c
				dMatrix3 I
				
		ctypedef struct dJointFeedback:
				dVector3 f1
				dVector3 t1
				dVector3 f2
				dVector3 t2

		ctypedef void dNearCallback(void* data, dGeomID o1, dGeomID o2)

		ctypedef struct dSurfaceParameters:
				int mode
				dReal mu

				dReal mu2
				dReal bounce
				dReal bounce_vel
				dReal soft_erp
				dReal soft_cfm
				dReal motion1,motion2
				dReal slip1,slip2

		ctypedef struct dContactGeom:
				dVector3 pos
				dVector3 normal
				dReal depth
				dGeomID g1,g2

		ctypedef struct dContact:
				dSurfaceParameters surface
				dContactGeom geom
				dVector3 fdir1

		cdef enum:
				dSphereClass = 0
				dBoxClass,
				dCCylinderClass,
				dCylinderClass,
				dPlaneClass,
				dRayClass,
				dGeomTransformClass,


		# World
		dWorldID dWorldCreate()
		void dWorldDestroy (dWorldID)

		void dCloseODE()

		void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z)
		void dWorldGetGravity (dWorldID, dVector3 gravity)
		void dWorldSetERP (dWorldID, dReal erp)
		dReal dWorldGetERP (dWorldID)
		void dWorldSetCFM (dWorldID, dReal cfm)
		dReal dWorldGetCFM (dWorldID)
		void dWorldStep (dWorldID, dReal stepsize)
		void dWorldQuickStep (dWorldID, dReal stepsize)
		void dWorldSetQuickStepNumIterations (dWorldID, int num)
		int dWorldGetQuickStepNumIterations (dWorldID)
		void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel)
		dReal dWorldGetContactMaxCorrectingVel (dWorldID)
		void dWorldSetContactSurfaceLayer (dWorldID, dReal depth)
		dReal dWorldGetContactSurfaceLayer (dWorldID)
		void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable)
		int dWorldGetAutoDisableFlag (dWorldID)
		void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold)
		dReal dWorldGetAutoDisableLinearThreshold (dWorldID)
		void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold)
		dReal dWorldGetAutoDisableAngularThreshold (dWorldID)
		void dWorldSetAutoDisableSteps (dWorldID, int steps)
		int dWorldGetAutoDisableSteps (dWorldID)
		void dWorldSetAutoDisableTime (dWorldID, dReal time)
		dReal dWorldGetAutoDisableTime (dWorldID)
		void dWorldImpulseToForce (dWorldID, dReal stepsize,
															 dReal ix, dReal iy, dReal iz, dVector3 force)

		# Body
		dBodyID dBodyCreate (dWorldID)
		void dBodyDestroy (dBodyID)

		void  dBodySetData (dBodyID, void *data)
		void *dBodyGetData (dBodyID)

		void dBodySetPosition   (dBodyID, dReal x, dReal y, dReal z)
		void dBodySetRotation   (dBodyID, dMatrix3 R)
		void dBodySetQuaternion (dBodyID, dQuaternion q)
		void dBodySetLinearVel  (dBodyID, dReal x, dReal y, dReal z)
		void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z)
		dReal * dBodyGetPosition   (dBodyID)
		dReal * dBodyGetRotation   (dBodyID)
		dReal * dBodyGetQuaternion (dBodyID)
		dReal * dBodyGetLinearVel  (dBodyID)
		dReal * dBodyGetAngularVel (dBodyID)

		void dBodySetMass (dBodyID, dMass *mass)
		void dBodyGetMass (dBodyID, dMass *mass)

		void dBodyAddForce            (dBodyID, dReal fx, dReal fy, dReal fz)
		void dBodyAddTorque           (dBodyID, dReal fx, dReal fy, dReal fz)
		void dBodyAddRelForce         (dBodyID, dReal fx, dReal fy, dReal fz)
		void dBodyAddRelTorque        (dBodyID, dReal fx, dReal fy, dReal fz)
		void dBodyAddForceAtPos       (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
		void dBodyAddForceAtRelPos    (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
		void dBodyAddRelForceAtPos    (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
		void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)

		dReal * dBodyGetForce   (dBodyID)
		dReal * dBodyGetTorque  (dBodyID)

		void dBodySetForce(dBodyID, dReal x, dReal y, dReal z)
		void dBodySetTorque(dBodyID, dReal x, dReal y, dReal z)

		void dBodyGetRelPointPos    (dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
		void dBodyGetRelPointVel    (dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
		void dBodyGetPointVel    (dBodyID, dReal px, dReal py, dReal pz,
															dVector3 result)
		void dBodyGetPosRelPoint (dBodyID, dReal px, dReal py, dReal pz,
															dVector3 result)
		void dBodyVectorToWorld   (dBodyID, dReal px, dReal py, dReal pz,
															 dVector3 result)
		void dBodyVectorFromWorld (dBodyID, dReal px, dReal py, dReal pz,
															 dVector3 result)

		void dBodySetFiniteRotationMode (dBodyID, int mode)
		void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z)

		int dBodyGetFiniteRotationMode (dBodyID)
		void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result)

		int dBodyGetNumJoints (dBodyID b)
		dJointID dBodyGetJoint (dBodyID, int index)

		void dBodyEnable (dBodyID)
		void dBodyDisable (dBodyID)
		int dBodyIsEnabled (dBodyID)

		void dBodySetGravityMode (dBodyID b, int mode)
		int dBodyGetGravityMode (dBodyID b)

		# Joints
		dJointID dJointCreateBall (dWorldID, dJointGroupID)
		dJointID dJointCreateHinge (dWorldID, dJointGroupID)
		dJointID dJointCreateSlider (dWorldID, dJointGroupID)
		dJointID dJointCreateContact (dWorldID, dJointGroupID, dContact *)
		dJointID dJointCreateUniversal (dWorldID, dJointGroupID)
		dJointID dJointCreateHinge2 (dWorldID, dJointGroupID)
		dJointID dJointCreateFixed (dWorldID, dJointGroupID)
		dJointID dJointCreateNull (dWorldID, dJointGroupID)
		dJointID dJointCreateAMotor (dWorldID, dJointGroupID)

		void dJointDestroy (dJointID)

		dJointGroupID dJointGroupCreate (int max_size)
		void dJointGroupDestroy (dJointGroupID)
		void dJointGroupEmpty (dJointGroupID)

		void dJointAttach (dJointID, dBodyID body1, dBodyID body2)
		void dJointSetData (dJointID, void *data)
		void *dJointGetData (dJointID)
		int dJointGetType (dJointID)
		dBodyID dJointGetBody (dJointID, int index)

		void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z)
		void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z)
		void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z)
		void dJointSetHingeParam (dJointID, int parameter, dReal value)
		void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z)
		void dJointSetSliderParam (dJointID, int parameter, dReal value)
		void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z)
		void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z)
		void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z)
		void dJointSetHinge2Param (dJointID, int parameter, dReal value)
		void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z)
		void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z)
		void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z)
		void dJointSetUniversalParam (dJointID, int parameter, dReal value)
		void dJointSetFixed (dJointID)
		void dJointSetAMotorNumAxes (dJointID, int num)
		void dJointSetAMotorAxis (dJointID, int anum, int rel, dReal x, dReal y, dReal z)
		void dJointSetAMotorAngle (dJointID, int anum, dReal angle)
		void dJointSetAMotorParam (dJointID, int parameter, dReal value)
		void dJointSetAMotorMode (dJointID, int mode)

		void dJointGetBallAnchor (dJointID, dVector3 result)
		void dJointGetBallAnchor2 (dJointID, dVector3 result)
		void dJointGetHingeAnchor (dJointID, dVector3 result)
		void dJointGetHingeAnchor2 (dJointID, dVector3 result)
		void dJointGetHingeAxis (dJointID, dVector3 result)
		dReal dJointGetHingeParam (dJointID, int parameter)
		dReal dJointGetHingeAngle (dJointID)
		dReal dJointGetHingeAngleRate (dJointID)
		dReal dJointGetSliderPosition (dJointID)
		dReal dJointGetSliderPositionRate (dJointID)
		void dJointGetSliderAxis (dJointID, dVector3 result)
		dReal dJointGetSliderParam (dJointID, int parameter)
		void dJointGetHinge2Anchor (dJointID, dVector3 result)
		void dJointGetHinge2Anchor2 (dJointID, dVector3 result)
		void dJointGetHinge2Axis1 (dJointID, dVector3 result)
		void dJointGetHinge2Axis2 (dJointID, dVector3 result)
		dReal dJointGetHinge2Param (dJointID, int parameter)
		dReal dJointGetHinge2Angle1 (dJointID)
		dReal dJointGetHinge2Angle1Rate (dJointID)
		dReal dJointGetHinge2Angle2Rate (dJointID)
		void dJointGetUniversalAnchor (dJointID, dVector3 result)
		void dJointGetUniversalAnchor2 (dJointID, dVector3 result)
		void dJointGetUniversalAxis1 (dJointID, dVector3 result)
		void dJointGetUniversalAxis2 (dJointID, dVector3 result)
		dReal dJointGetUniversalParam (dJointID, int parameter)
		int dJointGetAMotorNumAxes (dJointID)
		void dJointGetAMotorAxis (dJointID, int anum, dVector3 result)
		int dJointGetAMotorAxisRel (dJointID, int anum)
		dReal dJointGetAMotorAngle (dJointID, int anum)
		dReal dJointGetAMotorAngleRate (dJointID, int anum)
		dReal dJointGetAMotorParam (dJointID, int parameter)
		int dJointGetAMotorMode (dJointID)

		void dJointSetFeedback (dJointID, dJointFeedback *)
		dJointFeedback *dJointGetFeedback (dJointID)

		int dAreConnected (dBodyID, dBodyID)

		# Mass
		void dMassSetZero (dMass *)
		void dMassSetParameters (dMass *, dReal themass,
						 dReal cgx, dReal cgy, dReal cgz,
						 dReal I11, dReal I22, dReal I33,
						 dReal I12, dReal I13, dReal I23)
		void dMassSetSphere (dMass *, dReal density, dReal radius)
		void dMassSetCappedCylinder (dMass *, dReal density, int direction,
								 dReal a, dReal b)
		void dMassSetCylinder (dMass *, dReal density, int direction,
					dReal radius, dReal length)
		void dMassSetBox (dMass *, dReal density,
					dReal lx, dReal ly, dReal lz)
		void dMassAdjust (dMass *, dReal newmass)
		void dMassTranslate (dMass *, dReal x, dReal y, dReal z)
		void dMassRotate (dMass *, dMatrix3 R)
		void dMassAdd (dMass *a, dMass *b)

		# Space
#    dSpaceID dSimpleSpaceCreate(int space)
#    dSpaceID dHashSpaceCreate(int space)
		dSpaceID dSimpleSpaceCreate(dSpaceID space)
		dSpaceID dHashSpaceCreate(dSpaceID space)
		dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center,
																	 dVector3 Extents, int Depth)

		void dSpaceDestroy (dSpaceID)
		void dSpaceAdd (dSpaceID, dGeomID)
		void dSpaceRemove (dSpaceID, dGeomID)
		int dSpaceQuery (dSpaceID, dGeomID)
		void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback)
		void dSpaceCollide2 (dGeomID g1, dGeomID g2, void *data, dNearCallback *callback)

		void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel)
		void dHashSpaceGetLevels (dSpaceID space, int *minlevel, int *maxlevel)

		void dSpaceSetCleanup (dSpaceID space, int mode)
		int dSpaceGetCleanup (dSpaceID space)

		int dSpaceGetNumGeoms (dSpaceID)
		dGeomID dSpaceGetGeom (dSpaceID, int i)

		# Geom
		dGeomID dCreateSphere (dSpaceID space, dReal radius)
		dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz)
		dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
		dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length)
		dGeomID dCreateGeomGroup (dSpaceID space)

		void dGeomSphereSetRadius (dGeomID sphere, dReal radius)
		void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz)
		void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d)
		void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length)

		dReal dGeomSphereGetRadius (dGeomID sphere)
		void  dGeomBoxGetLengths (dGeomID box, dVector3 result)
		void  dGeomPlaneGetParams (dGeomID plane, dVector4 result)
		void  dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length)

		dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z)
		dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z)
		dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z)
		dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z)

		dGeomID dCreateRay (dSpaceID space, dReal length)
		void dGeomRaySetLength (dGeomID ray, dReal length)
		dReal dGeomRayGetLength (dGeomID ray)
		void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
					dReal dx, dReal dy, dReal dz)
		void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir)

		void dGeomSetData (dGeomID, void *)
		void *dGeomGetData (dGeomID)
		void dGeomSetBody (dGeomID, dBodyID)
		dBodyID dGeomGetBody (dGeomID)
		void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z)
		void dGeomSetRotation (dGeomID, dMatrix3 R)
		dReal * dGeomGetPosition (dGeomID)
		dReal * dGeomGetRotation (dGeomID)
		void dGeomDestroy (dGeomID)
		void dGeomGetAABB (dGeomID, dReal aabb[6])
		dReal *dGeomGetSpaceAABB (dGeomID)
		int dGeomIsSpace (dGeomID)
		dSpaceID dGeomGetSpace (dGeomID)
		int dGeomGetClass (dGeomID)

		void dGeomSetCategoryBits(dGeomID, unsigned long bits)
		void dGeomSetCollideBits(dGeomID, unsigned long bits)
		unsigned long dGeomGetCategoryBits(dGeomID)
		unsigned long dGeomGetCollideBits(dGeomID)     

		void dGeomEnable (dGeomID)
		void dGeomDisable (dGeomID)
		int dGeomIsEnabled (dGeomID)

		void dGeomGroupAdd (dGeomID group, dGeomID x)
		void dGeomGroupRemove (dGeomID group, dGeomID x)
		int dGeomGroupGetNumGeoms (dGeomID group)
		dGeomID dGeomGroupGetGeom (dGeomID group, int i)

		dGeomID dCreateGeomTransform (dSpaceID space)
		void dGeomTransformSetGeom (dGeomID g, dGeomID obj)
		dGeomID dGeomTransformGetGeom (dGeomID g)
		void dGeomTransformSetCleanup (dGeomID g, int mode)
		int dGeomTransformGetCleanup (dGeomID g)
		void dGeomTransformSetInfo (dGeomID g, int mode)
		int dGeomTransformGetInfo (dGeomID g)

		int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact, int skip)

		# Trimesh
		dTriMeshDataID dGeomTriMeshDataCreate()
		void dGeomTriMeshDataDestroy(dTriMeshDataID g)
		void dGeomTriMeshDataBuildSingle1(dTriMeshDataID g, void* Vertices,
																int VertexStride, int VertexCount,
																void* Indices, int IndexCount,
																int TriStride, void* Normals)
		
		void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
																 dReal* Vertices, int VertexCount,
																 int* Indices, int IndexCount)

		dGeomID dCreateTriMesh (dSpaceID space, dTriMeshDataID Data,
														void* Callback,
														void* ArrayCallback,
														void* RayCallback)   

		void dGeomTriMeshSetData (dGeomID g, dTriMeshDataID Data)

		void dGeomTriMeshDataSet (dTriMeshDataID data, int what, void *ptr)
		
		void dGeomTriMeshClearTCCache (dGeomID g)

		void dGeomTriMeshGetTriangle (dGeomID g, int Index, dVector3 *v0,
																	dVector3 *v1, dVector3 *v2)

		void dGeomTriMeshGetPoint (dGeomID g, int Index, dReal u, dReal v,
															 dVector3 Out)

		void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable)
		int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass)

		cdef enum:
				TRIMESH_FACE_NORMALS = 0
				TRIMESH_LAST_TRANSFORMATION

		# User-defined classes
		ctypedef void dGetAABBFn (dGeomID, dReal aabb[6])
		ctypedef int dColliderFn (dGeomID o1, dGeomID o2,
															int flags, dContactGeom *contact, int skip)
		ctypedef dColliderFn * dGetColliderFnFn (int num)
		ctypedef void dGeomDtorFn (dGeomID o)
		ctypedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6])

		ctypedef struct dGeomClass:
			int bytes
			dGetColliderFnFn *collider
			dGetAABBFn *aabb
			dAABBTestFn *aabb_test
			dGeomDtorFn *dtor

		int dCreateGeomClass (dGeomClass *classptr)
		void * dGeomGetClassData (dGeomID)
		dGeomID dCreateGeom (int classnum)

		dGetAABBFn *dInfiniteAABB


		
## For the custom colliders
## Not needed any more
#ctypedef dReal dGetDepthFn(dGeomID g, dReal x, dReal y, dReal z)