glm/doc/html/a00120_source.html

244 lines
41 KiB
HTML
Raw Normal View History

2010-04-29 10:54:07 +00:00
<!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: vecx.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&nbsp;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&nbsp;List</span></a></li>
</ul>
</div>
<h1>vecx.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 : 2007-02-21</span>
<a name="l00005"></a>00005 <span class="comment">// Updated : 2007-02-21</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/gtx/vecx.h</span>
<a name="l00009"></a>00009 <span class="comment"></span><span class="comment">// Dependency:</span>
<a name="l00010"></a>00010 <span class="comment">// - GLM core</span>
<a name="l00012"></a>00012 <span class="comment"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#ifndef glm_gtx_vecx</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define glm_gtx_vecx</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00016"></a>00016 <span class="keyword">namespace </span>glm{
<a name="l00017"></a>00017 <span class="keyword">namespace </span>detail{
<a name="l00018"></a>00018
<a name="l00019"></a>00019 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N&gt;
<a name="l00020"></a>00020 <span class="keyword">class </span>_bvecxGTX
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022 <span class="keyword">private</span>:
<a name="l00023"></a>00023 <span class="keywordtype">bool</span> data[N];
<a name="l00024"></a>00024
<a name="l00025"></a>00025 <span class="keyword">public</span>:
<a name="l00026"></a>00026 <span class="keyword">typedef</span> <span class="keywordtype">bool</span> value_type;
<a name="l00027"></a>00027 <span class="keyword">typedef</span> <span class="keywordtype">int</span> size_type;
<a name="l00028"></a>00028 <span class="keyword">static</span> <span class="keyword">const</span> size_type value_size;
<a name="l00029"></a>00029 <span class="keyword">static</span> <span class="keyword">const</span> size_type col_size;
<a name="l00030"></a>00030 <span class="keyword">static</span> <span class="keyword">const</span> size_type row_size;
<a name="l00031"></a>00031
<a name="l00032"></a>00032 <span class="comment">// Common constructors</span>
<a name="l00033"></a>00033 _bvecxGTX();
<a name="l00034"></a>00034 _bvecxGTX(<span class="keyword">const</span> _bvecxGTX&amp; v);
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="comment">// Accesses</span>
<a name="l00037"></a>00037 <span class="keywordtype">bool</span>&amp; operator[](<span class="keywordtype">int</span> i);
<a name="l00038"></a>00038 <span class="keywordtype">bool</span> operator[](<span class="keywordtype">int</span> i) <span class="keyword">const</span>;
<a name="l00039"></a>00039 operator bool*();
<a name="l00040"></a>00040 operator const bool*() <span class="keyword">const</span>;
<a name="l00041"></a>00041
<a name="l00042"></a>00042 <span class="comment">// Bool constructors</span>
<a name="l00043"></a>00043 <span class="keyword">explicit</span> _bvecxGTX(<span class="keyword">const</span> <span class="keywordtype">bool</span> a);
<a name="l00044"></a>00044
<a name="l00045"></a>00045 <span class="comment">// Operators</span>
<a name="l00046"></a>00046 _bvecxGTX&lt;N&gt;&amp; operator=(<span class="keyword">const</span> _bvecxGTX&lt;N&gt;&amp; v);
<a name="l00047"></a>00047 _bvecxGTX&lt;N&gt; operator! () <span class="keyword">const</span>;
<a name="l00048"></a>00048 };
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T = <span class="keywordtype">float</span>&gt;
<a name="l00051"></a>00051 <span class="keyword">class </span>_xvecxGTX
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053 <span class="keyword">private</span>:
<a name="l00054"></a>00054 T data[N];
<a name="l00055"></a>00055
<a name="l00056"></a>00056 <span class="keyword">public</span>:
<a name="l00057"></a>00057 <span class="keyword">typedef</span> T value_type;
<a name="l00058"></a>00058 <span class="keyword">typedef</span> <span class="keywordtype">int</span> size_type;
<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keyword">const</span> size_type value_size;
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="comment">// Common constructors</span>
<a name="l00062"></a>00062 _xvecxGTX();
<a name="l00063"></a>00063 _xvecxGTX(<span class="keyword">const</span> _xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="comment">// Accesses</span>
<a name="l00066"></a>00066 T&amp; operator[](<span class="keywordtype">int</span> i);
<a name="l00067"></a>00067 T operator[](<span class="keywordtype">int</span> i) <span class="keyword">const</span>;
<a name="l00068"></a>00068 operator T*();
<a name="l00069"></a>00069 operator const T*() <span class="keyword">const</span>;
<a name="l00070"></a>00070
<a name="l00071"></a>00071 <span class="comment">// T constructors</span>
<a name="l00072"></a>00072 <span class="keyword">explicit</span> _xvecxGTX(<span class="keyword">const</span> T x);
<a name="l00073"></a>00073
<a name="l00074"></a>00074 <span class="comment">// Unary updatable operators</span>
<a name="l00075"></a>00075 _xvecxGTX&lt;N, T&gt;&amp; operator= (<span class="keyword">const</span> _xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00076"></a>00076 _xvecxGTX&lt;N, T&gt;&amp; operator+=(<span class="keyword">const</span> T s);
<a name="l00077"></a>00077 _xvecxGTX&lt;N, T&gt;&amp; operator+=(<span class="keyword">const</span> _xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00078"></a>00078 _xvecxGTX&lt;N, T&gt;&amp; operator-=(<span class="keyword">const</span> T s);
<a name="l00079"></a>00079 _xvecxGTX&lt;N, T&gt;&amp; operator-=(<span class="keyword">const</span> _xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00080"></a>00080 _xvecxGTX&lt;N, T&gt;&amp; operator*=(<span class="keyword">const</span> T s);
<a name="l00081"></a>00081 _xvecxGTX&lt;N, T&gt;&amp; operator*=(<span class="keyword">const</span> _xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00082"></a>00082 _xvecxGTX&lt;N, T&gt;&amp; operator/=(<span class="keyword">const</span> T s);
<a name="l00083"></a>00083 _xvecxGTX&lt;N, T&gt;&amp; operator/=(<span class="keyword">const</span> _xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00084"></a>00084 _xvecxGTX&lt;N, T&gt;&amp; operator++();
<a name="l00085"></a>00085 _xvecxGTX&lt;N, T&gt;&amp; operator--();
<a name="l00086"></a>00086 };
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <span class="comment">// Binary operators</span>
<a name="l00089"></a>00089 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00090"></a>00090 detail::_xvecxGTX&lt;N, T&gt; operator+ (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v, <span class="keyword">const</span> T s);
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00093"></a>00093 detail::_xvecxGTX&lt;N, T&gt; operator+ (<span class="keyword">const</span> T s, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00096"></a>00096 detail::_xvecxGTX&lt;N, T&gt; operator+ (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v1, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v2);
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00099"></a>00099 detail::_xvecxGTX&lt;N, T&gt; operator- (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v, <span class="keyword">const</span> T s);
<a name="l00100"></a>00100
<a name="l00101"></a>00101 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00102"></a>00102 detail::_xvecxGTX&lt;N, T&gt; operator- (<span class="keyword">const</span> T s, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00103"></a>00103
<a name="l00104"></a>00104 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00105"></a>00105 detail::_xvecxGTX&lt;N, T&gt; operator- (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v1, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v2);
<a name="l00106"></a>00106
<a name="l00107"></a>00107 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00108"></a>00108 detail::_xvecxGTX&lt;N, T&gt; operator* (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v, <span class="keyword">const</span> T s);
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00111"></a>00111 detail::_xvecxGTX&lt;N, T&gt; operator* (<span class="keyword">const</span> T s, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00114"></a>00114 detail::_xvecxGTX&lt;N, T&gt; operator* (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v1, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v2);
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00117"></a>00117 detail::_xvecxGTX&lt;N, T&gt; operator/ (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v, <span class="keyword">const</span> T s);
<a name="l00118"></a>00118
<a name="l00119"></a>00119 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00120"></a>00120 detail::_xvecxGTX&lt;N, T&gt; operator/ (<span class="keyword">const</span> T s, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00121"></a>00121
<a name="l00122"></a>00122 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00123"></a>00123 detail::_xvecxGTX&lt;N, T&gt; operator/ (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v1, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v2);
<a name="l00124"></a>00124
<a name="l00125"></a>00125 <span class="comment">// Unary constant operators</span>
<a name="l00126"></a>00126 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00127"></a>00127 <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt; operator- (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v);
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00130"></a>00130 <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt; operator-- (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v, <span class="keywordtype">int</span>);
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt;
<a name="l00133"></a>00133 <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt; operator++ (<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; v, <span class="keywordtype">int</span>);
<a name="l00134"></a>00134
<a name="l00135"></a>00135 }<span class="comment">//namespace detail</span>
<a name="l00136"></a>00136
<a name="l00137"></a>00137 <span class="keyword">namespace </span>gtx
<a name="l00138"></a>00138 {
<a name="l00140"></a><a class="code" href="a00215.html">00140</a> <span class="keyword">namespace </span>vecx
<a name="l00141"></a>00141 {
<a name="l00142"></a>00142 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keywordtype">int</span> N&gt;
<a name="l00143"></a>00143 <span class="keyword">struct </span>vec
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145 <span class="keyword">typedef</span> detail::_xvecxGTX&lt;N, T&gt; type;
<a name="l00146"></a>00146 };
<a name="l00147"></a>00147
<a name="l00148"></a>00148 <span class="comment">// Trigonometric Functions</span>
<a name="l00149"></a>00149 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; radiansGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; <a class="code" href="a00132.html#a2dc092f93e998e01c1cfdaef817ca926" title="Converts radians to degrees and returns the result.">degrees</a>); <span class="comment">//&lt; \brief Converts degrees to radians and returns the result. (From GLM_GTX_vecx extension)</span>
<a name="l00150"></a>00150 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; degreesGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; <a class="code" href="a00132.html#a40251a4a07049e7fdcbf155c3cc6d32a" title="Converts degrees to radians and returns the result.">radians</a>); <span class="comment">//&lt; \brief Converts radians to degrees and returns the result. (From GLM_GTX_vecx extension)</span>
<a name="l00151"></a>00151 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; sinGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; angle); <span class="comment">//&lt; \brief The standard trigonometric sine function. The values returned by this function will range from [-1, 1]. (From GLM_GTX_vecx extension)</span>
<a name="l00152"></a>00152 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; cosGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; angle); <span class="comment">//&lt; \brief The standard trigonometric cosine function. The values returned by this function will range from [-1, 1]. (From GLM_GTX_vecx extension)</span>
<a name="l00153"></a>00153 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; tanGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; angle); <span class="comment">//&lt; \brief The standard trigonometric tangent function. (From GLM_GTX_vecx extension)</span>
<a name="l00154"></a>00154 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; asinGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Arc sine. Returns an angle whose sine is x. The range of values returned by this function is [-PI/2, PI/2]. Results are undefined if |x| &gt; 1. (From GLM_GTX_vecx extension)</span>
<a name="l00155"></a>00155 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; acosGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Arc cosine. Returns an angle whose sine is x. The range of values returned by this function is [0, PI]. Results are undefined if |x| &gt; 1. (From GLM_GTX_vecx extension)</span>
<a name="l00156"></a>00156 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; atanGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_vecx extension)</span>
<a name="l00157"></a>00157 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; atanGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y_over_x); <span class="comment">//&lt; \brief Arc tangent. Returns an angle whose tangent is y_over_x. The range of values returned by this function is [-PI/2, PI/2]. (From GLM_GTX_vecx extension)</span>
<a name="l00158"></a>00158
<a name="l00159"></a>00159 <span class="comment">// Exponential Functions</span>
<a name="l00160"></a>00160 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; powGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns x raised to the y power. (From GLM_GTX_vecx extension)</span>
<a name="l00161"></a>00161 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; expGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns the natural exponentiation of x, i.e., e^x. (From GLM_GTX_vecx extension)</span>
<a name="l00162"></a>00162 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; logGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns the natural logarithm of x, i.e., returns the value y which satisfies the equation x = e^y. Results are undefined if x &lt;= 0. (From GLM_GTX_vecx extension)</span>
<a name="l00163"></a>00163 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; exp2GTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns 2 raised to the x power. (From GLM_GTX_vecx extension)</span>
<a name="l00164"></a>00164 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; log2GTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns the base 2 log of x, i.e., returns the value y, which satisfies the equation x = 2 ^ y. (From GLM_GTX_vecx extension)</span>
<a name="l00165"></a>00165 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; sqrtGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns the positive square root of x. (From GLM_GTX_vecx extension)</span>
<a name="l00166"></a>00166 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; inversesqrtGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns the reciprocal of the positive square root of x. (From GLM_GTX_vecx extension)</span>
<a name="l00167"></a>00167
<a name="l00168"></a>00168 <span class="comment">// Common Functions</span>
<a name="l00169"></a>00169 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; absGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns x if x &gt;= 0; otherwise, it returns -x. (From GLM_GTX_vecx extension)</span>
<a name="l00170"></a>00170 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; floorGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns a value equal to the nearest integer that is less then or equal to x. (From GLM_GTX_vecx extension)</span>
<a name="l00171"></a>00171 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; ceilGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns a value equal to the nearest integer that is greater than or equal to x. (From GLM_GTX_vecx extension)</span>
<a name="l00172"></a>00172 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; fractGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Return x - floor(x). (From GLM_GTX_vecx extension)</span>
<a name="l00173"></a>00173 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; modGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, T y); <span class="comment">//&lt; \brief Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. (From GLM_GTX_vecx extension)</span>
<a name="l00174"></a>00174 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; modGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Modulus. Returns x - y * floor(x / y) for each component in x using the corresponding component of y. (From GLM_GTX_vecx extension)</span>
<a name="l00175"></a>00175 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; minGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, T y); <span class="comment">//&lt; \brief Returns y if y &lt; x; otherwise, it returns x. (From GLM_GTX_vecx extension)</span>
<a name="l00176"></a>00176 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; minGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns minimum of each component of x compared with the floating-point value y. (From GLM_GTX_vecx extension)</span>
<a name="l00177"></a>00177 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; maxGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, T y); <span class="comment">//&lt; \brief Returns y if x &lt; y; otherwise, it returns x. (From GLM_GTX_vecx extension)</span>
<a name="l00178"></a>00178 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; maxGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns maximum of each component of x compared with the floating-point value y. (From GLM_GTX_vecx extension)</span>
<a name="l00179"></a>00179 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; clampGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, T minVal, T maxVal); <span class="comment">//&lt; \brief Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal and maxVal. (From GLM_GTX_vecx extension)</span>
<a name="l00180"></a>00180 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; clampGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; minVal, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; maxVal); <span class="comment">//&lt; \brief Returns the component-wise result of min(max(x, minVal), maxVal). (From GLM_GTX_vecx extension)</span>
<a name="l00181"></a>00181 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; stepGTX(T edge, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns 0.0 if x &lt;= edge; otherwise, it returns 1.0. (From GLM_GTX_vecx extension)</span>
<a name="l00182"></a>00182 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; stepGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; edge, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns 0.0 if x &lt;= edge; otherwise, it returns 1.0. (From GLM_GTX_vecx extension)</span>
<a name="l00183"></a>00183 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; smoothstepGTX(T edge0, T edge1, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns 0.0 if x &lt;= edge0 and 1.0 if x &gt;= edge1 and performs smooth Hermite interpolation between 0 and 1 when edge0 &lt; x, edge1. (From GLM_GTX_vecx extension)</span>
<a name="l00184"></a>00184 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; smoothstepGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; edge0, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; edge1, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x);<span class="comment">//&lt; \brief Returns 0.0 if x &lt;= edge0 and 1.0 if x &gt;= edge1 and performs smooth Hermite interpolation between 0 and 1 when edge0 &lt; x, edge1. (From GLM_GTX_vecx extension)</span>
<a name="l00185"></a>00185
<a name="l00186"></a>00186 <span class="comment">// Geometric Functions</span>
<a name="l00187"></a>00187 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; T lengthGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns the length of x, i.e., sqrt(x * x). (From GLM_GTX_vecx extension)</span>
<a name="l00188"></a>00188 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; T distanceGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; p0, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; p1); <span class="comment">//&lt; \brief Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). (From GLM_GTX_vecx extension)</span>
<a name="l00189"></a>00189 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; T dotGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the dot product of x and y, i.e., result = x[0] * y[0] + x[1] * y[1]. (From GLM_GTX_vecx extension)</span>
<a name="l00190"></a>00190 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; normalizeGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x); <span class="comment">//&lt; \brief Returns a vector in the same direction as x but with length of 1. (From GLM_GTX_vecx extension)</span>
<a name="l00191"></a>00191 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; faceforwardGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; Norm, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; I, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; Nref); <span class="comment">//&lt; \brief If dot(Nref, I) &lt; 0.0, return N, otherwise, return -N. (From GLM_GTX_vecx extension)</span>
<a name="l00192"></a>00192 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; reflectGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; I, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; N); <span class="comment">//&lt; \brief For the incident vector I and surface orientation N, returns the reflection direction : result = I - 2.0 * dot(N, I) * N. (From GLM_GTX_vecx extension)</span>
<a name="l00193"></a>00193 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_xvecxGTX&lt;N, T&gt; refractGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; I, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; N, T eta); <span class="comment">//&lt; \brief For the incident vector I and surface normal N, and the ratio of indices of refraction eta, return the refraction vector. (From GLM_GTX_vecx extension)</span>
<a name="l00194"></a>00194
<a name="l00195"></a>00195 <span class="comment">// Vector Relational Functions</span>
<a name="l00196"></a>00196 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_bvecxGTX&lt;N&gt; lessThanGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x &lt; y. (From GLM_GTX_vecx extension) </span>
<a name="l00197"></a>00197 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_bvecxGTX&lt;N&gt; lessThanEqualGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x &lt;= y. (From GLM_GTX_vecx extension) </span>
<a name="l00198"></a>00198 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_bvecxGTX&lt;N&gt; greaterThanGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x &gt; y. (From GLM_GTX_vecx extension) </span>
<a name="l00199"></a>00199 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_bvecxGTX&lt;N&gt; greaterThanEqualGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x &gt;= y. (From GLM_GTX_vecx extension)</span>
<a name="l00200"></a>00200 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N&gt; detail::_bvecxGTX&lt;N&gt; equalGTX(<span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; x, <span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x == y. (From GLM_GTX_vecx extension)</span>
<a name="l00201"></a>00201 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_bvecxGTX&lt;N&gt; equalGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x == y. (From GLM_GTX_vecx extension)</span>
<a name="l00202"></a>00202 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N&gt; detail::_bvecxGTX&lt;N&gt; notEqualGTX(<span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; x, <span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x != y. (From GLM_GTX_vecx extension)</span>
<a name="l00203"></a>00203 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N, <span class="keyword">typename</span> T&gt; detail::_bvecxGTX&lt;N&gt; notEqualGTX(<span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; x, <span class="keyword">const</span> detail::_xvecxGTX&lt;N, T&gt;&amp; y); <span class="comment">//&lt; \brief Returns the component-wise compare of x != y. (From GLM_GTX_vecx extension)</span>
<a name="l00204"></a>00204 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N&gt; <span class="keywordtype">bool</span> anyGTX(<span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; x); <span class="comment">//&lt; \brief Returns true if any component of x is true. (From GLM_GTX_vecx extension)</span>
<a name="l00205"></a>00205 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N&gt; <span class="keywordtype">bool</span> allGTX(<span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; x); <span class="comment">//&lt; \brief Returns true if all component of x is true. (From GLM_GTX_vecx extension)</span>
<a name="l00206"></a>00206 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> N&gt; detail::_bvecxGTX&lt;N&gt; notGTX(<span class="keyword">const</span> detail::_bvecxGTX&lt;N&gt;&amp; v); <span class="comment">//&lt; \brief Returns the component-wise logical complement of x. (From GLM_GTX_vecx extension)</span>
<a name="l00207"></a>00207 }
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209 }
<a name="l00210"></a>00210
<a name="l00211"></a>00211 <span class="preprocessor">#define GLM_GTX_vecx namespace gtx::vecx</span>
<a name="l00212"></a>00212 <span class="preprocessor"></span><span class="preprocessor">#ifndef GLM_GTX_GLOBAL</span>
<a name="l00213"></a>00213 <span class="preprocessor"></span><span class="keyword">namespace </span>glm {<span class="keyword">using</span> GLM_GTX_vecx;}
<a name="l00214"></a>00214 <span class="preprocessor">#endif//GLM_GTX_GLOBAL</span>
<a name="l00215"></a>00215 <span class="preprocessor"></span>
<a name="l00216"></a>00216 <span class="preprocessor">#include &quot;vecx.inl&quot;</span>
<a name="l00217"></a>00217
<a name="l00218"></a>00218 <span class="preprocessor">#endif//glm_gtx_vecx</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Nov 16 11:23:23 2009 for GLM by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>