00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_core_func_vector_relational
00011 #define glm_core_func_vector_relational
00012
00013 #include "_detail.hpp"
00014
00015 namespace glm
00016 {
00017 namespace test{
00018 void main_core_func_vector_relational();
00019 }
00020
00021 namespace core{
00022 namespace function{
00025 namespace vector_relational
00026 {
00029
00034 template <typename T, template <typename> class vecType>
00035 GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThan
00036 (
00037 vecType<T> const & x,
00038 vecType<T> const & y
00039 )
00040 {
00041 GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
00042 "Invalid template instantiation of 'lessThan', GLM vector types required");
00043 GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
00044 "Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
00045
00046 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00047 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00048 Result[i] = x[i] < y[i];
00049
00050 return Result;
00051 }
00052
00057 template <typename T, template <typename> class vecType>
00058 GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThanEqual
00059 (
00060 vecType<T> const & x,
00061 vecType<T> const & y
00062 )
00063 {
00064 GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
00065 "Invalid template instantiation of 'lessThanEqual', GLM vector types required");
00066 GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
00067 "Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
00068
00069 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00070 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00071 Result[i] = x[i] <= y[i];
00072 return Result;
00073 }
00074
00079 template <typename T, template <typename> class vecType>
00080 GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThan
00081 (
00082 vecType<T> const & x,
00083 vecType<T> const & y
00084 )
00085 {
00086 GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
00087 "Invalid template instantiation of 'greaterThan', GLM vector types required");
00088 GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
00089 "Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
00090
00091 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00092 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00093 Result[i] = x[i] > y[i];
00094 return Result;
00095 }
00096
00101 template <typename T, template <typename> class vecType>
00102 GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThanEqual
00103 (
00104 vecType<T> const & x,
00105 vecType<T> const & y
00106 )
00107 {
00108 GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
00109 "Invalid template instantiation of 'greaterThanEqual', GLM vector types required");
00110 GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
00111 "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
00112
00113 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00114 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00115 Result[i] = x[i] >= y[i];
00116 return Result;
00117 }
00118
00123 template <typename T, template <typename> class vecType>
00124 GLM_FUNC_QUALIFIER typename vecType<T>::bool_type equal
00125 (
00126 vecType<T> const & x,
00127 vecType<T> const & y
00128 )
00129 {
00130 GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
00131 "Invalid template instantiation of 'equal', GLM vector types required");
00132
00133 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00134 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00135 Result[i] = x[i] == y[i];
00136 return Result;
00137 }
00138
00143 template <typename T, template <typename> class vecType>
00144 GLM_FUNC_QUALIFIER typename vecType<T>::bool_type notEqual
00145 (
00146 vecType<T> const & x,
00147 vecType<T> const & y
00148 )
00149 {
00150 GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES,
00151 "Invalid template instantiation of 'notEqual', GLM vector types required");
00152
00153 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00154 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00155 Result[i] = x[i] != y[i];
00156 return Result;
00157 }
00158
00163 template <template <typename> class vecType>
00164 GLM_FUNC_QUALIFIER bool any(vecType<bool> const & v)
00165 {
00166 GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES,
00167 "Invalid template instantiation of 'any', GLM boolean vector types required");
00168
00169 bool Result = false;
00170 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00171 Result = Result || v[i];
00172 return Result;
00173 }
00174
00179 template <template <typename> class vecType>
00180 GLM_FUNC_QUALIFIER bool all(vecType<bool> const & v)
00181 {
00182 GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES,
00183 "Invalid template instantiation of 'all', GLM boolean vector types required");
00184
00185 bool Result = true;
00186 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00187 Result = Result && v[i];
00188 return Result;
00189 }
00190
00196 template <template <typename> class vecType>
00197 GLM_FUNC_QUALIFIER vecType<bool> not_(vecType<bool> const & v)
00198 {
00199 GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES,
00200 "Invalid template instantiation of 'not_', GLM vector types required");
00201
00202 typename vecType<bool>::bool_type Result(vecType<bool>::null);
00203 for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
00204 Result[i] = !v[i];
00205 return Result;
00206 }
00207
00209
00210 }
00211 }
00212 }
00213
00214 using namespace core::function::vector_relational;
00215 }
00216
00217 #include "func_vector_relational.inl"
00218
00219 #endif//glm_core_func_vector_relational