mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 19:34:36 +00:00
126 lines
12 KiB
HTML
126 lines
12 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>GLM: 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.6.1 -->
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<h1>func_common.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
|
|
<a name="l00002"></a>00002 <span class="comment">// OpenGL Mathematics Copyright (c) 2005 - 2009 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 : 2008-03-08</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.h</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="keyword">namespace </span>glm
|
|
<a name="l00014"></a>00014 {
|
|
<a name="l00015"></a>00015 <span class="keyword">namespace </span>test{
|
|
<a name="l00016"></a>00016 <span class="keywordtype">void</span> main_core_func_common();
|
|
<a name="l00017"></a>00017 }<span class="comment">//namespace test</span>
|
|
<a name="l00018"></a>00018
|
|
<a name="l00019"></a><a class="code" href="a00125.html">00019</a> <span class="keyword">namespace </span>core{
|
|
<a name="l00020"></a><a class="code" href="a00126.html">00020</a> <span class="keyword">namespace </span>function{
|
|
<a name="l00022"></a><a class="code" href="a00127.html">00022</a> <span class="keyword">namespace </span>common{
|
|
<a name="l00023"></a>00023
|
|
<a name="l00026"></a>00026 <span class="keyword">template</span> <<span class="keyword">typename</span> genFIType>
|
|
<a name="l00027"></a>00027 genFIType <a class="code" href="a00127.html#a5206aa60ce61ad1d7d1b53d5028c7a2a" title="Returns x if x &gt;= 0; otherwise, it returns -x.">abs</a>(genFIType <span class="keyword">const</span> & x);
|
|
<a name="l00028"></a>00028
|
|
<a name="l00031"></a>00031 <span class="keyword">template</span> <<span class="keyword">typename</span> genFIType>
|
|
<a name="l00032"></a>00032 genFIType <a class="code" href="a00127.html#a992a45e46af5dc123e688808d1bae48f" 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> & x);
|
|
<a name="l00033"></a>00033
|
|
<a name="l00036"></a>00036 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00037"></a>00037 genType <a class="code" href="a00127.html#a4206a98e812c2bd4801e4d299c83f6c7" 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> & x);
|
|
<a name="l00038"></a>00038
|
|
<a name="l00042"></a>00042 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00043"></a>00043 genType <a class="code" href="a00127.html#a2303d814e83b34ee2d5f34fcff7fa275" title="Returns a value equal to the nearest integer to x whose absolute value is not larger...">trunc</a>(genType <span class="keyword">const</span> & x);
|
|
<a name="l00044"></a>00044
|
|
<a name="l00051"></a>00051 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00052"></a>00052 genType <a class="code" href="a00127.html#aa4cb0836cd9457ac6cedd3366333b16f" title="Returns a value equal to the nearest integer to x.">round</a>(genType <span class="keyword">const</span> & x);
|
|
<a name="l00053"></a>00053
|
|
<a name="l00058"></a>00058 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00059"></a>00059 genType <a class="code" href="a00127.html#a656ce625ba1dc1d137bfc7cc7b2ab50b" title="Returns a value equal to the nearest integer to x.">roundEven</a>(genType <span class="keyword">const</span> & x);
|
|
<a name="l00060"></a>00060
|
|
<a name="l00064"></a>00064 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00065"></a>00065 genType <a class="code" href="a00127.html#a828376ee58b02d80d91eee97c50323f8" 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> & x);
|
|
<a name="l00066"></a>00066
|
|
<a name="l00069"></a>00069 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00070"></a>00070 genType <a class="code" href="a00127.html#a67dda5fd839bc489827be9e225847a45" title="Return x - floor(x).">fract</a>(genType <span class="keyword">const</span> & x);
|
|
<a name="l00071"></a>00071
|
|
<a name="l00075"></a>00075 <span class="keyword">template</span> <<span class="keyword">typename</span> genTypeT, <span class="keyword">typename</span> genTypeU>
|
|
<a name="l00076"></a>00076 genTypeT <a class="code" href="a00127.html#aa2c0e987e6af82b8088aea0f8d30a9ab" title="Modulus.">mod</a>(
|
|
<a name="l00077"></a>00077 genTypeT <span class="keyword">const</span> & x,
|
|
<a name="l00078"></a>00078 genTypeU <span class="keyword">const</span> & y);
|
|
<a name="l00079"></a>00079
|
|
<a name="l00085"></a>00085 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00086"></a>00086 genType <a class="code" href="a00127.html#a3f3cec79cc1542950cd4cddb7ab67584" title="Returns the fractional part of x and sets i to the integer part (as a whole number...">modf</a>(
|
|
<a name="l00087"></a>00087 genType <span class="keyword">const</span> & x,
|
|
<a name="l00088"></a>00088 genType & i);
|
|
<a name="l00089"></a>00089
|
|
<a name="l00092"></a>00092 <span class="keyword">template</span> <<span class="keyword">typename</span> genUIFTypeT, <span class="keyword">typename</span> genUIFTypeU>
|
|
<a name="l00093"></a>00093 genUIFTypeT <a class="code" href="a00127.html#a294d187c6a1fc420aedcec9380660244" title="Returns y if y &lt; x; otherwise, it returns x.">min</a>(
|
|
<a name="l00094"></a>00094 genUIFTypeT <span class="keyword">const</span> & x,
|
|
<a name="l00095"></a>00095 genUIFTypeU <span class="keyword">const</span> & y);
|
|
<a name="l00096"></a>00096
|
|
<a name="l00099"></a>00099 <span class="keyword">template</span> <<span class="keyword">typename</span> genUIFTypeT, <span class="keyword">typename</span> genUIFTypeU>
|
|
<a name="l00100"></a>00100 genUIFTypeT <a class="code" href="a00127.html#a56d70a4be287f0dfd43ccb3c004226ea" title="Returns y if x &lt; y; otherwise, it returns x.">max</a>(
|
|
<a name="l00101"></a>00101 genUIFTypeT <span class="keyword">const</span> & x,
|
|
<a name="l00102"></a>00102 genUIFTypeU <span class="keyword">const</span> & y);
|
|
<a name="l00103"></a>00103
|
|
<a name="l00107"></a>00107 <span class="keyword">template</span> <<span class="keyword">typename</span> genUIFTypeT, <span class="keyword">typename</span> genUIFTypeU>
|
|
<a name="l00108"></a>00108 genUIFTypeT <a class="code" href="a00127.html#acd376ba065150520e259c71f566fe189" title="Returns min(max(x, minVal), maxVal) for each component in x.">clamp</a>(
|
|
<a name="l00109"></a>00109 genUIFTypeT <span class="keyword">const</span> & x,
|
|
<a name="l00110"></a>00110 genUIFTypeU <span class="keyword">const</span> & minVal,
|
|
<a name="l00111"></a>00111 genUIFTypeU <span class="keyword">const</span> & maxVal);
|
|
<a name="l00112"></a>00112
|
|
<a name="l00136"></a>00136 <span class="comment">// \todo Test when 'a' is a boolean.</span>
|
|
<a name="l00137"></a>00137 <span class="keyword">template</span> <<span class="keyword">typename</span> genTypeT, <span class="keyword">typename</span> genTypeU>
|
|
<a name="l00138"></a>00138 genTypeT <a class="code" href="a00127.html#a11288dc43a2a1833766728a3eb81ac63">mix</a>(genTypeT <span class="keyword">const</span> & x, genTypeT <span class="keyword">const</span> & y, genTypeU <span class="keyword">const</span> & a);
|
|
<a name="l00139"></a>00139
|
|
<a name="l00142"></a>00142 <span class="keyword">template</span> <<span class="keyword">typename</span> genTypeT, <span class="keyword">typename</span> genTypeU>
|
|
<a name="l00143"></a>00143 genTypeU <a class="code" href="a00127.html#af2461174c6e77fa69aa8da4eb63e7065" title="Returns 0.0 if x &lt; edge, otherwise it returns 1.0.">step</a>(genTypeT <span class="keyword">const</span> & edge, genTypeU <span class="keyword">const</span> & x);
|
|
<a name="l00144"></a>00144
|
|
<a name="l00155"></a>00155 <span class="keyword">template</span> <<span class="keyword">typename</span> genTypeT, <span class="keyword">typename</span> genTypeU>
|
|
<a name="l00156"></a>00156 genTypeU <a class="code" href="a00127.html#ab10c5116b5fd9c57fd663fa92777d26f" title="Returns 0.0 if x &lt;= edge0 and 1.0 if x &gt;= edge1 and performs smooth Hermite...">smoothstep</a>(genTypeT <span class="keyword">const</span> & edge0, genTypeT <span class="keyword">const</span> & edge1, genTypeU <span class="keyword">const</span> & x);
|
|
<a name="l00157"></a>00157
|
|
<a name="l00164"></a>00164 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00165"></a>00165 <span class="keyword">typename</span> genType::bool_type <a class="code" href="a00127.html#a873db92807cc955cf98030c94a342d5a" title="Returns true if x holds a NaN (not a number) representation in the underlying implementation&#39;s...">isnan</a>(genType <span class="keyword">const</span> & x);
|
|
<a name="l00166"></a>00166
|
|
<a name="l00173"></a>00173 <span class="keyword">template</span> <<span class="keyword">typename</span> genType>
|
|
<a name="l00174"></a>00174 <span class="keyword">typename</span> genType::bool_type <a class="code" href="a00127.html#a7194c89cf656614f231e11c46d906465" title="Returns true if x holds a positive infinity or negative infinity representation in...">isinf</a>(genType <span class="keyword">const</span> & x);
|
|
<a name="l00175"></a>00175
|
|
<a name="l00176"></a>00176 }<span class="comment">//namespace common</span>
|
|
<a name="l00177"></a>00177 }<span class="comment">//namespace function</span>
|
|
<a name="l00178"></a>00178 }<span class="comment">//namespace core</span>
|
|
<a name="l00179"></a>00179
|
|
<a name="l00180"></a>00180 <span class="keyword">using namespace </span>core::function::common;
|
|
<a name="l00181"></a>00181 }<span class="comment">//namespace glm</span>
|
|
<a name="l00182"></a>00182
|
|
<a name="l00183"></a>00183 <span class="preprocessor">#include "func_common.inl"</span>
|
|
<a name="l00184"></a>00184
|
|
<a name="l00185"></a>00185 <span class="preprocessor">#endif//glm_core_func_common</span>
|
|
</pre></div></div>
|
|
<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Nov 16 11:23:22 2009 for GLM by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
|
|
</body>
|
|
</html>
|