cross.h 534 B

12345678910111213141516171819202122232425262728
  1. #ifndef IGL_CROSS_H
  2. #define IGL_CROSS_H
  3. namespace igl
  4. {
  5. // Computes out = cross(a,b)
  6. // Inputs:
  7. // a left 3d vector
  8. // b right 3d vector
  9. // Outputs:
  10. // out result 3d vector
  11. inline void cross(
  12. const double *a,
  13. const double *b,
  14. double *out);
  15. }
  16. // Implementation
  17. // http://www.antisphere.com/Wiki/tools:anttweakbar
  18. inline void igl::cross(
  19. const double *a,
  20. const double *b,
  21. double *out)
  22. {
  23. out[0] = a[1]*b[2]-a[2]*b[1];
  24. out[1] = a[2]*b[0]-a[0]*b[2];
  25. out[2] = a[0]*b[1]-a[1]*b[0];
  26. }
  27. #endif