NvFloatMath.cpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // a set of routines that let you do common 3d math
  2. // operations without any vector, matrix, or quaternion
  3. // classes or templates.
  4. //
  5. // a vector (or point) is a 'NxF32 *' to 3 floating point numbers.
  6. // a matrix is a 'NxF32 *' to an array of 16 floating point numbers representing a 4x4 transformation matrix compatible with D3D or OGL
  7. // a quaternion is a 'NxF32 *' to 4 floats representing a quaternion x,y,z,w
  8. //
  9. //
  10. /*!
  11. **
  12. ** Copyright (c) 2009 by John W. Ratcliff mailto:[email protected]
  13. **
  14. ** Portions of this source has been released with the PhysXViewer application, as well as
  15. ** Rocket, CreateDynamics, ODF, and as a number of sample code snippets.
  16. **
  17. ** If you find this code useful or you are feeling particularily generous I would
  18. ** ask that you please go to http://www.amillionpixels.us and make a donation
  19. ** to Troy DeMolay.
  20. **
  21. ** DeMolay is a youth group for young men between the ages of 12 and 21.
  22. ** It teaches strong moral principles, as well as leadership skills and
  23. ** public speaking. The donations page uses the 'pay for pixels' paradigm
  24. ** where, in this case, a pixel is only a single penny. Donations can be
  25. ** made for as small as $4 or as high as a $100 block. Each person who donates
  26. ** will get a link to their own site as well as acknowledgement on the
  27. ** donations blog located here http://www.amillionpixels.blogspot.com/
  28. **
  29. ** If you wish to contact me you can use the following methods:
  30. **
  31. ** Skype ID: jratcliff63367
  32. ** Yahoo: jratcliff63367
  33. ** AOL: jratcliff1961
  34. ** email: [email protected]
  35. **
  36. **
  37. ** The MIT license:
  38. **
  39. ** Permission is hereby granted, free of charge, to any person obtaining a copy
  40. ** of this software and associated documentation files (the "Software"), to deal
  41. ** in the Software without restriction, including without limitation the rights
  42. ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43. ** copies of the Software, and to permit persons to whom the Software is furnished
  44. ** to do so, subject to the following conditions:
  45. **
  46. ** The above copyright notice and this permission notice shall be included in all
  47. ** copies or substantial portions of the Software.
  48. ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49. ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50. ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51. ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  52. ** WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  53. ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  54. */
  55. #include <stdio.h>
  56. #include <stdlib.h>
  57. #include <string.h>
  58. #include <assert.h>
  59. #include <math.h>
  60. #include <float.h>
  61. #include "NvFloatMath.h"
  62. #define REAL NxF32
  63. #include "NvFloatMath.inl"
  64. #undef REAL
  65. #define REAL NxF64
  66. #include "NvFloatMath.inl"