1 /*************************************************************************
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
21 *************************************************************************/
23 #ifndef _ODE_CONTACT_H_
24 #define _ODE_CONTACT_H_
26 #include <ode/common.h>
34 dContactMu2
= 0x001, /**< Use axis dependent friction */
35 dContactAxisDep
= 0x001, /**< Same as above */
36 dContactFDir1
= 0x002, /**< Use FDir for the first friction value */
37 dContactBounce
= 0x004, /**< Restore collision energy anti-parallel to the normal */
38 dContactSoftERP
= 0x008, /**< Don't use global erp for penetration reduction */
39 dContactSoftCFM
= 0x010, /**< Don't use global cfm for penetration constraint */
40 dContactMotion1
= 0x020, /**< Use a non-zero target velocity for the constraint */
41 dContactMotion2
= 0x040,
42 dContactMotionN
= 0x080,
43 dContactSlip1
= 0x100, /**< Force-dependent slip. */
44 dContactSlip2
= 0x200,
45 dContactRolling
= 0x400, /**< Rolling/Angular friction */
47 dContactApprox0
= 0x0000,
48 dContactApprox1_1
= 0x1000,
49 dContactApprox1_2
= 0x2000,
50 dContactApprox1_N
= 0x4000, /**< For rolling friction */
51 dContactApprox1
= 0x7000
55 typedef struct dSurfaceParameters
{
56 /* must always be defined */
60 /* only defined if the corresponding flag is set in mode */
62 dReal rho
; /**< Rolling friction */
64 dReal rhoN
; /**< Spinning friction */
65 dReal bounce
; /**< Coefficient of restitution */
66 dReal bounce_vel
; /**< Bouncing threshold */
69 dReal motion1
,motion2
,motionN
;
75 * @brief Describe the contact point between two geoms.
77 * If two bodies touch, or if a body touches a static feature in its
78 * environment, the contact is represented by one or more "contact
79 * points", described by dContactGeom.
81 * The convention is that if body 1 is moved along the normal vector by
82 * a distance depth (or equivalently if body 2 is moved the same distance
83 * in the opposite direction) then the contact depth will be reduced to
84 * zero. This means that the normal vector points "in" to body 1.
88 typedef struct dContactGeom
{
89 dVector3 pos
; /*< contact position*/
90 dVector3 normal
; /*< normal vector*/
91 dReal depth
; /*< penetration depth*/
92 dGeomID g1
,g2
; /*< the colliding geoms*/
93 int side1
,side2
; /*< (to be documented)*/
97 /* contact info used by contact joint */
99 typedef struct dContact
{
100 dSurfaceParameters surface
;