gtx_vector_query.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include <glm/vec2.hpp>
  2. #include <glm/vec3.hpp>
  3. #include <glm/vec4.hpp>
  4. #include <glm/gtx/vector_query.hpp>
  5. int test_areCollinear()
  6. {
  7. int Error(0);
  8. {
  9. bool TestA = glm::areCollinear(glm::vec2(-1), glm::vec2(1), 0.00001f);
  10. Error += TestA ? 0 : 1;
  11. }
  12. {
  13. bool TestA = glm::areCollinear(glm::vec3(-1), glm::vec3(1), 0.00001f);
  14. Error += TestA ? 0 : 1;
  15. }
  16. {
  17. bool TestA = glm::areCollinear(glm::vec4(-1), glm::vec4(1), 0.00001f);
  18. Error += TestA ? 0 : 1;
  19. }
  20. return Error;
  21. }
  22. int test_areOrthogonal()
  23. {
  24. int Error(0);
  25. bool TestA = glm::areOrthogonal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
  26. Error += TestA ? 0 : 1;
  27. return Error;
  28. }
  29. int test_isNormalized()
  30. {
  31. int Error(0);
  32. bool TestA = glm::isNormalized(glm::vec4(1, 0, 0, 0), 0.00001f);
  33. Error += TestA ? 0 : 1;
  34. return Error;
  35. }
  36. int test_isNull()
  37. {
  38. int Error(0);
  39. bool TestA = glm::isNull(glm::vec4(0), 0.00001f);
  40. Error += TestA ? 0 : 1;
  41. return Error;
  42. }
  43. int test_areOrthonormal()
  44. {
  45. int Error(0);
  46. bool TestA = glm::areOrthonormal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
  47. Error += TestA ? 0 : 1;
  48. return Error;
  49. }
  50. int main()
  51. {
  52. int Error(0);
  53. Error += test_areCollinear();
  54. Error += test_areOrthogonal();
  55. Error += test_isNormalized();
  56. Error += test_isNull();
  57. Error += test_areOrthonormal();
  58. return Error;
  59. }