1 /////////////////////////////////////////////////////////////////////////////////// 2 /// OpenGL Mathematics (glm.g-truc.net) 3 /// 4 /// Copyright (c) 2005 - 2014 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 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 /// THE SOFTWARE. 22 /// 23 /// @ref gtx_vector_query 24 /// @file glm/gtx/vector_query.hpp 25 /// @date 2008-03-10 / 2011-06-07 26 /// @author Christophe Riccio 27 /// 28 /// @see core (dependence) 29 /// 30 /// @defgroup gtx_vector_query GLM_GTX_vector_query 31 /// @ingroup gtx 32 /// 33 /// @brief Query informations of vector types 34 /// 35 /// <glm/gtx/vector_query.hpp> need to be included to use these functionalities. 36 /////////////////////////////////////////////////////////////////////////////////// 37 38 #ifndef GLM_GTX_vector_query 39 #define GLM_GTX_vector_query 40 41 // Dependency: 42 #include "../glm.hpp" 43 #include <cfloat> 44 #include <limits> 45 46 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 47 # pragma message("GLM: GLM_GTX_vector_query extension included") 48 #endif 49 50 namespace glm 51 { 52 /// @addtogroup gtx_vector_query 53 /// @{ 54 55 //! Check whether two vectors are collinears. 56 /// @see gtx_vector_query extensions. 57 template <typename T, precision P, template <typename, precision> class vecType> 58 GLM_FUNC_DECL bool areCollinear(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); 59 60 //! Check whether two vectors are orthogonals. 61 /// @see gtx_vector_query extensions. 62 template <typename T, precision P, template <typename, precision> class vecType> 63 GLM_FUNC_DECL bool areOrthogonal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); 64 65 //! Check whether a vector is normalized. 66 /// @see gtx_vector_query extensions. 67 template <typename T, precision P, template <typename, precision> class vecType> 68 GLM_FUNC_DECL bool isNormalized(vecType<T, P> const & v, T const & epsilon); 69 70 //! Check whether a vector is null. 71 /// @see gtx_vector_query extensions. 72 template <typename T, precision P, template <typename, precision> class vecType> 73 GLM_FUNC_DECL bool isNull(vecType<T, P> const & v, T const & epsilon); 74 75 //! Check whether a each component of a vector is null. 76 /// @see gtx_vector_query extensions. 77 template <typename T, precision P, template <typename, precision> class vecType> 78 GLM_FUNC_DECL vecType<bool, P> isCompNull(vecType<T, P> const & v, T const & epsilon); 79 80 //! Check whether two vectors are orthonormal. 81 /// @see gtx_vector_query extensions. 82 template <typename T, precision P, template <typename, precision> class vecType> 83 GLM_FUNC_DECL bool areOrthonormal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); 84 85 /// @} 86 }// namespace glm 87 88 #include "vector_query.inl" 89 90 #endif//GLM_GTX_vector_query 91