gtx_matrix_query.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// Restrictions:
  16. /// By making use of the Software for military purposes, you choose to make
  17. /// a Bunny unhappy.
  18. ///
  19. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. /// THE SOFTWARE.
  26. ///
  27. /// @file test/gtx/gtx_matrix_query.cpp
  28. /// @date 2011-11-22 / 2014-11-25
  29. /// @author Christophe Riccio
  30. ///////////////////////////////////////////////////////////////////////////////////
  31. #include <glm/gtx/matrix_query.hpp>
  32. int test_isNull()
  33. {
  34. int Error(0);
  35. bool TestA = glm::isNull(glm::mat4(0), 0.00001f);
  36. Error += TestA ? 0 : 1;
  37. return Error;
  38. }
  39. int test_isIdentity()
  40. {
  41. int Error(0);
  42. {
  43. bool TestA = glm::isIdentity(glm::mat2(1), 0.00001f);
  44. Error += TestA ? 0 : 1;
  45. }
  46. {
  47. bool TestA = glm::isIdentity(glm::mat3(1), 0.00001f);
  48. Error += TestA ? 0 : 1;
  49. }
  50. {
  51. bool TestA = glm::isIdentity(glm::mat4(1), 0.00001f);
  52. Error += TestA ? 0 : 1;
  53. }
  54. return Error;
  55. }
  56. int test_isNormalized()
  57. {
  58. int Error(0);
  59. bool TestA = glm::isNormalized(glm::mat4(1), 0.00001f);
  60. Error += TestA ? 0 : 1;
  61. return Error;
  62. }
  63. int test_isOrthogonal()
  64. {
  65. int Error(0);
  66. bool TestA = glm::isOrthogonal(glm::mat4(1), 0.00001f);
  67. Error += TestA ? 0 : 1;
  68. return Error;
  69. }
  70. int main()
  71. {
  72. int Error(0);
  73. Error += test_isNull();
  74. Error += test_isIdentity();
  75. Error += test_isNormalized();
  76. Error += test_isOrthogonal();
  77. return Error;
  78. }