rotation.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_ROTATION_H_
  23. #define _ODE_ROTATION_H_
  24. #include <ode/common.h>
  25. #include <ode/compatibility.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. ODE_API void dRSetIdentity (dMatrix3 R);
  30. ODE_API void dRFromAxisAndAngle (dMatrix3 R, dReal ax, dReal ay, dReal az,
  31. dReal angle);
  32. ODE_API void dRFromEulerAngles (dMatrix3 R, dReal phi, dReal theta, dReal psi);
  33. ODE_API void dRFrom2Axes (dMatrix3 R, dReal ax, dReal ay, dReal az,
  34. dReal bx, dReal by, dReal bz);
  35. ODE_API void dRFromZAxis (dMatrix3 R, dReal ax, dReal ay, dReal az);
  36. ODE_API void dQSetIdentity (dQuaternion q);
  37. ODE_API void dQFromAxisAndAngle (dQuaternion q, dReal ax, dReal ay, dReal az,
  38. dReal angle);
  39. /* Quaternion multiplication, analogous to the matrix multiplication routines. */
  40. /* qa = rotate by qc, then qb */
  41. ODE_API void dQMultiply0 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
  42. /* qa = rotate by qc, then by inverse of qb */
  43. ODE_API void dQMultiply1 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
  44. /* qa = rotate by inverse of qc, then by qb */
  45. ODE_API void dQMultiply2 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
  46. /* qa = rotate by inverse of qc, then by inverse of qb */
  47. ODE_API void dQMultiply3 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
  48. ODE_API void dRfromQ (dMatrix3 R, const dQuaternion q);
  49. ODE_API void dQfromR (dQuaternion q, const dMatrix3 R);
  50. ODE_API void dDQfromW (dReal dq[4], const dVector3 w, const dQuaternion q);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif