1 /*************************************************************************
2  *                          D bindings for ODE                           *
3  *                                                                       *
4  *       C header port by Daniel "q66" Kolesa <quaker66@gmail.com>       *
5  *                                                                       *
6  * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
7  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
8  *                                                                       *
9  * This library is free software; you can redistribute it and/or         *
10  * modify it under the terms of EITHER:                                  *
11  *   (1) The GNU Lesser General Public License as published by the Free  *
12  *       Software Foundation; either version 2.1 of the License, or (at  *
13  *       your option) any later version. The text of the GNU Lesser      *
14  *       General Public License is included with this library in the     *
15  *       file LICENSE.TXT.                                               *
16  *   (2) The BSD-style license that is included with this library in     *
17  *       the file LICENSE-BSD.TXT.                                       *
18  *                                                                       *
19  * This library is distributed in the hope that it will be useful,       *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
22  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
23  *                                                                       *
24  *************************************************************************/
25 
26 module deimos.ode.contact;
27 
28 private import deimos.ode.common;
29 
30 extern (C):
31 nothrow:
32 
33 enum
34 {
35     dContactMu2 = 0x001,
36     dContactFDir1 = 0x002,
37     dContactBounce = 0x004,
38     dContactSoftERP = 0x008,
39     dContactSoftCFM = 0x010,
40     dContactMotion1 = 0x020,
41     dContactMotion2 = 0x040,
42     dContactMotionN = 0x080,
43     dContactSlip1 = 0x100,
44     dContactSlip2 = 0x200,
45 
46     dContactApprox0 = 0x0000,
47     dContactApprox1_1 = 0x1000,
48     dContactApprox1_2 = 0x2000,
49     dContactApprox1 = 0x3000
50 }
51 
52 struct dSurfaceParameters
53 {
54     /* must always be defined */
55     int mode;
56     dReal mu;
57 
58     /* only defined if the corresponding flag is set in mode */
59     dReal mu2;
60     dReal bounce;
61     dReal bounce_vel;
62     dReal soft_erp;
63     dReal soft_cfm;
64     dReal motion1, motion2, motionN;
65     dReal slip1, slip2;
66 }
67 
68 /**
69  * @brief Describe the contact point between two geoms.
70  *
71  * If two bodies touch, or if a body touches a static feature in its 
72  * environment, the contact is represented by one or more "contact 
73  * points", described by dContactGeom.
74  *
75  * The convention is that if body 1 is moved along the normal vector by 
76  * a distance depth (or equivalently if body 2 is moved the same distance 
77  * in the opposite direction) then the contact depth will be reduced to 
78  * zero. This means that the normal vector points "in" to body 1.
79  *
80  * @ingroup collide
81  */
82 struct dContactGeom
83 {
84     dVector3 pos;     ///< contact position
85     dVector3 normal;  ///< normal vector
86     dReal depth;      ///< penetration depth
87     dGeomID g1, g2;   ///< the colliding geoms
88     int side1, side2; ///< (to be documented)
89 }
90 
91 /* contact info used by contact joint */
92 
93 struct dContact
94 {
95     dSurfaceParameters surface;
96     dContactGeom geom;
97     dVector3 fdir1;
98 }