contact.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*************************************************************************
  2. * *
  3. * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
  4. * All rights reserved. Email: [email protected] Web: www.q12.org *
  5. * *
  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 *
  12. * file LICENSE.TXT. *
  13. * (2) The BSD-style license that is included with this library in *
  14. * the file LICENSE-BSD.TXT. *
  15. * *
  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. *
  20. * *
  21. *************************************************************************/
  22. #ifndef _ODE_CONTACT_H_
  23. #define _ODE_CONTACT_H_
  24. #include <ode/common.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. enum {
  29. dContactMu2 = 0x001, /**< Use axis dependent friction */
  30. dContactAxisDep = 0x001, /**< Same as above */
  31. dContactFDir1 = 0x002, /**< Use FDir for the first friction value */
  32. dContactBounce = 0x004, /**< Restore collision energy anti-parallel to the normal */
  33. dContactSoftERP = 0x008, /**< Don't use global erp for penetration reduction */
  34. dContactSoftCFM = 0x010, /**< Don't use global cfm for penetration constraint */
  35. dContactMotion1 = 0x020, /**< Use a non-zero target velocity for the constraint */
  36. dContactMotion2 = 0x040,
  37. dContactMotionN = 0x080,
  38. dContactSlip1 = 0x100, /**< Force-dependent slip. */
  39. dContactSlip2 = 0x200,
  40. dContactRolling = 0x400, /**< Rolling/Angular friction */
  41. dContactApprox0 = 0x0000,
  42. dContactApprox1_1 = 0x1000,
  43. dContactApprox1_2 = 0x2000,
  44. dContactApprox1_N = 0x4000, /**< For rolling friction */
  45. dContactApprox1 = 0x7000
  46. };
  47. typedef struct dSurfaceParameters {
  48. /* must always be defined */
  49. int mode;
  50. dReal mu;
  51. /* only defined if the corresponding flag is set in mode */
  52. dReal mu2;
  53. dReal rho; /**< Rolling friction */
  54. dReal rho2;
  55. dReal rhoN; /**< Spinning friction */
  56. dReal bounce; /**< Coefficient of restitution */
  57. dReal bounce_vel; /**< Bouncing threshold */
  58. dReal soft_erp;
  59. dReal soft_cfm;
  60. dReal motion1,motion2,motionN;
  61. dReal slip1,slip2;
  62. } dSurfaceParameters;
  63. /**
  64. * @brief Describe the contact point between two geoms.
  65. *
  66. * If two bodies touch, or if a body touches a static feature in its
  67. * environment, the contact is represented by one or more "contact
  68. * points", described by dContactGeom.
  69. *
  70. * The convention is that if body 1 is moved along the normal vector by
  71. * a distance depth (or equivalently if body 2 is moved the same distance
  72. * in the opposite direction) then the contact depth will be reduced to
  73. * zero. This means that the normal vector points "in" to body 1.
  74. *
  75. * @ingroup collide
  76. */
  77. typedef struct dContactGeom {
  78. dVector3 pos; /*< contact position*/
  79. dVector3 normal; /*< normal vector*/
  80. dReal depth; /*< penetration depth*/
  81. dGeomID g1,g2; /*< the colliding geoms*/
  82. int side1,side2; /*< (to be documented)*/
  83. } dContactGeom;
  84. /* contact info used by contact joint */
  85. typedef struct dContact {
  86. dSurfaceParameters surface;
  87. dContactGeom geom;
  88. dVector3 fdir1;
  89. } dContact;
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif