Home | History | Annotate | Download | only in renderscript
      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      2 <html xmlns="http://www.w3.org/1999/xhtml">
      3 <head>
      4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
      5 
      6 <title>/usr/local/google/home/srhines/android_trees/jb-mr2-dev/frameworks/rs/scriptc/rs_quaternion.rsh Source File</title>
      7 <link href="tabs.css" rel="stylesheet" type="text/css"/>
      8 <link href="doxygen.css" rel="stylesheet" type="text/css" />
      9 
     10 
     11 
     12 </head>
     13 <body>
     14 <div id="top"><!-- do not remove this div! -->
     15 
     16 
     17 <!-- Generated by Doxygen 1.7.5.1 -->
     18   <div id="navrow1" class="tabs">
     19     <ul class="tablist">
     20       <li><a href="index.html"><span>Overview</span></a></li>
     21       <li class="current"><a href="globals.html"><span>Globals</span></a></li>
     22       <li><a href="annotated.html"><span>Structs</span></a></li>
     23     </ul>
     24   </div>
     25 <div class="header">
     26   <div class="headertitle">
     27 <div class="title">/usr/local/google/home/srhines/android_trees/jb-mr2-dev/frameworks/rs/scriptc/rs_quaternion.rsh</div>  </div>
     28 </div>
     29 <div class="contents">
     30 <a href="rs__quaternion_8rsh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
     31 <a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2011 The Android Open Source Project</span>
     32 <a name="l00003"></a>00003 <span class="comment"> *</span>
     33 <a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
     34 <a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
     35 <a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span>
     36 <a name="l00007"></a>00007 <span class="comment"> *</span>
     37 <a name="l00008"></a>00008 <span class="comment"> *      http://www.apache.org/licenses/LICENSE-2.0</span>
     38 <a name="l00009"></a>00009 <span class="comment"> *</span>
     39 <a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
     40 <a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
     41 <a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
     42 <a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
     43 <a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span>
     44 <a name="l00015"></a>00015 <span class="comment"> */</span>
     45 <a name="l00016"></a>00016 
     46 <a name="l00023"></a>00023 <span class="preprocessor">#ifndef __RS_QUATERNION_RSH__</span>
     47 <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define __RS_QUATERNION_RSH__</span>
     48 <a name="l00025"></a>00025 <span class="preprocessor"></span>
     49 <a name="l00026"></a>00026 
     50 <a name="l00034"></a>00034 <span class="keyword">static</span> <span class="keywordtype">void</span> __attribute__((overloadable))
     51 <a name="l00035"></a><a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">00035</a> <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, <span class="keywordtype">float</span> w, <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z) {
     52 <a name="l00036"></a>00036     q-&gt;w = w;
     53 <a name="l00037"></a>00037     q-&gt;x = x;
     54 <a name="l00038"></a>00038     q-&gt;y = y;
     55 <a name="l00039"></a>00039     q-&gt;z = z;
     56 <a name="l00040"></a>00040 }
     57 <a name="l00041"></a>00041 
     58 <a name="l00047"></a>00047 <span class="keyword">static</span> <span class="keywordtype">void</span> __attribute__((overloadable))
     59 <a name="l00048"></a><a class="code" href="rs__quaternion_8rsh.html#a249782133e54f13a8096d1fbe295714d">00048</a> <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, const <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *rhs) {
     60 <a name="l00049"></a>00049     q-&gt;w = rhs-&gt;w;
     61 <a name="l00050"></a>00050     q-&gt;x = rhs-&gt;x;
     62 <a name="l00051"></a>00051     q-&gt;y = rhs-&gt;y;
     63 <a name="l00052"></a>00052     q-&gt;z = rhs-&gt;z;
     64 <a name="l00053"></a>00053 }
     65 <a name="l00054"></a>00054 
     66 <a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">void</span> __attribute__((overloadable))
     67 <a name="l00061"></a><a class="code" href="rs__quaternion_8rsh.html#a4f3d214912facf72f6a6d57e95aa3c3b">00061</a> <a class="code" href="rs__quaternion_8rsh.html#a4f3d214912facf72f6a6d57e95aa3c3b">rsQuaternionMultiply</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, <span class="keywordtype">float</span> s) {
     68 <a name="l00062"></a>00062     q-&gt;w *= s;
     69 <a name="l00063"></a>00063     q-&gt;x *= s;
     70 <a name="l00064"></a>00064     q-&gt;y *= s;
     71 <a name="l00065"></a>00065     q-&gt;z *= s;
     72 <a name="l00066"></a>00066 }
     73 <a name="l00067"></a>00067 
     74 <a name="l00073"></a>00073 <span class="keyword">static</span> <span class="keywordtype">void</span>
     75 <a name="l00074"></a><a class="code" href="rs__quaternion_8rsh.html#a5e6e493b9917336b0d9118fdd4e91444">00074</a> <a class="code" href="rs__quaternion_8rsh.html#a5e6e493b9917336b0d9118fdd4e91444">rsQuaternionAdd</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, <span class="keyword">const</span> <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *rhs) {
     76 <a name="l00075"></a>00075     q-&gt;w *= rhs-&gt;w;
     77 <a name="l00076"></a>00076     q-&gt;x *= rhs-&gt;x;
     78 <a name="l00077"></a>00077     q-&gt;y *= rhs-&gt;y;
     79 <a name="l00078"></a>00078     q-&gt;z *= rhs-&gt;z;
     80 <a name="l00079"></a>00079 }
     81 <a name="l00080"></a>00080 
     82 <a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keywordtype">void</span>
     83 <a name="l00090"></a><a class="code" href="rs__quaternion_8rsh.html#aa72a43cf3d7b5924de1ddfaa5766db09">00090</a> <a class="code" href="rs__quaternion_8rsh.html#aa72a43cf3d7b5924de1ddfaa5766db09">rsQuaternionLoadRotateUnit</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, <span class="keywordtype">float</span> rot, <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z) {
     84 <a name="l00091"></a>00091     rot *= (float)(M_PI / 180.0f) * 0.5f;
     85 <a name="l00092"></a>00092     <span class="keywordtype">float</span> c = <a class="code" href="rs__cl_8rsh.html#a8eec7aeb4b0c46b06cbcd1a3ac3e6f05">cos</a>(rot);
     86 <a name="l00093"></a>00093     <span class="keywordtype">float</span> s = <a class="code" href="rs__cl_8rsh.html#a8c8cd526b44eb55aede77cf659f24306">sin</a>(rot);
     87 <a name="l00094"></a>00094 
     88 <a name="l00095"></a>00095     q-&gt;w = c;
     89 <a name="l00096"></a>00096     q-&gt;x = x * s;
     90 <a name="l00097"></a>00097     q-&gt;y = y * s;
     91 <a name="l00098"></a>00098     q-&gt;z = z * s;
     92 <a name="l00099"></a>00099 }
     93 <a name="l00100"></a>00100 
     94 <a name="l00110"></a>00110 <span class="keyword">static</span> <span class="keywordtype">void</span>
     95 <a name="l00111"></a><a class="code" href="rs__quaternion_8rsh.html#adf4423c521e34f3cf29d5dd5b5a93de0">00111</a> <a class="code" href="rs__quaternion_8rsh.html#adf4423c521e34f3cf29d5dd5b5a93de0">rsQuaternionLoadRotate</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, <span class="keywordtype">float</span> rot, <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z) {
     96 <a name="l00112"></a>00112     <span class="keyword">const</span> <span class="keywordtype">float</span> len = x*x + y*y + z*z;
     97 <a name="l00113"></a>00113     <span class="keywordflow">if</span> (len != 1) {
     98 <a name="l00114"></a>00114         <span class="keyword">const</span> <span class="keywordtype">float</span> recipLen = 1.f / <a class="code" href="rs__cl_8rsh.html#a92da0faef80c4d8f66e954c8c169a729">sqrt</a>(len);
     99 <a name="l00115"></a>00115         x *= recipLen;
    100 <a name="l00116"></a>00116         y *= recipLen;
    101 <a name="l00117"></a>00117         z *= recipLen;
    102 <a name="l00118"></a>00118     }
    103 <a name="l00119"></a>00119     <a class="code" href="rs__quaternion_8rsh.html#aa72a43cf3d7b5924de1ddfaa5766db09">rsQuaternionLoadRotateUnit</a>(q, rot, x, y, z);
    104 <a name="l00120"></a>00120 }
    105 <a name="l00121"></a>00121 
    106 <a name="l00126"></a>00126 <span class="keyword">static</span> <span class="keywordtype">void</span>
    107 <a name="l00127"></a><a class="code" href="rs__quaternion_8rsh.html#acd670264e49743d35f38028b8e2a8800">00127</a> <a class="code" href="rs__quaternion_8rsh.html#acd670264e49743d35f38028b8e2a8800">rsQuaternionConjugate</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q) {
    108 <a name="l00128"></a>00128     q-&gt;x = -q-&gt;x;
    109 <a name="l00129"></a>00129     q-&gt;y = -q-&gt;y;
    110 <a name="l00130"></a>00130     q-&gt;z = -q-&gt;z;
    111 <a name="l00131"></a>00131 }
    112 <a name="l00132"></a>00132 
    113 <a name="l00139"></a>00139 <span class="keyword">static</span> <span class="keywordtype">float</span>
    114 <a name="l00140"></a><a class="code" href="rs__quaternion_8rsh.html#aa810f8857439564e7b3be771f47b40ca">00140</a> <a class="code" href="rs__quaternion_8rsh.html#aa810f8857439564e7b3be771f47b40ca">rsQuaternionDot</a>(<span class="keyword">const</span> <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q0, <span class="keyword">const</span> <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q1) {
    115 <a name="l00141"></a>00141     <span class="keywordflow">return</span> q0-&gt;w*q1-&gt;w + q0-&gt;x*q1-&gt;x + q0-&gt;y*q1-&gt;y + q0-&gt;z*q1-&gt;z;
    116 <a name="l00142"></a>00142 }
    117 <a name="l00143"></a>00143 
    118 <a name="l00148"></a>00148 <span class="keyword">static</span> <span class="keywordtype">void</span>
    119 <a name="l00149"></a><a class="code" href="rs__quaternion_8rsh.html#abb31aad2416044ad5bbf44ee7c838e2a">00149</a> <a class="code" href="rs__quaternion_8rsh.html#abb31aad2416044ad5bbf44ee7c838e2a">rsQuaternionNormalize</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q) {
    120 <a name="l00150"></a>00150     <span class="keyword">const</span> <span class="keywordtype">float</span> len = <a class="code" href="rs__quaternion_8rsh.html#aa810f8857439564e7b3be771f47b40ca">rsQuaternionDot</a>(q, q);
    121 <a name="l00151"></a>00151     <span class="keywordflow">if</span> (len != 1) {
    122 <a name="l00152"></a>00152         <span class="keyword">const</span> <span class="keywordtype">float</span> recipLen = 1.f / <a class="code" href="rs__cl_8rsh.html#a92da0faef80c4d8f66e954c8c169a729">sqrt</a>(len);
    123 <a name="l00153"></a>00153         <a class="code" href="rs__quaternion_8rsh.html#a4f3d214912facf72f6a6d57e95aa3c3b">rsQuaternionMultiply</a>(q, recipLen);
    124 <a name="l00154"></a>00154     }
    125 <a name="l00155"></a>00155 }
    126 <a name="l00156"></a>00156 
    127 <a name="l00162"></a>00162 <span class="keyword">static</span> <span class="keywordtype">void</span> __attribute__((overloadable))
    128 <a name="l00163"></a><a class="code" href="rs__quaternion_8rsh.html#a8bbbb286a2e2cb71b416c053f44844c3">00163</a> <a class="code" href="rs__quaternion_8rsh.html#a4f3d214912facf72f6a6d57e95aa3c3b">rsQuaternionMultiply</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, const <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *rhs) {
    129 <a name="l00164"></a>00164     <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> qtmp;
    130 <a name="l00165"></a>00165     <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(&amp;qtmp, q);
    131 <a name="l00166"></a>00166 
    132 <a name="l00167"></a>00167     q-&gt;w = qtmp.w*rhs-&gt;w - qtmp.x*rhs-&gt;x - qtmp.y*rhs-&gt;y - qtmp.z*rhs-&gt;z;
    133 <a name="l00168"></a>00168     q-&gt;x = qtmp.w*rhs-&gt;x + qtmp.x*rhs-&gt;w + qtmp.y*rhs-&gt;z - qtmp.z*rhs-&gt;y;
    134 <a name="l00169"></a>00169     q-&gt;y = qtmp.w*rhs-&gt;y + qtmp.y*rhs-&gt;w + qtmp.z*rhs-&gt;x - qtmp.x*rhs-&gt;z;
    135 <a name="l00170"></a>00170     q-&gt;z = qtmp.w*rhs-&gt;z + qtmp.z*rhs-&gt;w + qtmp.x*rhs-&gt;y - qtmp.y*rhs-&gt;x;
    136 <a name="l00171"></a>00171     <a class="code" href="rs__quaternion_8rsh.html#abb31aad2416044ad5bbf44ee7c838e2a">rsQuaternionNormalize</a>(q);
    137 <a name="l00172"></a>00172 }
    138 <a name="l00173"></a>00173 
    139 <a name="l00181"></a>00181 <span class="keyword">static</span> <span class="keywordtype">void</span>
    140 <a name="l00182"></a><a class="code" href="rs__quaternion_8rsh.html#a7da94a30e287cbb8148771a5cd768dbd">00182</a> <a class="code" href="rs__quaternion_8rsh.html#a7da94a30e287cbb8148771a5cd768dbd">rsQuaternionSlerp</a>(<a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q, <span class="keyword">const</span> <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q0, <span class="keyword">const</span> <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q1, <span class="keywordtype">float</span> t) {
    141 <a name="l00183"></a>00183     <span class="keywordflow">if</span> (t &lt;= 0.0f) {
    142 <a name="l00184"></a>00184         <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(q, q0);
    143 <a name="l00185"></a>00185         <span class="keywordflow">return</span>;
    144 <a name="l00186"></a>00186     }
    145 <a name="l00187"></a>00187     <span class="keywordflow">if</span> (t &gt;= 1.0f) {
    146 <a name="l00188"></a>00188         <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(q, q1);
    147 <a name="l00189"></a>00189         <span class="keywordflow">return</span>;
    148 <a name="l00190"></a>00190     }
    149 <a name="l00191"></a>00191 
    150 <a name="l00192"></a>00192     <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> tempq0, tempq1;
    151 <a name="l00193"></a>00193     <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(&amp;tempq0, q0);
    152 <a name="l00194"></a>00194     <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(&amp;tempq1, q1);
    153 <a name="l00195"></a>00195 
    154 <a name="l00196"></a>00196     <span class="keywordtype">float</span> angle = <a class="code" href="rs__quaternion_8rsh.html#aa810f8857439564e7b3be771f47b40ca">rsQuaternionDot</a>(q0, q1);
    155 <a name="l00197"></a>00197     <span class="keywordflow">if</span> (angle &lt; 0) {
    156 <a name="l00198"></a>00198         <a class="code" href="rs__quaternion_8rsh.html#a4f3d214912facf72f6a6d57e95aa3c3b">rsQuaternionMultiply</a>(&amp;tempq0, -1.0f);
    157 <a name="l00199"></a>00199         angle *= -1.0f;
    158 <a name="l00200"></a>00200     }
    159 <a name="l00201"></a>00201 
    160 <a name="l00202"></a>00202     <span class="keywordtype">float</span> scale, invScale;
    161 <a name="l00203"></a>00203     <span class="keywordflow">if</span> (angle + 1.0f &gt; 0.05f) {
    162 <a name="l00204"></a>00204         <span class="keywordflow">if</span> (1.0f - angle &gt;= 0.05f) {
    163 <a name="l00205"></a>00205             <span class="keywordtype">float</span> theta = <a class="code" href="rs__cl_8rsh.html#a07648648c7f857cfd1479821d4389751">acos</a>(angle);
    164 <a name="l00206"></a>00206             <span class="keywordtype">float</span> invSinTheta = 1.0f / <a class="code" href="rs__cl_8rsh.html#a8c8cd526b44eb55aede77cf659f24306">sin</a>(theta);
    165 <a name="l00207"></a>00207             scale = <a class="code" href="rs__cl_8rsh.html#a8c8cd526b44eb55aede77cf659f24306">sin</a>(theta * (1.0f - t)) * invSinTheta;
    166 <a name="l00208"></a>00208             invScale = <a class="code" href="rs__cl_8rsh.html#a8c8cd526b44eb55aede77cf659f24306">sin</a>(theta * t) * invSinTheta;
    167 <a name="l00209"></a>00209         } <span class="keywordflow">else</span> {
    168 <a name="l00210"></a>00210             scale = 1.0f - t;
    169 <a name="l00211"></a>00211             invScale = t;
    170 <a name="l00212"></a>00212         }
    171 <a name="l00213"></a>00213     } <span class="keywordflow">else</span> {
    172 <a name="l00214"></a>00214         <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(&amp;tempq1, tempq0.z, -tempq0.y, tempq0.x, -tempq0.w);
    173 <a name="l00215"></a>00215         scale = <a class="code" href="rs__cl_8rsh.html#a8c8cd526b44eb55aede77cf659f24306">sin</a>(M_PI * (0.5f - t));
    174 <a name="l00216"></a>00216         invScale = <a class="code" href="rs__cl_8rsh.html#a8c8cd526b44eb55aede77cf659f24306">sin</a>(M_PI * t);
    175 <a name="l00217"></a>00217     }
    176 <a name="l00218"></a>00218 
    177 <a name="l00219"></a>00219     <a class="code" href="rs__quaternion_8rsh.html#a5ff868dbc33e710a666a102fdcc6670a">rsQuaternionSet</a>(q, tempq0.w*scale + tempq1.w*invScale, tempq0.x*scale + tempq1.x*invScale,
    178 <a name="l00220"></a>00220                         tempq0.y*scale + tempq1.y*invScale, tempq0.z*scale + tempq1.z*invScale);
    179 <a name="l00221"></a>00221 }
    180 <a name="l00222"></a>00222 
    181 <a name="l00228"></a><a class="code" href="rs__quaternion_8rsh.html#a7726c524868c49892976fec53ea0693b">00228</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="rs__quaternion_8rsh.html#a7726c524868c49892976fec53ea0693b">rsQuaternionGetMatrixUnit</a>(<a class="code" href="structrs__matrix4x4.html" title="4x4 float matrix">rs_matrix4x4</a> *m, <span class="keyword">const</span> <a class="code" href="rs__types_8rsh.html#a86f99f382dc35fc8ad98b524fe6d5447">rs_quaternion</a> *q) {
    182 <a name="l00229"></a>00229     <span class="keywordtype">float</span> xx = q-&gt;x * q-&gt;x;
    183 <a name="l00230"></a>00230     <span class="keywordtype">float</span> xy = q-&gt;x * q-&gt;y;
    184 <a name="l00231"></a>00231     <span class="keywordtype">float</span> xz = q-&gt;x * q-&gt;z;
    185 <a name="l00232"></a>00232     <span class="keywordtype">float</span> xw = q-&gt;x * q-&gt;w;
    186 <a name="l00233"></a>00233     <span class="keywordtype">float</span> yy = q-&gt;y * q-&gt;y;
    187 <a name="l00234"></a>00234     <span class="keywordtype">float</span> yz = q-&gt;y * q-&gt;z;
    188 <a name="l00235"></a>00235     <span class="keywordtype">float</span> yw = q-&gt;y * q-&gt;w;
    189 <a name="l00236"></a>00236     <span class="keywordtype">float</span> zz = q-&gt;z * q-&gt;z;
    190 <a name="l00237"></a>00237     <span class="keywordtype">float</span> zw = q-&gt;z * q-&gt;w;
    191 <a name="l00238"></a>00238 
    192 <a name="l00239"></a>00239     m-&gt;m[0]  = 1.0f - 2.0f * ( yy + zz );
    193 <a name="l00240"></a>00240     m-&gt;m[4]  =        2.0f * ( xy - zw );
    194 <a name="l00241"></a>00241     m-&gt;m[8]  =        2.0f * ( xz + yw );
    195 <a name="l00242"></a>00242     m-&gt;m[1]  =        2.0f * ( xy + zw );
    196 <a name="l00243"></a>00243     m-&gt;m[5]  = 1.0f - 2.0f * ( xx + zz );
    197 <a name="l00244"></a>00244     m-&gt;m[9]  =        2.0f * ( yz - xw );
    198 <a name="l00245"></a>00245     m-&gt;m[2]  =        2.0f * ( xz - yw );
    199 <a name="l00246"></a>00246     m-&gt;m[6]  =        2.0f * ( yz + xw );
    200 <a name="l00247"></a>00247     m-&gt;m[10] = 1.0f - 2.0f * ( xx + yy );
    201 <a name="l00248"></a>00248     m-&gt;m[3]  = m-&gt;m[7] = m-&gt;m[11] = m-&gt;m[12] = m-&gt;m[13] = m-&gt;m[14] = 0.0f;
    202 <a name="l00249"></a>00249     m-&gt;m[15] = 1.0f;
    203 <a name="l00250"></a>00250 }
    204 <a name="l00251"></a>00251 
    205 <a name="l00252"></a>00252 <span class="preprocessor">#endif</span>
    206 <a name="l00253"></a>00253 <span class="preprocessor"></span>
    207 </pre></div></div>
    208 </div>
    209 
    210 </body>
    211 </html>
    212