9
3

matrix_cross_product.inl 678 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /// @ref gtx_matrix_cross_product
  2. namespace glm
  3. {
  4. template<typename T, qualifier Q>
  5. GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3
  6. (
  7. vec<3, T, Q> const& x
  8. )
  9. {
  10. mat<3, 3, T, Q> Result(T(0));
  11. Result[0][1] = x.z;
  12. Result[1][0] = -x.z;
  13. Result[0][2] = -x.y;
  14. Result[2][0] = x.y;
  15. Result[1][2] = x.x;
  16. Result[2][1] = -x.x;
  17. return Result;
  18. }
  19. template<typename T, qualifier Q>
  20. GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4
  21. (
  22. vec<3, T, Q> const& x
  23. )
  24. {
  25. mat<4, 4, T, Q> Result(T(0));
  26. Result[0][1] = x.z;
  27. Result[1][0] = -x.z;
  28. Result[0][2] = -x.y;
  29. Result[2][0] = x.y;
  30. Result[1][2] = x.x;
  31. Result[2][1] = -x.x;
  32. return Result;
  33. }
  34. }//namespace glm