1page.title=RenderScript Quaternion Functions 2 3@jd:body 4 5<div class='renderscript'> 6<h2>Overview</h2> 7<p> The following functions manipulate quaternions. 8</p> 9<h2>Summary</h2> 10<table class='jd-sumtable'><tbody> 11 <tr><th colspan='2'>Functions</th></tr> 12 <tr class='alt-color api apilevel-1'> 13 <td class='jd-linkcol'> 14 <a href='rs_quaternion.html#android_rs:rsQuaternionAdd'>rsQuaternionAdd</a> 15 </td> 16 <td class='jd-descrcol' width='100%'> 17 Add two quaternions 18 </td> 19 </tr> 20 <tr class='alt-color api apilevel-1'> 21 <td class='jd-linkcol'> 22 <a href='rs_quaternion.html#android_rs:rsQuaternionConjugate'>rsQuaternionConjugate</a> 23 </td> 24 <td class='jd-descrcol' width='100%'> 25 Conjugate a quaternion 26 </td> 27 </tr> 28 <tr class='alt-color api apilevel-1'> 29 <td class='jd-linkcol'> 30 <a href='rs_quaternion.html#android_rs:rsQuaternionDot'>rsQuaternionDot</a> 31 </td> 32 <td class='jd-descrcol' width='100%'> 33 Dot product of two quaternions 34 </td> 35 </tr> 36 <tr class='alt-color api apilevel-1'> 37 <td class='jd-linkcol'> 38 <a href='rs_quaternion.html#android_rs:rsQuaternionGetMatrixUnit'>rsQuaternionGetMatrixUnit</a> 39 </td> 40 <td class='jd-descrcol' width='100%'> 41 Get a rotation matrix from a quaternion 42 </td> 43 </tr> 44 <tr class='alt-color api apilevel-1'> 45 <td class='jd-linkcol'> 46 <a href='rs_quaternion.html#android_rs:rsQuaternionLoadRotate'>rsQuaternionLoadRotate</a> 47 </td> 48 <td class='jd-descrcol' width='100%'> 49 Create a rotation quaternion 50 </td> 51 </tr> 52 <tr class='alt-color api apilevel-1'> 53 <td class='jd-linkcol'> 54 <a href='rs_quaternion.html#android_rs:rsQuaternionLoadRotateUnit'>rsQuaternionLoadRotateUnit</a> 55 </td> 56 <td class='jd-descrcol' width='100%'> 57 Quaternion that represents a rotation about an arbitrary unit vector 58 </td> 59 </tr> 60 <tr class='alt-color api apilevel-1'> 61 <td class='jd-linkcol'> 62 <a href='rs_quaternion.html#android_rs:rsQuaternionMultiply'>rsQuaternionMultiply</a> 63 </td> 64 <td class='jd-descrcol' width='100%'> 65 Multiply a quaternion by a scalar or another quaternion 66 </td> 67 </tr> 68 <tr class='alt-color api apilevel-1'> 69 <td class='jd-linkcol'> 70 <a href='rs_quaternion.html#android_rs:rsQuaternionNormalize'>rsQuaternionNormalize</a> 71 </td> 72 <td class='jd-descrcol' width='100%'> 73 Normalize a quaternion 74 </td> 75 </tr> 76 <tr class='alt-color api apilevel-1'> 77 <td class='jd-linkcol'> 78 <a href='rs_quaternion.html#android_rs:rsQuaternionSet'>rsQuaternionSet</a> 79 </td> 80 <td class='jd-descrcol' width='100%'> 81 Create a quaternion 82 </td> 83 </tr> 84 <tr class='alt-color api apilevel-1'> 85 <td class='jd-linkcol'> 86 <a href='rs_quaternion.html#android_rs:rsQuaternionSlerp'>rsQuaternionSlerp</a> 87 </td> 88 <td class='jd-descrcol' width='100%'> 89 Spherical linear interpolation between two quaternions 90 </td> 91 </tr> 92</tbody></table> 93<h2>Functions</h2> 94<a name='android_rs:rsQuaternionAdd'></a> 95<div class='jd-details'> 96 <h4 class='jd-details-title'> 97 <span class='sympad'>rsQuaternionAdd</span> 98 <span class='normal'>: Add two quaternions</span> 99 </h4> 100 <div class='jd-details-descr'> 101 <table class='jd-tagtable'><tbody> 102 <tr> 103 <td>void rsQuaternionAdd(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* rhs); 104</td> 105 <td> </td> 106 </tr> 107 </tbody></table> 108 </div> 109 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 110 <table class='jd-tagtable'><tbody> 111 <tr><th>q</th><td>Destination quaternion to add to.</td></tr> 112 <tr><th>rhs</th><td>Quaternion to add.</td></tr> 113 </tbody></table> 114 </div> 115 <div class='jd-tagdata jd-tagdescr'> 116<p> Adds two quaternions, i.e. <code>*q += *rhs;</code> 117</p> 118 </div> 119</div> 120 121<a name='android_rs:rsQuaternionConjugate'></a> 122<div class='jd-details'> 123 <h4 class='jd-details-title'> 124 <span class='sympad'>rsQuaternionConjugate</span> 125 <span class='normal'>: Conjugate a quaternion</span> 126 </h4> 127 <div class='jd-details-descr'> 128 <table class='jd-tagtable'><tbody> 129 <tr> 130 <td>void rsQuaternionConjugate(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q); 131</td> 132 <td> </td> 133 </tr> 134 </tbody></table> 135 </div> 136 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 137 <table class='jd-tagtable'><tbody> 138 <tr><th>q</th><td>Quaternion to modify.</td></tr> 139 </tbody></table> 140 </div> 141 <div class='jd-tagdata jd-tagdescr'> 142<p> Conjugates the quaternion. 143</p> 144 </div> 145</div> 146 147<a name='android_rs:rsQuaternionDot'></a> 148<div class='jd-details'> 149 <h4 class='jd-details-title'> 150 <span class='sympad'>rsQuaternionDot</span> 151 <span class='normal'>: Dot product of two quaternions</span> 152 </h4> 153 <div class='jd-details-descr'> 154 <table class='jd-tagtable'><tbody> 155 <tr> 156 <td>float rsQuaternionDot(const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q0, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q1); 157</td> 158 <td> </td> 159 </tr> 160 </tbody></table> 161 </div> 162 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 163 <table class='jd-tagtable'><tbody> 164 <tr><th>q0</th><td>First quaternion.</td></tr> 165 <tr><th>q1</th><td>Second quaternion.</td></tr> 166 </tbody></table> 167 </div> 168 <div class='jd-tagdata jd-tagdescr'> 169<p> Returns the dot product of two quaternions. 170</p> 171 </div> 172</div> 173 174<a name='android_rs:rsQuaternionGetMatrixUnit'></a> 175<div class='jd-details'> 176 <h4 class='jd-details-title'> 177 <span class='sympad'>rsQuaternionGetMatrixUnit</span> 178 <span class='normal'>: Get a rotation matrix from a quaternion</span> 179 </h4> 180 <div class='jd-details-descr'> 181 <table class='jd-tagtable'><tbody> 182 <tr> 183 <td>void rsQuaternionGetMatrixUnit(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q); 184</td> 185 <td> </td> 186 </tr> 187 </tbody></table> 188 </div> 189 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 190 <table class='jd-tagtable'><tbody> 191 <tr><th>m</th><td>Resulting matrix.</td></tr> 192 <tr><th>q</th><td>Normalized quaternion.</td></tr> 193 </tbody></table> 194 </div> 195 <div class='jd-tagdata jd-tagdescr'> 196<p> Computes a rotation matrix from the normalized quaternion. 197</p> 198 </div> 199</div> 200 201<a name='android_rs:rsQuaternionLoadRotate'></a> 202<div class='jd-details'> 203 <h4 class='jd-details-title'> 204 <span class='sympad'>rsQuaternionLoadRotate</span> 205 <span class='normal'>: Create a rotation quaternion</span> 206 </h4> 207 <div class='jd-details-descr'> 208 <table class='jd-tagtable'><tbody> 209 <tr> 210 <td>void rsQuaternionLoadRotate(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, float rot, float x, float y, float z); 211</td> 212 <td> </td> 213 </tr> 214 </tbody></table> 215 </div> 216 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 217 <table class='jd-tagtable'><tbody> 218 <tr><th>q</th><td>Destination quaternion.</td></tr> 219 <tr><th>rot</th><td>Angle to rotate by.</td></tr> 220 <tr><th>x</th><td>X component of a vector.</td></tr> 221 <tr><th>y</th><td>Y component of a vector.</td></tr> 222 <tr><th>z</th><td>Z component of a vector.</td></tr> 223 </tbody></table> 224 </div> 225 <div class='jd-tagdata jd-tagdescr'> 226<p> Loads a quaternion that represents a rotation about an arbitrary vector 227(doesn't have to be unit) 228</p> 229 </div> 230</div> 231 232<a name='android_rs:rsQuaternionLoadRotateUnit'></a> 233<div class='jd-details'> 234 <h4 class='jd-details-title'> 235 <span class='sympad'>rsQuaternionLoadRotateUnit</span> 236 <span class='normal'>: Quaternion that represents a rotation about an arbitrary unit vector</span> 237 </h4> 238 <div class='jd-details-descr'> 239 <table class='jd-tagtable'><tbody> 240 <tr> 241 <td>void rsQuaternionLoadRotateUnit(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, float rot, float x, float y, float z); 242</td> 243 <td> </td> 244 </tr> 245 </tbody></table> 246 </div> 247 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 248 <table class='jd-tagtable'><tbody> 249 <tr><th>q</th><td>Destination quaternion.</td></tr> 250 <tr><th>rot</th><td>Angle to rotate by, in radians.</td></tr> 251 <tr><th>x</th><td>X component of the vector.</td></tr> 252 <tr><th>y</th><td>Y component of the vector.</td></tr> 253 <tr><th>z</th><td>Z component of the vector.</td></tr> 254 </tbody></table> 255 </div> 256 <div class='jd-tagdata jd-tagdescr'> 257<p> Loads a quaternion that represents a rotation about an arbitrary unit vector. 258</p> 259 </div> 260</div> 261 262<a name='android_rs:rsQuaternionMultiply'></a> 263<div class='jd-details'> 264 <h4 class='jd-details-title'> 265 <span class='sympad'>rsQuaternionMultiply</span> 266 <span class='normal'>: Multiply a quaternion by a scalar or another quaternion</span> 267 </h4> 268 <div class='jd-details-descr'> 269 <table class='jd-tagtable'><tbody> 270 <tr> 271 <td>void rsQuaternionMultiply(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* rhs); 272</td> 273 <td> </td> 274 </tr> 275 <tr> 276 <td>void rsQuaternionMultiply(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, float scalar); 277</td> 278 <td> </td> 279 </tr> 280 </tbody></table> 281 </div> 282 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 283 <table class='jd-tagtable'><tbody> 284 <tr><th>q</th><td>Destination quaternion.</td></tr> 285 <tr><th>scalar</th><td>Scalar to multiply the quaternion by.</td></tr> 286 <tr><th>rhs</th><td>Quaternion to multiply the destination quaternion by.</td></tr> 287 </tbody></table> 288 </div> 289 <div class='jd-tagdata jd-tagdescr'> 290<p> Multiplies a quaternion by a scalar or by another quaternion, e.g 291<code>*q = *q * scalar;</code> or <code>*q = *q * *rhs;</code>. 292</p> 293 </div> 294</div> 295 296<a name='android_rs:rsQuaternionNormalize'></a> 297<div class='jd-details'> 298 <h4 class='jd-details-title'> 299 <span class='sympad'>rsQuaternionNormalize</span> 300 <span class='normal'>: Normalize a quaternion</span> 301 </h4> 302 <div class='jd-details-descr'> 303 <table class='jd-tagtable'><tbody> 304 <tr> 305 <td>void rsQuaternionNormalize(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q); 306</td> 307 <td> </td> 308 </tr> 309 </tbody></table> 310 </div> 311 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 312 <table class='jd-tagtable'><tbody> 313 <tr><th>q</th><td>Quaternion to normalize.</td></tr> 314 </tbody></table> 315 </div> 316 <div class='jd-tagdata jd-tagdescr'> 317<p> Normalizes the quaternion. 318</p> 319 </div> 320</div> 321 322<a name='android_rs:rsQuaternionSet'></a> 323<div class='jd-details'> 324 <h4 class='jd-details-title'> 325 <span class='sympad'>rsQuaternionSet</span> 326 <span class='normal'>: Create a quaternion</span> 327 </h4> 328 <div class='jd-details-descr'> 329 <table class='jd-tagtable'><tbody> 330 <tr> 331 <td>void rsQuaternionSet(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* rhs); 332</td> 333 <td> </td> 334 </tr> 335 <tr> 336 <td>void rsQuaternionSet(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, float w, float x, float y, float z); 337</td> 338 <td> </td> 339 </tr> 340 </tbody></table> 341 </div> 342 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 343 <table class='jd-tagtable'><tbody> 344 <tr><th>q</th><td>Destination quaternion.</td></tr> 345 <tr><th>w</th><td>W component.</td></tr> 346 <tr><th>x</th><td>X component.</td></tr> 347 <tr><th>y</th><td>Y component.</td></tr> 348 <tr><th>z</th><td>Z component.</td></tr> 349 <tr><th>rhs</th><td>Source quaternion.</td></tr> 350 </tbody></table> 351 </div> 352 <div class='jd-tagdata jd-tagdescr'> 353<p> Creates a quaternion from its four components or from another quaternion. 354</p> 355 </div> 356</div> 357 358<a name='android_rs:rsQuaternionSlerp'></a> 359<div class='jd-details'> 360 <h4 class='jd-details-title'> 361 <span class='sympad'>rsQuaternionSlerp</span> 362 <span class='normal'>: Spherical linear interpolation between two quaternions</span> 363 </h4> 364 <div class='jd-details-descr'> 365 <table class='jd-tagtable'><tbody> 366 <tr> 367 <td>void rsQuaternionSlerp(<a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q0, const <a href='rs_value_types.html#android_rs:rs_quaternion'>rs_quaternion</a>* q1, float t); 368</td> 369 <td> </td> 370 </tr> 371 </tbody></table> 372 </div> 373 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 374 <table class='jd-tagtable'><tbody> 375 <tr><th>q</th><td>Result quaternion from the interpolation.</td></tr> 376 <tr><th>q0</th><td>First input quaternion.</td></tr> 377 <tr><th>q1</th><td>Second input quaternion.</td></tr> 378 <tr><th>t</th><td>How much to interpolate by.</td></tr> 379 </tbody></table> 380 </div> 381 <div class='jd-tagdata jd-tagdescr'> 382<p> Performs spherical linear interpolation between two quaternions. 383</p> 384 </div> 385</div> 386 387</div> 388