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

200 lines
20 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_common.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_common.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-03-08</span>
<a name="l00005"></a>00005 <span class="comment">// Updated : 2010-01-26</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_common.hpp</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef glm_core_func_common</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define glm_core_func_common</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;_fixes.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><a class="code" href="a00144.html">00017</a> <span class="keyword">namespace </span>core{
<a name="l00018"></a><a class="code" href="a00145.html">00018</a> <span class="keyword">namespace </span>function{
<a name="l00019"></a>00019 <span class="keyword">namespace </span>common{
<a name="l00020"></a>00020
<a name="l00023"></a>00023
<a name="l00028"></a>00028 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genFIType&gt;
<a name="l00029"></a>00029 genFIType <a class="code" href="a00238.html#ga5206aa60ce61ad1d7d1b53d5028c7a2a" title="Returns x if x &gt;= 0; otherwise, it returns -x.">abs</a>(genFIType <span class="keyword">const</span> &amp; x);
<a name="l00030"></a>00030
<a name="l00035"></a>00035 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genFIType&gt;
<a name="l00036"></a>00036 genFIType <a class="code" href="a00238.html#ga992a45e46af5dc123e688808d1bae48f" title="Returns 1.0 if x &gt; 0, 0.0 if x == 0, or -1.0 if x &lt; 0.">sign</a>(genFIType <span class="keyword">const</span> &amp; x);
<a name="l00037"></a>00037
<a name="l00042"></a>00042 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00043"></a>00043 genType <a class="code" href="a00238.html#ga4206a98e812c2bd4801e4d299c83f6c7" title="Returns a value equal to the nearest integer that is less then or equal to x.">floor</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00044"></a>00044
<a name="l00050"></a>00050 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00051"></a>00051 genType <a class="code" href="a00238.html#ga2303d814e83b34ee2d5f34fcff7fa275" title="Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolut...">trunc</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00052"></a>00052
<a name="l00061"></a>00061 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00062"></a>00062 genType <a class="code" href="a00238.html#gaa4cb0836cd9457ac6cedd3366333b16f" title="Returns a value equal to the nearest integer to x.">round</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00063"></a>00063
<a name="l00070"></a>00070 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00071"></a>00071 genType <a class="code" href="a00238.html#ga656ce625ba1dc1d137bfc7cc7b2ab50b" title="Returns a value equal to the nearest integer to x.">roundEven</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00072"></a>00072
<a name="l00078"></a>00078 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00079"></a>00079 genType <a class="code" href="a00238.html#ga828376ee58b02d80d91eee97c50323f8" title="Returns a value equal to the nearest integer that is greater than or equal to x.">ceil</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00080"></a>00080
<a name="l00085"></a>00085 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00086"></a>00086 genType <a class="code" href="a00238.html#ga67dda5fd839bc489827be9e225847a45" title="Return x - floor(x).">fract</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00087"></a>00087
<a name="l00093"></a>00093 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00094"></a>00094 genType <a class="code" href="a00238.html#ga73fa91f6041b135083b0dea6e88c7aba" title="Modulus.">mod</a>(
<a name="l00095"></a>00095 genType <span class="keyword">const</span> &amp; x,
<a name="l00096"></a>00096 genType <span class="keyword">const</span> &amp; y);
<a name="l00097"></a>00097
<a name="l00103"></a>00103 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00104"></a>00104 genType <a class="code" href="a00238.html#ga73fa91f6041b135083b0dea6e88c7aba" title="Modulus.">mod</a>(
<a name="l00105"></a>00105 genType <span class="keyword">const</span> &amp; x,
<a name="l00106"></a>00106 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; y);
<a name="l00107"></a>00107
<a name="l00115"></a>00115 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00116"></a>00116 genType <a class="code" href="a00238.html#ga3f3cec79cc1542950cd4cddb7ab67584" title="Returns the fractional part of x and sets i to the integer part (as a whole number floating point val...">modf</a>(
<a name="l00117"></a>00117 genType <span class="keyword">const</span> &amp; x,
<a name="l00118"></a>00118 genType &amp; i);
<a name="l00119"></a>00119
<a name="l00124"></a>00124 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00125"></a>00125 genType <a class="code" href="a00238.html#gacbc721d96bff24d97ed7989d35f27067" title="Returns y if y &lt; x; otherwise, it returns x.">min</a>(
<a name="l00126"></a>00126 genType <span class="keyword">const</span> &amp; x,
<a name="l00127"></a>00127 genType <span class="keyword">const</span> &amp; y);
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00130"></a>00130 genType <a class="code" href="a00238.html#gacbc721d96bff24d97ed7989d35f27067" title="Returns y if y &lt; x; otherwise, it returns x.">min</a>(
<a name="l00131"></a>00131 genType <span class="keyword">const</span> &amp; x,
<a name="l00132"></a>00132 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; y);
<a name="l00133"></a>00133
<a name="l00138"></a>00138 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00139"></a>00139 genType <a class="code" href="a00238.html#ga33a594380eeb7ac803c747298563d084" title="Returns y if x &lt; y; otherwise, it returns x.">max</a>(
<a name="l00140"></a>00140 genType <span class="keyword">const</span> &amp; x,
<a name="l00141"></a>00141 genType <span class="keyword">const</span> &amp; y);
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00144"></a>00144 genType <a class="code" href="a00238.html#ga33a594380eeb7ac803c747298563d084" title="Returns y if x &lt; y; otherwise, it returns x.">max</a>(
<a name="l00145"></a>00145 genType <span class="keyword">const</span> &amp; x,
<a name="l00146"></a>00146 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; y);
<a name="l00147"></a>00147
<a name="l00153"></a>00153 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00154"></a>00154 genType <a class="code" href="a00238.html#ga8d9331a9bd3aa06e1d10eb7fa0dbb9e5" title="Returns min(max(x, minVal), maxVal) for each component in x.">clamp</a>(
<a name="l00155"></a>00155 genType <span class="keyword">const</span> &amp; x,
<a name="l00156"></a>00156 genType <span class="keyword">const</span> &amp; minVal,
<a name="l00157"></a>00157 genType <span class="keyword">const</span> &amp; maxVal);
<a name="l00158"></a>00158
<a name="l00159"></a>00159 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00160"></a>00160 genType <a class="code" href="a00238.html#ga8d9331a9bd3aa06e1d10eb7fa0dbb9e5" title="Returns min(max(x, minVal), maxVal) for each component in x.">clamp</a>(
<a name="l00161"></a>00161 genType <span class="keyword">const</span> &amp; x,
<a name="l00162"></a>00162 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; minVal,
<a name="l00163"></a>00163 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; maxVal);
<a name="l00164"></a>00164
<a name="l00189"></a>00189 <span class="comment">// \todo Test when &#39;a&#39; is a boolean.</span>
<a name="l00190"></a>00190 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genTypeT, <span class="keyword">typename</span> genTypeU&gt;
<a name="l00191"></a>00191 genTypeT <a class="code" href="a00238.html#ga11288dc43a2a1833766728a3eb81ac63">mix</a>(genTypeT <span class="keyword">const</span> &amp; x, genTypeT <span class="keyword">const</span> &amp; y, genTypeU <span class="keyword">const</span> &amp; a);
<a name="l00192"></a>00192
<a name="l00197"></a>00197 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00198"></a>00198 genType <a class="code" href="a00238.html#gaf1c0aac0585f62db8db44e407478c434" title="Returns 0.0 if x &lt; edge, otherwise it returns 1.0.">step</a>(
<a name="l00199"></a>00199 genType <span class="keyword">const</span> &amp; edge,
<a name="l00200"></a>00200 genType <span class="keyword">const</span> &amp; x);
<a name="l00201"></a>00201
<a name="l00202"></a>00202 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00203"></a>00203 genType <a class="code" href="a00238.html#gaf1c0aac0585f62db8db44e407478c434" title="Returns 0.0 if x &lt; edge, otherwise it returns 1.0.">step</a>(
<a name="l00204"></a>00204 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; edge,
<a name="l00205"></a>00205 genType <span class="keyword">const</span> &amp; x);
<a name="l00206"></a>00206
<a name="l00219"></a>00219 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00220"></a>00220 genType <a class="code" href="a00238.html#gaec459c912160fa6d9c18acd52976bb4d" title="Returns 0.0 if x &lt;= edge0 and 1.0 if x &gt;= edge1 and performs smooth Hermite interpolation between 0 a...">smoothstep</a>(
<a name="l00221"></a>00221 genType <span class="keyword">const</span> &amp; edge0,
<a name="l00222"></a>00222 genType <span class="keyword">const</span> &amp; edge1,
<a name="l00223"></a>00223 genType <span class="keyword">const</span> &amp; x);
<a name="l00224"></a>00224
<a name="l00225"></a>00225 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00226"></a>00226 genType <a class="code" href="a00238.html#gaec459c912160fa6d9c18acd52976bb4d" title="Returns 0.0 if x &lt;= edge0 and 1.0 if x &gt;= edge1 and performs smooth Hermite interpolation between 0 a...">smoothstep</a>(
<a name="l00227"></a>00227 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; edge0,
<a name="l00228"></a>00228 <span class="keyword">typename</span> genType::value_type <span class="keyword">const</span> &amp; edge1,
<a name="l00229"></a>00229 genType <span class="keyword">const</span> &amp; x);
<a name="l00230"></a>00230
<a name="l00239"></a>00239 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00240"></a>00240 <span class="keyword">typename</span> genType::bool_type <a class="code" href="a00238.html#ga873db92807cc955cf98030c94a342d5a" title="Returns true if x holds a NaN (not a number) representation in the underlying implementation&#39;s set of...">isnan</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00241"></a>00241
<a name="l00250"></a>00250 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00251"></a>00251 <span class="keyword">typename</span> genType::bool_type <a class="code" href="a00238.html#ga7194c89cf656614f231e11c46d906465" title="Returns true if x holds a positive infinity or negative infinity representation in the underlying imp...">isinf</a>(genType <span class="keyword">const</span> &amp; x);
<a name="l00252"></a>00252
<a name="l00259"></a>00259 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType, <span class="keyword">typename</span> genIType&gt;
<a name="l00260"></a>00260 genIType <a class="code" href="a00238.html#ga2508259e7d3093603f4c6d3c132a704c" title="Returns a signed integer value representing the encoding of a floating-point value.">floatBitsToInt</a>(genType <span class="keyword">const</span> &amp; value);
<a name="l00261"></a>00261
<a name="l00268"></a>00268 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType, <span class="keyword">typename</span> genUType&gt;
<a name="l00269"></a>00269 genUType <a class="code" href="a00238.html#ga17f59f3a2dd5b93e32ff1057be188681" title="Returns a unsigned integer value representing the encoding of a floating-point value.">floatBitsToUint</a>(genType <span class="keyword">const</span> &amp; value);
<a name="l00270"></a>00270
<a name="l00279"></a>00279 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType, <span class="keyword">typename</span> genIType&gt;
<a name="l00280"></a>00280 genType <a class="code" href="a00238.html#ga3b76eab7091983e936c894b1976e90be" title="Returns a floating-point value corresponding to a signed integer encoding of a floating-point value...">intBitsToFloat</a>(genIType <span class="keyword">const</span> &amp; value);
<a name="l00281"></a>00281
<a name="l00290"></a>00290 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType, <span class="keyword">typename</span> genUType&gt;
<a name="l00291"></a>00291 genType <a class="code" href="a00238.html#ga1a38039b00f182b6b22e909ea5a87bab" title="Returns a floating-point value corresponding to a unsigned integer encoding of a floating-point value...">uintBitsToFloat</a>(genUType <span class="keyword">const</span> &amp; value);
<a name="l00292"></a>00292
<a name="l00297"></a>00297 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType&gt;
<a name="l00298"></a>00298 genType <a class="code" href="a00238.html#gad0278428ad872e7be378c3b2ad66b0ba" title="Computes and returns a * b + c.">fma</a>(genType <span class="keyword">const</span> &amp; a, genType <span class="keyword">const</span> &amp; b, genType <span class="keyword">const</span> &amp; c);
<a name="l00299"></a>00299
<a name="l00312"></a>00312 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType, <span class="keyword">typename</span> genIType&gt;
<a name="l00313"></a>00313 genType <a class="code" href="a00238.html#ga51135c18fa3b70b67478e546258caa64" title="Splits x into a floating-point significand in the range [0.5, 1.0) and an integral exponent of two...">frexp</a>(genType <span class="keyword">const</span> &amp; x, genIType &amp; <a class="code" href="a00238.html#gac96b81360552e233031fd06390576ebf" title="Returns the natural exponentiation of x, i.e., e^x.">exp</a>);
<a name="l00314"></a>00314
<a name="l00324"></a>00324 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> genType, <span class="keyword">typename</span> genIType&gt;
<a name="l00325"></a>00325 genType <a class="code" href="a00238.html#gaa99c16ada9e61cca03a8a00938a3c330" title="Builds a floating-point number from x and the corresponding integral exponent of two in exp...">ldexp</a>(genType <span class="keyword">const</span> &amp; x, genIType <span class="keyword">const</span> &amp; exp);
<a name="l00326"></a>00326
<a name="l00328"></a>00328 }<span class="comment">//namespace common</span>
<a name="l00329"></a>00329 }<span class="comment">//namespace function</span>
<a name="l00330"></a>00330 }<span class="comment">//namespace core</span>
<a name="l00331"></a>00331
<a name="l00332"></a>00332 <span class="keyword">using namespace </span>core::function::common;
<a name="l00333"></a>00333 }<span class="comment">//namespace glm</span>
<a name="l00334"></a>00334
<a name="l00335"></a>00335 <span class="preprocessor">#include &quot;func_common.inl&quot;</span>
<a name="l00336"></a>00336
<a name="l00337"></a>00337 <span class="preprocessor">#endif//glm_core_func_common</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>