vector.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. Copyright (C) 2005, 2010 - Cryptic Sea
  3. This file is part of Gish.
  4. Gish is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. See the GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. INLINE float dotproduct(float *vec1,float *vec2);
  17. INLINE void crossproduct(float *result,float *vec1,float *vec2);
  18. INLINE float vectorlength(float *vec1);
  19. INLINE void normalizevector(float *result,float *vec1);
  20. INLINE void copyvector(float *result,float *vec1);
  21. INLINE void negvector(float *result,float *vec);
  22. INLINE void zerovector(float *result);
  23. INLINE void addvectors(float *result,float *vec,float *vec2);
  24. INLINE void subtractvectors(float *result,float *vec,float *vec2);
  25. INLINE void scalevector(float *result,float *vec,float scale);
  26. INLINE void scaleaddvectors(float *result,float *vec,float *vec2,float scale);
  27. INLINE void addvectors2(float *result,float *vec,float *vec2);
  28. INLINE void subtractvectors2(float *result,float *vec,float *vec2);
  29. INLINE void scalevector2(float *result,float *vec,float scale);
  30. INLINE void scaleaddvectors2(float *result,float *vec,float *vec2,float scale);
  31. void resetorientation(float orientation[3][3]);
  32. void rotateorientation(float orientation[3][3],float *rotationvector,float rotationangle);
  33. float xaxis[3]={ 1.0f,0.0f,0.0f };
  34. float yaxis[3]={ 0.0f,1.0f,0.0f };
  35. float zaxis[3]={ 0.0f,0.0f,1.0f };