core_func_matrix.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2011-01-15
  5. // Updated : 2011-01-15
  6. // Licence : This source is under MIT licence
  7. // File : test/core/func_matrix.cpp
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. #include <glm/glm.hpp>
  10. int test_matrixCompMult()
  11. {
  12. return 0;
  13. }
  14. int test_outerProduct()
  15. {
  16. return 0;
  17. }
  18. int test_transpose()
  19. {
  20. return 0;
  21. }
  22. int test_determinant()
  23. {
  24. return 0;
  25. }
  26. int test_inverse()
  27. {
  28. int Failed(0);
  29. glm::mat4x4 A4x4(
  30. glm::vec4(1, 0, 1, 0),
  31. glm::vec4(0, 1, 0, 0),
  32. glm::vec4(0, 0, 1, 0),
  33. glm::vec4(0, 0, 0, 1));
  34. glm::mat4x4 B4x4 = glm::inverse(A4x4);
  35. glm::mat4x4 I4x4 = A4x4 * B4x4;
  36. Failed += I4x4 == glm::mat4x4(1) ? 0 : 1;
  37. glm::mat3x3 A3x3(
  38. glm::vec3(1, 0, 1),
  39. glm::vec3(0, 1, 0),
  40. glm::vec3(0, 0, 1));
  41. glm::mat3x3 B3x3 = glm::inverse(A3x3);
  42. glm::mat3x3 I3x3 = A3x3 * B3x3;
  43. Failed += I3x3 == glm::mat3x3(1) ? 0 : 1;
  44. glm::mat2x2 A2x2(
  45. glm::vec2(1, 1),
  46. glm::vec2(0, 1));
  47. glm::mat2x2 B2x2 = glm::inverse(A2x2);
  48. glm::mat2x2 I2x2 = A2x2 * B2x2;
  49. Failed += I2x2 == glm::mat2x2(1) ? 0 : 1;
  50. return Failed;
  51. }
  52. int main()
  53. {
  54. int Failed = 0;
  55. Failed += test_matrixCompMult();
  56. Failed += test_outerProduct();
  57. Failed += test_transpose();
  58. Failed += test_determinant();
  59. Failed += test_inverse();
  60. return Failed;
  61. }