contact.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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,
  30. dContactFDir1 = 0x002,
  31. dContactBounce = 0x004,
  32. dContactSoftERP = 0x008,
  33. dContactSoftCFM = 0x010,
  34. dContactMotion1 = 0x020,
  35. dContactMotion2 = 0x040,
  36. dContactMotionN = 0x080,
  37. dContactSlip1 = 0x100,
  38. dContactSlip2 = 0x200,
  39. dContactApprox0 = 0x0000,
  40. dContactApprox1_1 = 0x1000,
  41. dContactApprox1_2 = 0x2000,
  42. dContactApprox1 = 0x3000
  43. };
  44. typedef struct dSurfaceParameters {
  45. /* must always be defined */
  46. int mode;
  47. dReal mu;
  48. /* only defined if the corresponding flag is set in mode */
  49. dReal mu2;
  50. dReal bounce;
  51. dReal bounce_vel;
  52. dReal soft_erp;
  53. dReal soft_cfm;
  54. dReal motion1,motion2,motionN;
  55. dReal slip1,slip2;
  56. } dSurfaceParameters;
  57. /**
  58. * @brief Describe the contact point between two geoms.
  59. *
  60. * If two bodies touch, or if a body touches a static feature in its
  61. * environment, the contact is represented by one or more "contact
  62. * points", described by dContactGeom.
  63. *
  64. * The convention is that if body 1 is moved along the normal vector by
  65. * a distance depth (or equivalently if body 2 is moved the same distance
  66. * in the opposite direction) then the contact depth will be reduced to
  67. * zero. This means that the normal vector points "in" to body 1.
  68. *
  69. * @ingroup collide
  70. */
  71. typedef struct dContactGeom {
  72. dVector3 pos; ///< contact position
  73. dVector3 normal; ///< normal vector
  74. dReal depth; ///< penetration depth
  75. dGeomID g1,g2; ///< the colliding geoms
  76. int side1,side2; ///< (to be documented)
  77. } dContactGeom;
  78. /* contact info used by contact joint */
  79. typedef struct dContact {
  80. dSurfaceParameters surface;
  81. dContactGeom geom;
  82. dVector3 fdir1;
  83. } dContact;
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif