glm/doc/api-0.9.2/a00051_source.html
Christophe Riccio 8d2d112180 Added API doc
2011-10-24 15:24:48 +01:00

218 lines
21 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>func_vector_relational.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo-mini.png"/></td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">func_vector_relational.hpp</div> </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00002"></a>00002 <span class="comment">// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)</span>
<a name="l00004"></a>00004 <span class="comment"></span><span class="comment">// Created : 2008-08-03</span>
<a name="l00005"></a>00005 <span class="comment">// Updated : 2008-09-09</span>
<a name="l00006"></a>00006 <span class="comment">// Licence : This source is under MIT License</span>
<a name="l00007"></a>00007 <span class="comment">// File : glm/core/func_vector_relational.hpp</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef glm_core_func_vector_relational</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define glm_core_func_vector_relational</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;_detail.hpp&quot;</span>
<a name="l00014"></a>00014
<a name="l00015"></a>00015 <span class="keyword">namespace </span>glm
<a name="l00016"></a>00016 {
<a name="l00017"></a>00017 <span class="keyword">namespace </span>core{
<a name="l00018"></a>00018 <span class="keyword">namespace </span>function{
<a name="l00021"></a><a class="code" href="a00154.html">00021</a> <span class="keyword">namespace </span>vector_relational
<a name="l00022"></a>00022 {
<a name="l00025"></a>00025
<a name="l00030"></a>00030 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00031"></a>00031 GLM_FUNC_QUALIFIER <span class="keyword">typename</span> vecType&lt;T&gt;::bool_type <a class="code" href="a00238.html#ga54e5b894f79b9c1b8f6d28fe6f986e80" title="Returns the component-wise comparison result of x &lt; y.">lessThan</a>
<a name="l00032"></a><a class="code" href="a00238.html#ga54e5b894f79b9c1b8f6d28fe6f986e80">00032</a> (
<a name="l00033"></a>00033 vecType&lt;T&gt; <span class="keyword">const</span> &amp; x,
<a name="l00034"></a>00034 vecType&lt;T&gt; <span class="keyword">const</span> &amp; y
<a name="l00035"></a>00035 )
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;T&gt; &gt;::_YES,
<a name="l00038"></a>00038 <span class="stringliteral">&quot;Invalid template instantiation of &#39;lessThan&#39;, GLM vector types required&quot;</span>);
<a name="l00039"></a>00039 GLM_STATIC_ASSERT(detail::is_bool&lt;T&gt;::_NO,
<a name="l00040"></a>00040 <span class="stringliteral">&quot;Invalid template instantiation of &#39;lessThan&#39;, GLM vector types required floating-point or integer value types vectors&quot;</span>);
<a name="l00041"></a>00041
<a name="l00042"></a>00042 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00043"></a>00043 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00044"></a>00044 Result[i] = x[i] &lt; y[i];
<a name="l00045"></a>00045
<a name="l00046"></a>00046 <span class="keywordflow">return</span> Result;
<a name="l00047"></a>00047 }
<a name="l00048"></a>00048
<a name="l00053"></a>00053 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00054"></a>00054 GLM_FUNC_QUALIFIER <span class="keyword">typename</span> vecType&lt;T&gt;::bool_type <a class="code" href="a00238.html#ga190db45f1b40202ee0716751448b119d" title="Returns the component-wise comparison of result x &lt;= y.">lessThanEqual</a>
<a name="l00055"></a><a class="code" href="a00238.html#ga190db45f1b40202ee0716751448b119d">00055</a> (
<a name="l00056"></a>00056 vecType&lt;T&gt; <span class="keyword">const</span> &amp; x,
<a name="l00057"></a>00057 vecType&lt;T&gt; <span class="keyword">const</span> &amp; y
<a name="l00058"></a>00058 )
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;T&gt; &gt;::_YES,
<a name="l00061"></a>00061 <span class="stringliteral">&quot;Invalid template instantiation of &#39;lessThanEqual&#39;, GLM vector types required&quot;</span>);
<a name="l00062"></a>00062 GLM_STATIC_ASSERT(detail::is_bool&lt;T&gt;::_NO,
<a name="l00063"></a>00063 <span class="stringliteral">&quot;Invalid template instantiation of &#39;lessThanEqual&#39;, GLM vector types required floating-point or integer value types vectors&quot;</span>);
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00066"></a>00066 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00067"></a>00067 Result[i] = x[i] &lt;= y[i];
<a name="l00068"></a>00068 <span class="keywordflow">return</span> Result;
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070
<a name="l00075"></a>00075 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00076"></a>00076 GLM_FUNC_QUALIFIER <span class="keyword">typename</span> vecType&lt;T&gt;::bool_type <a class="code" href="a00238.html#gaef35061292f337c0d788f43a3b1a26c0" title="Returns the component-wise comparison of result x &gt; y.">greaterThan</a>
<a name="l00077"></a><a class="code" href="a00238.html#gaef35061292f337c0d788f43a3b1a26c0">00077</a> (
<a name="l00078"></a>00078 vecType&lt;T&gt; <span class="keyword">const</span> &amp; x,
<a name="l00079"></a>00079 vecType&lt;T&gt; <span class="keyword">const</span> &amp; y
<a name="l00080"></a>00080 )
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;T&gt; &gt;::_YES,
<a name="l00083"></a>00083 <span class="stringliteral">&quot;Invalid template instantiation of &#39;greaterThan&#39;, GLM vector types required&quot;</span>);
<a name="l00084"></a>00084 GLM_STATIC_ASSERT(detail::is_bool&lt;T&gt;::_NO,
<a name="l00085"></a>00085 <span class="stringliteral">&quot;Invalid template instantiation of &#39;greaterThan&#39;, GLM vector types required floating-point or integer value types vectors&quot;</span>);
<a name="l00086"></a>00086
<a name="l00087"></a>00087 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00088"></a>00088 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00089"></a>00089 Result[i] = x[i] &gt; y[i];
<a name="l00090"></a>00090 <span class="keywordflow">return</span> Result;
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092
<a name="l00097"></a>00097 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00098"></a>00098 GLM_FUNC_QUALIFIER <span class="keyword">typename</span> vecType&lt;T&gt;::bool_type <a class="code" href="a00238.html#ga39aa8024d619850c81a685a4905177df" title="Returns the component-wise comparison of result x &gt;= y.">greaterThanEqual</a>
<a name="l00099"></a><a class="code" href="a00238.html#ga39aa8024d619850c81a685a4905177df">00099</a> (
<a name="l00100"></a>00100 vecType&lt;T&gt; <span class="keyword">const</span> &amp; x,
<a name="l00101"></a>00101 vecType&lt;T&gt; <span class="keyword">const</span> &amp; y
<a name="l00102"></a>00102 )
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;T&gt; &gt;::_YES,
<a name="l00105"></a>00105 <span class="stringliteral">&quot;Invalid template instantiation of &#39;greaterThanEqual&#39;, GLM vector types required&quot;</span>);
<a name="l00106"></a>00106 GLM_STATIC_ASSERT(detail::is_bool&lt;T&gt;::_NO,
<a name="l00107"></a>00107 <span class="stringliteral">&quot;Invalid template instantiation of &#39;greaterThanEqual&#39;, GLM vector types required floating-point or integer value types vectors&quot;</span>);
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00110"></a>00110 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00111"></a>00111 Result[i] = x[i] &gt;= y[i];
<a name="l00112"></a>00112 <span class="keywordflow">return</span> Result;
<a name="l00113"></a>00113 }
<a name="l00114"></a>00114
<a name="l00119"></a>00119 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00120"></a>00120 GLM_FUNC_QUALIFIER <span class="keyword">typename</span> vecType&lt;T&gt;::bool_type <a class="code" href="a00238.html#ga811015178de53f628610f2036946fbb9" title="Returns the component-wise comparison of result x == y.">equal</a>
<a name="l00121"></a><a class="code" href="a00238.html#ga811015178de53f628610f2036946fbb9">00121</a> (
<a name="l00122"></a>00122 vecType&lt;T&gt; <span class="keyword">const</span> &amp; x,
<a name="l00123"></a>00123 vecType&lt;T&gt; <span class="keyword">const</span> &amp; y
<a name="l00124"></a>00124 )
<a name="l00125"></a>00125 {
<a name="l00126"></a>00126 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;T&gt; &gt;::_YES,
<a name="l00127"></a>00127 <span class="stringliteral">&quot;Invalid template instantiation of &#39;equal&#39;, GLM vector types required&quot;</span>);
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00130"></a>00130 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00131"></a>00131 Result[i] = x[i] == y[i];
<a name="l00132"></a>00132 <span class="keywordflow">return</span> Result;
<a name="l00133"></a>00133 }
<a name="l00134"></a>00134
<a name="l00139"></a>00139 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00140"></a>00140 GLM_FUNC_QUALIFIER <span class="keyword">typename</span> vecType&lt;T&gt;::bool_type <a class="code" href="a00238.html#ga62979ef5be1ad914f866074b900abdcd" title="Returns the component-wise comparison of result x != y.">notEqual</a>
<a name="l00141"></a><a class="code" href="a00238.html#ga62979ef5be1ad914f866074b900abdcd">00141</a> (
<a name="l00142"></a>00142 vecType&lt;T&gt; <span class="keyword">const</span> &amp; x,
<a name="l00143"></a>00143 vecType&lt;T&gt; <span class="keyword">const</span> &amp; y
<a name="l00144"></a>00144 )
<a name="l00145"></a>00145 {
<a name="l00146"></a>00146 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;T&gt; &gt;::_YES,
<a name="l00147"></a>00147 <span class="stringliteral">&quot;Invalid template instantiation of &#39;notEqual&#39;, GLM vector types required&quot;</span>);
<a name="l00148"></a>00148
<a name="l00149"></a>00149 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00150"></a>00150 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00151"></a>00151 Result[i] = x[i] != y[i];
<a name="l00152"></a>00152 <span class="keywordflow">return</span> Result;
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154
<a name="l00159"></a>00159 <span class="keyword">template</span> &lt;<span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00160"></a><a class="code" href="a00238.html#gaa478a7966a4e6550bf0ee58ea8271074">00160</a> GLM_FUNC_QUALIFIER <span class="keywordtype">bool</span> <a class="code" href="a00238.html#gaa478a7966a4e6550bf0ee58ea8271074" title="Returns true if any component of x is true.">any</a>(vecType&lt;bool&gt; <span class="keyword">const</span> &amp; v)
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;bool&gt; &gt;::_YES,
<a name="l00163"></a>00163 <span class="stringliteral">&quot;Invalid template instantiation of &#39;any&#39;, GLM boolean vector types required&quot;</span>);
<a name="l00164"></a>00164
<a name="l00165"></a>00165 <span class="keywordtype">bool</span> Result = <span class="keyword">false</span>;
<a name="l00166"></a>00166 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00167"></a>00167 Result = Result || v[i];
<a name="l00168"></a>00168 <span class="keywordflow">return</span> Result;
<a name="l00169"></a>00169 }
<a name="l00170"></a>00170
<a name="l00175"></a>00175 <span class="keyword">template</span> &lt;<span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00176"></a><a class="code" href="a00238.html#ga07b92e9e7077f06fe26e417f320b0f0c">00176</a> GLM_FUNC_QUALIFIER <span class="keywordtype">bool</span> <a class="code" href="a00238.html#ga07b92e9e7077f06fe26e417f320b0f0c" title="Returns true if all components of x are true.">all</a>(vecType&lt;bool&gt; <span class="keyword">const</span> &amp; v)
<a name="l00177"></a>00177 {
<a name="l00178"></a>00178 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;bool&gt; &gt;::_YES,
<a name="l00179"></a>00179 <span class="stringliteral">&quot;Invalid template instantiation of &#39;all&#39;, GLM boolean vector types required&quot;</span>);
<a name="l00180"></a>00180
<a name="l00181"></a>00181 <span class="keywordtype">bool</span> Result = <span class="keyword">true</span>;
<a name="l00182"></a>00182 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00183"></a>00183 Result = Result &amp;&amp; v[i];
<a name="l00184"></a>00184 <span class="keywordflow">return</span> Result;
<a name="l00185"></a>00185 }
<a name="l00186"></a>00186
<a name="l00192"></a>00192 <span class="keyword">template</span> &lt;<span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>vecType&gt;
<a name="l00193"></a><a class="code" href="a00238.html#gadb3248006580ee79ebb1d358bce25ca0">00193</a> GLM_FUNC_QUALIFIER vecType&lt;bool&gt; <a class="code" href="a00238.html#gadb3248006580ee79ebb1d358bce25ca0" title="Returns the component-wise logical complement of x.">not_</a>(vecType&lt;bool&gt; <span class="keyword">const</span> &amp; v)
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195 GLM_STATIC_ASSERT(detail::is_vector&lt;vecType&lt;bool&gt; &gt;::_YES,
<a name="l00196"></a>00196 <span class="stringliteral">&quot;Invalid template instantiation of &#39;not_&#39;, GLM vector types required&quot;</span>);
<a name="l00197"></a>00197
<a name="l00198"></a>00198 <span class="keyword">typename</span> vecType&lt;bool&gt;::bool_type Result(vecType&lt;bool&gt;::null);
<a name="l00199"></a>00199 <span class="keywordflow">for</span>(<span class="keyword">typename</span> vecType&lt;bool&gt;::size_type i = 0; i &lt; vecType&lt;bool&gt;::value_size(); ++i)
<a name="l00200"></a>00200 Result[i] = !v[i];
<a name="l00201"></a>00201 <span class="keywordflow">return</span> Result;
<a name="l00202"></a>00202 }
<a name="l00203"></a>00203
<a name="l00205"></a>00205
<a name="l00206"></a>00206 }<span class="comment">//namespace vector_relational</span>
<a name="l00207"></a>00207 }<span class="comment">//namespace function</span>
<a name="l00208"></a>00208 }<span class="comment">//namespace core</span>
<a name="l00209"></a>00209
<a name="l00210"></a>00210 <span class="keyword">using namespace </span>core::function::vector_relational;
<a name="l00211"></a>00211 }<span class="comment">//namespace glm</span>
<a name="l00212"></a>00212
<a name="l00213"></a>00213 <span class="preprocessor">#include &quot;func_vector_relational.inl&quot;</span>
<a name="l00214"></a>00214
<a name="l00215"></a>00215 <span class="preprocessor">#endif//glm_core_func_vector_relational</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>