1 page.title=RenderScript Matrix Functions 2 3 @jd:body 4 5 <div class='renderscript'> 6 <h2>Overview</h2> 7 <p> These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4. 8 They are particularly useful for graphical transformations and are compatible 9 with OpenGL. 10 </p> 11 12 <p> We use a zero-based index for rows and columns. E.g. the last element of a 13 <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a> is found at (3, 3). 14 </p> 15 16 <p> RenderScript uses column-major matrices and column-based vectors. Transforming 17 a vector is done by postmultiplying the vector, e.g. <code>(matrix * vector)</code>, 18 as provided by <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 19 </p> 20 21 <p> To create a transformation matrix that performs two transformations at once, 22 multiply the two source matrices, with the first transformation as the right 23 argument. E.g. to create a transformation matrix that applies the 24 transformation s1 followed by s2, call <code>rsMatrixLoadMultiply(&combined, &s2, &s1)</code>. 25 This derives from <code>s2 * (s1 * v)</code>, which is <code>(s2 * s1) * v</code>. 26 </p> 27 28 <p> We have two style of functions to create transformation matrices: 29 rsMatrixLoad<i>Transformation</i> and rsMatrix<i>Transformation</i>. The former 30 style simply stores the transformation matrix in the first argument. The latter 31 modifies a pre-existing transformation matrix so that the new transformation 32 happens first. E.g. if you call <a href='rs_matrix.html#android_rs:rsMatrixTranslate'>rsMatrixTranslate</a>() on a matrix that already 33 does a scaling, the resulting matrix when applied to a vector will first do the 34 translation then the scaling. 35 </p> 36 <h2>Summary</h2> 37 <table class='jd-sumtable'><tbody> 38 <tr><th colspan='2'>Functions</th></tr> 39 <tr class='alt-color api apilevel-1'> 40 <td class='jd-linkcol'> 41 <a href='rs_matrix.html#android_rs:rsExtractFrustumPlanes'>rsExtractFrustumPlanes</a> 42 </td> 43 <td class='jd-descrcol' width='100%'> 44 Compute frustum planes 45 </td> 46 </tr> 47 <tr class='alt-color api apilevel-1'> 48 <td class='jd-linkcol'> 49 <a href='rs_matrix.html#android_rs:rsIsSphereInFrustum'>rsIsSphereInFrustum</a> 50 </td> 51 <td class='jd-descrcol' width='100%'> 52 Checks if a sphere is within the frustum planes 53 </td> 54 </tr> 55 <tr class='alt-color api apilevel-1'> 56 <td class='jd-linkcol'> 57 <a href='rs_matrix.html#android_rs:rsMatrixGet'>rsMatrixGet</a> 58 </td> 59 <td class='jd-descrcol' width='100%'> 60 Get one element 61 </td> 62 </tr> 63 <tr class='alt-color api apilevel-1'> 64 <td class='jd-linkcol'> 65 <a href='rs_matrix.html#android_rs:rsMatrixInverse'>rsMatrixInverse</a> 66 </td> 67 <td class='jd-descrcol' width='100%'> 68 Inverts a matrix in place 69 </td> 70 </tr> 71 <tr class='alt-color api apilevel-1'> 72 <td class='jd-linkcol'> 73 <a href='rs_matrix.html#android_rs:rsMatrixInverseTranspose'>rsMatrixInverseTranspose</a> 74 </td> 75 <td class='jd-descrcol' width='100%'> 76 Inverts and transpose a matrix in place 77 </td> 78 </tr> 79 <tr class='alt-color api apilevel-1'> 80 <td class='jd-linkcol'> 81 <a href='rs_matrix.html#android_rs:rsMatrixLoad'>rsMatrixLoad</a> 82 </td> 83 <td class='jd-descrcol' width='100%'> 84 Load or copy a matrix 85 </td> 86 </tr> 87 <tr class='alt-color api apilevel-1'> 88 <td class='jd-linkcol'> 89 <a href='rs_matrix.html#android_rs:rsMatrixLoadFrustum'>rsMatrixLoadFrustum</a> 90 </td> 91 <td class='jd-descrcol' width='100%'> 92 Load a frustum projection matrix 93 </td> 94 </tr> 95 <tr class='alt-color api apilevel-1'> 96 <td class='jd-linkcol'> 97 <a href='rs_matrix.html#android_rs:rsMatrixLoadIdentity'>rsMatrixLoadIdentity</a> 98 </td> 99 <td class='jd-descrcol' width='100%'> 100 Load identity matrix 101 </td> 102 </tr> 103 <tr class='alt-color api apilevel-1'> 104 <td class='jd-linkcol'> 105 <a href='rs_matrix.html#android_rs:rsMatrixLoadMultiply'>rsMatrixLoadMultiply</a> 106 </td> 107 <td class='jd-descrcol' width='100%'> 108 Multiply two matrices 109 </td> 110 </tr> 111 <tr class='alt-color api apilevel-1'> 112 <td class='jd-linkcol'> 113 <a href='rs_matrix.html#android_rs:rsMatrixLoadOrtho'>rsMatrixLoadOrtho</a> 114 </td> 115 <td class='jd-descrcol' width='100%'> 116 Load an orthographic projection matrix 117 </td> 118 </tr> 119 <tr class='alt-color api apilevel-1'> 120 <td class='jd-linkcol'> 121 <a href='rs_matrix.html#android_rs:rsMatrixLoadPerspective'>rsMatrixLoadPerspective</a> 122 </td> 123 <td class='jd-descrcol' width='100%'> 124 Load a perspective projection matrix 125 </td> 126 </tr> 127 <tr class='alt-color api apilevel-1'> 128 <td class='jd-linkcol'> 129 <a href='rs_matrix.html#android_rs:rsMatrixLoadRotate'>rsMatrixLoadRotate</a> 130 </td> 131 <td class='jd-descrcol' width='100%'> 132 Load a rotation matrix 133 </td> 134 </tr> 135 <tr class='alt-color api apilevel-1'> 136 <td class='jd-linkcol'> 137 <a href='rs_matrix.html#android_rs:rsMatrixLoadScale'>rsMatrixLoadScale</a> 138 </td> 139 <td class='jd-descrcol' width='100%'> 140 Load a scaling matrix 141 </td> 142 </tr> 143 <tr class='alt-color api apilevel-1'> 144 <td class='jd-linkcol'> 145 <a href='rs_matrix.html#android_rs:rsMatrixLoadTranslate'>rsMatrixLoadTranslate</a> 146 </td> 147 <td class='jd-descrcol' width='100%'> 148 Load a translation matrix 149 </td> 150 </tr> 151 <tr class='alt-color api apilevel-1'> 152 <td class='jd-linkcol'> 153 <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a> 154 </td> 155 <td class='jd-descrcol' width='100%'> 156 Multiply a matrix by a vector or another matrix 157 </td> 158 </tr> 159 <tr class='alt-color api apilevel-1'> 160 <td class='jd-linkcol'> 161 <a href='rs_matrix.html#android_rs:rsMatrixRotate'>rsMatrixRotate</a> 162 </td> 163 <td class='jd-descrcol' width='100%'> 164 Apply a rotation to a transformation matrix 165 </td> 166 </tr> 167 <tr class='alt-color api apilevel-1'> 168 <td class='jd-linkcol'> 169 <a href='rs_matrix.html#android_rs:rsMatrixScale'>rsMatrixScale</a> 170 </td> 171 <td class='jd-descrcol' width='100%'> 172 Apply a scaling to a transformation matrix 173 </td> 174 </tr> 175 <tr class='alt-color api apilevel-1'> 176 <td class='jd-linkcol'> 177 <a href='rs_matrix.html#android_rs:rsMatrixSet'>rsMatrixSet</a> 178 </td> 179 <td class='jd-descrcol' width='100%'> 180 Set one element 181 </td> 182 </tr> 183 <tr class='alt-color api apilevel-1'> 184 <td class='jd-linkcol'> 185 <a href='rs_matrix.html#android_rs:rsMatrixTranslate'>rsMatrixTranslate</a> 186 </td> 187 <td class='jd-descrcol' width='100%'> 188 Apply a translation to a transformation matrix 189 </td> 190 </tr> 191 <tr class='alt-color api apilevel-1'> 192 <td class='jd-linkcol'> 193 <a href='rs_matrix.html#android_rs:rsMatrixTranspose'>rsMatrixTranspose</a> 194 </td> 195 <td class='jd-descrcol' width='100%'> 196 Transpose a matrix place 197 </td> 198 </tr> 199 </tbody></table> 200 <h2>Functions</h2> 201 <a name='android_rs:rsExtractFrustumPlanes'></a> 202 <div class='jd-details'> 203 <h4 class='jd-details-title'> 204 <span class='sympad'>rsExtractFrustumPlanes</span> 205 <span class='normal'>: Compute frustum planes</span> 206 </h4> 207 <div class='jd-details-descr'> 208 <table class='jd-tagtable'><tbody> 209 <tr> 210 <td>void rsExtractFrustumPlanes(const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* viewProj, <a href='rs_value_types.html#android_rs:float4'>float4</a>* left, <a href='rs_value_types.html#android_rs:float4'>float4</a>* right, <a href='rs_value_types.html#android_rs:float4'>float4</a>* top, <a href='rs_value_types.html#android_rs:float4'>float4</a>* bottom, <a href='rs_value_types.html#android_rs:float4'>float4</a>* near, <a href='rs_value_types.html#android_rs:float4'>float4</a>* far); 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>viewProj</th><td>Matrix to extract planes from.</td></tr> 219 <tr><th>left</th><td>Left plane.</td></tr> 220 <tr><th>right</th><td>Right plane.</td></tr> 221 <tr><th>top</th><td>Top plane.</td></tr> 222 <tr><th>bottom</th><td>Bottom plane.</td></tr> 223 <tr><th>near</th><td>Near plane.</td></tr> 224 <tr><th>far</th><td>Far plane.</td></tr> 225 </tbody></table> 226 </div> 227 <div class='jd-tagdata jd-tagdescr'> 228 <p> Computes 6 frustum planes from the view projection matrix 229 </p> 230 </div> 231 </div> 232 233 <a name='android_rs:rsIsSphereInFrustum'></a> 234 <div class='jd-details'> 235 <h4 class='jd-details-title'> 236 <span class='sympad'>rsIsSphereInFrustum</span> 237 <span class='normal'>: Checks if a sphere is within the frustum planes</span> 238 </h4> 239 <div class='jd-details-descr'> 240 <table class='jd-tagtable'><tbody> 241 <tr> 242 <td>bool rsIsSphereInFrustum(<a href='rs_value_types.html#android_rs:float4'>float4</a>* sphere, <a href='rs_value_types.html#android_rs:float4'>float4</a>* left, <a href='rs_value_types.html#android_rs:float4'>float4</a>* right, <a href='rs_value_types.html#android_rs:float4'>float4</a>* top, <a href='rs_value_types.html#android_rs:float4'>float4</a>* bottom, <a href='rs_value_types.html#android_rs:float4'>float4</a>* near, <a href='rs_value_types.html#android_rs:float4'>float4</a>* far); 243 </td> 244 <td> </td> 245 </tr> 246 </tbody></table> 247 </div> 248 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 249 <table class='jd-tagtable'><tbody> 250 <tr><th>sphere</th><td>float4 representing the sphere.</td></tr> 251 <tr><th>left</th><td>Left plane.</td></tr> 252 <tr><th>right</th><td>Right plane.</td></tr> 253 <tr><th>top</th><td>Top plane.</td></tr> 254 <tr><th>bottom</th><td>Bottom plane.</td></tr> 255 <tr><th>near</th><td>Near plane.</td></tr> 256 <tr><th>far</th><td>Far plane.</td></tr> 257 </tbody></table> 258 </div> 259 <div class='jd-tagdata jd-tagdescr'> 260 <p> Returns true if the sphere is within the 6 frustum planes. 261 </p> 262 </div> 263 </div> 264 265 <a name='android_rs:rsMatrixGet'></a> 266 <div class='jd-details'> 267 <h4 class='jd-details-title'> 268 <span class='sympad'>rsMatrixGet</span> 269 <span class='normal'>: Get one element</span> 270 </h4> 271 <div class='jd-details-descr'> 272 <table class='jd-tagtable'><tbody> 273 <tr> 274 <td>float rsMatrixGet(const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> col, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> row); 275 </td> 276 <td> </td> 277 </tr> 278 <tr> 279 <td>float rsMatrixGet(const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> col, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> row); 280 </td> 281 <td> </td> 282 </tr> 283 <tr> 284 <td>float rsMatrixGet(const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> col, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> row); 285 </td> 286 <td> </td> 287 </tr> 288 </tbody></table> 289 </div> 290 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 291 <table class='jd-tagtable'><tbody> 292 <tr><th>m</th><td>Matrix to extract the element from.</td></tr> 293 <tr><th>col</th><td>Zero-based column of the element to be extracted.</td></tr> 294 <tr><th>row</th><td>Zero-based row of the element to extracted.</td></tr> 295 </tbody></table> 296 </div> 297 <div class='jd-tagdata jd-tagdescr'> 298 <p> Returns one element of a matrix. 299 </p> 300 301 <p> <b>Warning:</b> The order of the column and row parameters may be unexpected. 302 </p> 303 </div> 304 </div> 305 306 <a name='android_rs:rsMatrixInverse'></a> 307 <div class='jd-details'> 308 <h4 class='jd-details-title'> 309 <span class='sympad'>rsMatrixInverse</span> 310 <span class='normal'>: Inverts a matrix in place</span> 311 </h4> 312 <div class='jd-details-descr'> 313 <table class='jd-tagtable'><tbody> 314 <tr> 315 <td>bool rsMatrixInverse(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m); 316 </td> 317 <td> </td> 318 </tr> 319 </tbody></table> 320 </div> 321 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 322 <table class='jd-tagtable'><tbody> 323 <tr><th>m</th><td>Matrix to invert.</td></tr> 324 </tbody></table> 325 </div> 326 <div class='jd-tagdata jd-tagdescr'> 327 <p> Returns true if the matrix was successfully inverted. 328 </p> 329 </div> 330 </div> 331 332 <a name='android_rs:rsMatrixInverseTranspose'></a> 333 <div class='jd-details'> 334 <h4 class='jd-details-title'> 335 <span class='sympad'>rsMatrixInverseTranspose</span> 336 <span class='normal'>: Inverts and transpose a matrix in place</span> 337 </h4> 338 <div class='jd-details-descr'> 339 <table class='jd-tagtable'><tbody> 340 <tr> 341 <td>bool rsMatrixInverseTranspose(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m); 342 </td> 343 <td> </td> 344 </tr> 345 </tbody></table> 346 </div> 347 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 348 <table class='jd-tagtable'><tbody> 349 <tr><th>m</th><td>Matrix to modify.</td></tr> 350 </tbody></table> 351 </div> 352 <div class='jd-tagdata jd-tagdescr'> 353 <p> The matrix is first inverted then transposed. Returns true if the matrix was 354 successfully inverted. 355 </p> 356 </div> 357 </div> 358 359 <a name='android_rs:rsMatrixLoad'></a> 360 <div class='jd-details'> 361 <h4 class='jd-details-title'> 362 <span class='sympad'>rsMatrixLoad</span> 363 <span class='normal'>: Load or copy a matrix</span> 364 </h4> 365 <div class='jd-details-descr'> 366 <table class='jd-tagtable'><tbody> 367 <tr> 368 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* destination, const float* array); 369 </td> 370 <td> </td> 371 </tr> 372 <tr> 373 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* destination, const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* source); 374 </td> 375 <td> </td> 376 </tr> 377 <tr> 378 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* destination, const float* array); 379 </td> 380 <td> </td> 381 </tr> 382 <tr> 383 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* destination, const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* source); 384 </td> 385 <td> </td> 386 </tr> 387 <tr> 388 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* destination, const float* array); 389 </td> 390 <td> </td> 391 </tr> 392 <tr> 393 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* destination, const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* source); 394 </td> 395 <td> </td> 396 </tr> 397 <tr> 398 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* destination, const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* source); 399 </td> 400 <td> </td> 401 </tr> 402 <tr> 403 <td>void rsMatrixLoad(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* destination, const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* source); 404 </td> 405 <td> </td> 406 </tr> 407 </tbody></table> 408 </div> 409 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 410 <table class='jd-tagtable'><tbody> 411 <tr><th>destination</th><td>Matrix to set.</td></tr> 412 <tr><th>array</th><td>Array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.</td></tr> 413 <tr><th>source</th><td>Source matrix.</td></tr> 414 </tbody></table> 415 </div> 416 <div class='jd-tagdata jd-tagdescr'> 417 <p> Set the elements of a matrix from an array of floats or from another matrix. 418 </p> 419 420 <p> If loading from an array, the floats should be in row-major order, i.e. the element a 421 <code>row 0, column 0</code> should be first, followed by the element at 422 <code>row 0, column 1</code>, etc. 423 </p> 424 425 <p> If loading from a matrix and the source is smaller than the destination, the rest 426 of the destination is filled with elements of the identity matrix. E.g. 427 loading a rs_matrix2x2 into a rs_matrix4x4 will give: 428 <table style="max-width:300px"> 429 <tr><td>m00</td> <td>m01</td> <td>0.0</td> <td>0.0</td></tr> 430 <tr><td>m10</td> <td>m11</td> <td>0.0</td> <td>0.0</td></tr> 431 <tr><td>0.0</td> <td>0.0</td> <td>1.0</td> <td>0.0</td></tr> 432 <tr><td>0.0</td> <td>0.0</td> <td>0.0</td> <td>1.0</td></tr> 433 </table> 434 </p> 435 </div> 436 </div> 437 438 <a name='android_rs:rsMatrixLoadFrustum'></a> 439 <div class='jd-details'> 440 <h4 class='jd-details-title'> 441 <span class='sympad'>rsMatrixLoadFrustum</span> 442 <span class='normal'>: Load a frustum projection matrix</span> 443 </h4> 444 <div class='jd-details-descr'> 445 <table class='jd-tagtable'><tbody> 446 <tr> 447 <td>void rsMatrixLoadFrustum(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float left, float right, float bottom, float top, float near, float far); 448 </td> 449 <td> </td> 450 </tr> 451 </tbody></table> 452 </div> 453 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 454 <table class='jd-tagtable'><tbody> 455 <tr><th>m</th><td>Matrix to set.</td></tr> 456 <tr><th>left</th><td></td></tr> 457 <tr><th>right</th><td></td></tr> 458 <tr><th>bottom</th><td></td></tr> 459 <tr><th>top</th><td></td></tr> 460 <tr><th>near</th><td></td></tr> 461 <tr><th>far</th><td></td></tr> 462 </tbody></table> 463 </div> 464 <div class='jd-tagdata jd-tagdescr'> 465 <p> Constructs a frustum projection matrix, transforming the box identified by 466 the six clipping planes <code>left, right, bottom, top, near, far</code>. 467 </p> 468 469 <p> To apply this projection to a vector, multiply the vector by the created 470 matrix using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 471 </p> 472 </div> 473 </div> 474 475 <a name='android_rs:rsMatrixLoadIdentity'></a> 476 <div class='jd-details'> 477 <h4 class='jd-details-title'> 478 <span class='sympad'>rsMatrixLoadIdentity</span> 479 <span class='normal'>: Load identity matrix</span> 480 </h4> 481 <div class='jd-details-descr'> 482 <table class='jd-tagtable'><tbody> 483 <tr> 484 <td>void rsMatrixLoadIdentity(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m); 485 </td> 486 <td> </td> 487 </tr> 488 <tr> 489 <td>void rsMatrixLoadIdentity(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m); 490 </td> 491 <td> </td> 492 </tr> 493 <tr> 494 <td>void rsMatrixLoadIdentity(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m); 495 </td> 496 <td> </td> 497 </tr> 498 </tbody></table> 499 </div> 500 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 501 <table class='jd-tagtable'><tbody> 502 <tr><th>m</th><td>Matrix to set.</td></tr> 503 </tbody></table> 504 </div> 505 <div class='jd-tagdata jd-tagdescr'> 506 <p> Set the elements of a matrix to the identity matrix. 507 </p> 508 </div> 509 </div> 510 511 <a name='android_rs:rsMatrixLoadMultiply'></a> 512 <div class='jd-details'> 513 <h4 class='jd-details-title'> 514 <span class='sympad'>rsMatrixLoadMultiply</span> 515 <span class='normal'>: Multiply two matrices</span> 516 </h4> 517 <div class='jd-details-descr'> 518 <table class='jd-tagtable'><tbody> 519 <tr> 520 <td>void rsMatrixLoadMultiply(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m, const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* lhs, const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* rhs); 521 </td> 522 <td> </td> 523 </tr> 524 <tr> 525 <td>void rsMatrixLoadMultiply(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* lhs, const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* rhs); 526 </td> 527 <td> </td> 528 </tr> 529 <tr> 530 <td>void rsMatrixLoadMultiply(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* lhs, const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* rhs); 531 </td> 532 <td> </td> 533 </tr> 534 </tbody></table> 535 </div> 536 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 537 <table class='jd-tagtable'><tbody> 538 <tr><th>m</th><td>Matrix to set.</td></tr> 539 <tr><th>lhs</th><td>Left matrix of the product.</td></tr> 540 <tr><th>rhs</th><td>Right matrix of the product.</td></tr> 541 </tbody></table> 542 </div> 543 <div class='jd-tagdata jd-tagdescr'> 544 <p> Sets m to the matrix product of <code>lhs * rhs</code>. 545 </p> 546 547 <p> To combine two 4x4 transformaton matrices, multiply the second transformation matrix 548 by the first transformation matrix. E.g. to create a transformation matrix that applies 549 the transformation s1 followed by s2, call <code>rsMatrixLoadMultiply(&combined, &s2, &s1)</code>. 550 </p> 551 552 <p> <b>Warning:</b> Prior to version 21, storing the result back into right matrix is not supported and 553 will result in undefined behavior. Use rsMatrixMulitply instead. E.g. instead of doing 554 rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l). 555 rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected. 556 </p> 557 </div> 558 </div> 559 560 <a name='android_rs:rsMatrixLoadOrtho'></a> 561 <div class='jd-details'> 562 <h4 class='jd-details-title'> 563 <span class='sympad'>rsMatrixLoadOrtho</span> 564 <span class='normal'>: Load an orthographic projection matrix</span> 565 </h4> 566 <div class='jd-details-descr'> 567 <table class='jd-tagtable'><tbody> 568 <tr> 569 <td>void rsMatrixLoadOrtho(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float left, float right, float bottom, float top, float near, float far); 570 </td> 571 <td> </td> 572 </tr> 573 </tbody></table> 574 </div> 575 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 576 <table class='jd-tagtable'><tbody> 577 <tr><th>m</th><td>Matrix to set.</td></tr> 578 <tr><th>left</th><td></td></tr> 579 <tr><th>right</th><td></td></tr> 580 <tr><th>bottom</th><td></td></tr> 581 <tr><th>top</th><td></td></tr> 582 <tr><th>near</th><td></td></tr> 583 <tr><th>far</th><td></td></tr> 584 </tbody></table> 585 </div> 586 <div class='jd-tagdata jd-tagdescr'> 587 <p> Constructs an orthographic projection matrix, transforming the box identified by the 588 six clipping planes <code>left, right, bottom, top, near, far</code> into a unit cube 589 with a corner at <code>(-1, -1, -1)</code> and the opposite at <code>(1, 1, 1)</code>. 590 </p> 591 592 <p> To apply this projection to a vector, multiply the vector by the created matrix 593 using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 594 </p> 595 596 <p> See https://en.wikipedia.org/wiki/Orthographic_projection . 597 </p> 598 </div> 599 </div> 600 601 <a name='android_rs:rsMatrixLoadPerspective'></a> 602 <div class='jd-details'> 603 <h4 class='jd-details-title'> 604 <span class='sympad'>rsMatrixLoadPerspective</span> 605 <span class='normal'>: Load a perspective projection matrix</span> 606 </h4> 607 <div class='jd-details-descr'> 608 <table class='jd-tagtable'><tbody> 609 <tr> 610 <td>void rsMatrixLoadPerspective(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float fovy, float aspect, float near, float far); 611 </td> 612 <td> </td> 613 </tr> 614 </tbody></table> 615 </div> 616 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 617 <table class='jd-tagtable'><tbody> 618 <tr><th>m</th><td>Matrix to set.</td></tr> 619 <tr><th>fovy</th><td>Field of view, in degrees along the Y axis.</td></tr> 620 <tr><th>aspect</th><td>Ratio of x / y.</td></tr> 621 <tr><th>near</th><td>Near clipping plane.</td></tr> 622 <tr><th>far</th><td>Far clipping plane.</td></tr> 623 </tbody></table> 624 </div> 625 <div class='jd-tagdata jd-tagdescr'> 626 <p> Constructs a perspective projection matrix, assuming a symmetrical field of view. 627 </p> 628 629 <p> To apply this projection to a vector, multiply the vector by the created matrix 630 using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 631 </p> 632 </div> 633 </div> 634 635 <a name='android_rs:rsMatrixLoadRotate'></a> 636 <div class='jd-details'> 637 <h4 class='jd-details-title'> 638 <span class='sympad'>rsMatrixLoadRotate</span> 639 <span class='normal'>: Load a rotation matrix</span> 640 </h4> 641 <div class='jd-details-descr'> 642 <table class='jd-tagtable'><tbody> 643 <tr> 644 <td>void rsMatrixLoadRotate(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float rot, float x, float y, float z); 645 </td> 646 <td> </td> 647 </tr> 648 </tbody></table> 649 </div> 650 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 651 <table class='jd-tagtable'><tbody> 652 <tr><th>m</th><td>Matrix to set.</td></tr> 653 <tr><th>rot</th><td>How much rotation to do, in degrees.</td></tr> 654 <tr><th>x</th><td>X component of the vector that is the axis of rotation.</td></tr> 655 <tr><th>y</th><td>Y component of the vector that is the axis of rotation.</td></tr> 656 <tr><th>z</th><td>Z component of the vector that is the axis of rotation.</td></tr> 657 </tbody></table> 658 </div> 659 <div class='jd-tagdata jd-tagdescr'> 660 <p> This function creates a rotation matrix. The axis of rotation is the <code>(x, y, z)</code> vector. 661 </p> 662 663 <p> To rotate a vector, multiply the vector by the created matrix using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 664 </p> 665 666 <p> See http://en.wikipedia.org/wiki/Rotation_matrix . 667 </p> 668 </div> 669 </div> 670 671 <a name='android_rs:rsMatrixLoadScale'></a> 672 <div class='jd-details'> 673 <h4 class='jd-details-title'> 674 <span class='sympad'>rsMatrixLoadScale</span> 675 <span class='normal'>: Load a scaling matrix</span> 676 </h4> 677 <div class='jd-details-descr'> 678 <table class='jd-tagtable'><tbody> 679 <tr> 680 <td>void rsMatrixLoadScale(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float x, float y, float z); 681 </td> 682 <td> </td> 683 </tr> 684 </tbody></table> 685 </div> 686 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 687 <table class='jd-tagtable'><tbody> 688 <tr><th>m</th><td>Matrix to set.</td></tr> 689 <tr><th>x</th><td>Multiple to scale the x components by.</td></tr> 690 <tr><th>y</th><td>Multiple to scale the y components by.</td></tr> 691 <tr><th>z</th><td>Multiple to scale the z components by.</td></tr> 692 </tbody></table> 693 </div> 694 <div class='jd-tagdata jd-tagdescr'> 695 <p> This function creates a scaling matrix, where each component of a vector is multiplied 696 by a number. This number can be negative. 697 </p> 698 699 <p> To scale a vector, multiply the vector by the created matrix using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 700 </p> 701 </div> 702 </div> 703 704 <a name='android_rs:rsMatrixLoadTranslate'></a> 705 <div class='jd-details'> 706 <h4 class='jd-details-title'> 707 <span class='sympad'>rsMatrixLoadTranslate</span> 708 <span class='normal'>: Load a translation matrix</span> 709 </h4> 710 <div class='jd-details-descr'> 711 <table class='jd-tagtable'><tbody> 712 <tr> 713 <td>void rsMatrixLoadTranslate(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float x, float y, float z); 714 </td> 715 <td> </td> 716 </tr> 717 </tbody></table> 718 </div> 719 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 720 <table class='jd-tagtable'><tbody> 721 <tr><th>m</th><td>Matrix to set.</td></tr> 722 <tr><th>x</th><td>Number to add to each x component.</td></tr> 723 <tr><th>y</th><td>Number to add to each y component.</td></tr> 724 <tr><th>z</th><td>Number to add to each z component.</td></tr> 725 </tbody></table> 726 </div> 727 <div class='jd-tagdata jd-tagdescr'> 728 <p> This function creates a translation matrix, where a number is added to each element of 729 a vector. 730 </p> 731 732 <p> To translate a vector, multiply the vector by the created matrix using 733 <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 734 </p> 735 </div> 736 </div> 737 738 <a name='android_rs:rsMatrixMultiply'></a> 739 <div class='jd-details'> 740 <h4 class='jd-details-title'> 741 <span class='sympad'>rsMatrixMultiply</span> 742 <span class='normal'>: Multiply a matrix by a vector or another matrix</span> 743 </h4> 744 <div class='jd-details-descr'> 745 <table class='jd-tagtable'><tbody> 746 <tr> 747 <td><a href='rs_value_types.html#android_rs:float2'>float2</a> rsMatrixMultiply(const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m, <a href='rs_value_types.html#android_rs:float2'>float2</a> in); 748 </td> 749 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 750 </td> 751 </tr> 752 <tr> 753 <td><a href='rs_value_types.html#android_rs:float2'>float2</a> rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m, <a href='rs_value_types.html#android_rs:float2'>float2</a> in); 754 </td> 755 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 756 </td> 757 </tr> 758 <tr> 759 <td><a href='rs_value_types.html#android_rs:float3'>float3</a> rsMatrixMultiply(const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, <a href='rs_value_types.html#android_rs:float2'>float2</a> in); 760 </td> 761 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 762 </td> 763 </tr> 764 <tr> 765 <td><a href='rs_value_types.html#android_rs:float3'>float3</a> rsMatrixMultiply(const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, <a href='rs_value_types.html#android_rs:float3'>float3</a> in); 766 </td> 767 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 768 </td> 769 </tr> 770 <tr> 771 <td><a href='rs_value_types.html#android_rs:float3'>float3</a> rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, <a href='rs_value_types.html#android_rs:float2'>float2</a> in); 772 </td> 773 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 774 </td> 775 </tr> 776 <tr> 777 <td><a href='rs_value_types.html#android_rs:float3'>float3</a> rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, <a href='rs_value_types.html#android_rs:float3'>float3</a> in); 778 </td> 779 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 780 </td> 781 </tr> 782 <tr> 783 <td><a href='rs_value_types.html#android_rs:float4'>float4</a> rsMatrixMultiply(const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:float2'>float2</a> in); 784 </td> 785 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 786 </td> 787 </tr> 788 <tr> 789 <td><a href='rs_value_types.html#android_rs:float4'>float4</a> rsMatrixMultiply(const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:float3'>float3</a> in); 790 </td> 791 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 792 </td> 793 </tr> 794 <tr> 795 <td><a href='rs_value_types.html#android_rs:float4'>float4</a> rsMatrixMultiply(const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:float4'>float4</a> in); 796 </td> 797 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 798 </td> 799 </tr> 800 <tr> 801 <td><a href='rs_value_types.html#android_rs:float4'>float4</a> rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:float2'>float2</a> in); 802 </td> 803 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 804 </td> 805 </tr> 806 <tr> 807 <td><a href='rs_value_types.html#android_rs:float4'>float4</a> rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:float3'>float3</a> in); 808 </td> 809 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 810 </td> 811 </tr> 812 <tr> 813 <td><a href='rs_value_types.html#android_rs:float4'>float4</a> rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:float4'>float4</a> in); 814 </td> 815 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 816 </td> 817 </tr> 818 <tr> 819 <td>void rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m, const <a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* rhs); 820 </td> 821 <td> </td> 822 </tr> 823 <tr> 824 <td>void rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, const <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* rhs); 825 </td> 826 <td> </td> 827 </tr> 828 <tr> 829 <td>void rsMatrixMultiply(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, const <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* rhs); 830 </td> 831 <td> </td> 832 </tr> 833 </tbody></table> 834 </div> 835 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 836 <table class='jd-tagtable'><tbody> 837 <tr><th>m</th><td>Left matrix of the product and the matrix to be set.</td></tr> 838 <tr><th>rhs</th><td>Right matrix of the product.</td></tr> 839 <tr><th>in</th><td></td></tr> 840 </tbody></table> 841 </div> 842 <div class='jd-tagdata jd-tagdescr'> 843 <p> For the matrix by matrix variant, sets m to the matrix product <code>m * rhs</code>. 844 </p> 845 846 <p> When combining two 4x4 transformation matrices using this function, the resulting 847 matrix will correspond to performing the rhs transformation first followed by 848 the original m transformation. 849 </p> 850 851 <p> For the matrix by vector variant, returns the post-multiplication of the vector 852 by the matrix, ie. <code>m * in</code>. 853 </p> 854 855 <p> When multiplying a float3 to a <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>, the vector is expanded with (1). 856 </p> 857 858 <p> When multiplying a float2 to a <a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>, the vector is expanded with (0, 1). 859 </p> 860 861 <p> When multiplying a float2 to a <a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>, the vector is expanded with (0). 862 </p> 863 864 <p> Starting with API 14, this function takes a const matrix as the first argument. 865 </p> 866 </div> 867 </div> 868 869 <a name='android_rs:rsMatrixRotate'></a> 870 <div class='jd-details'> 871 <h4 class='jd-details-title'> 872 <span class='sympad'>rsMatrixRotate</span> 873 <span class='normal'>: Apply a rotation to a transformation matrix</span> 874 </h4> 875 <div class='jd-details-descr'> 876 <table class='jd-tagtable'><tbody> 877 <tr> 878 <td>void rsMatrixRotate(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float rot, float x, float y, float z); 879 </td> 880 <td> </td> 881 </tr> 882 </tbody></table> 883 </div> 884 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 885 <table class='jd-tagtable'><tbody> 886 <tr><th>m</th><td>Matrix to modify.</td></tr> 887 <tr><th>rot</th><td>How much rotation to do, in degrees.</td></tr> 888 <tr><th>x</th><td>X component of the vector that is the axis of rotation.</td></tr> 889 <tr><th>y</th><td>Y component of the vector that is the axis of rotation.</td></tr> 890 <tr><th>z</th><td>Z component of the vector that is the axis of rotation.</td></tr> 891 </tbody></table> 892 </div> 893 <div class='jd-tagdata jd-tagdescr'> 894 <p> Multiply the matrix m with a rotation matrix. 895 </p> 896 897 <p> This function modifies a transformation matrix to first do a rotation. The axis of 898 rotation is the <code>(x, y, z)</code> vector. 899 </p> 900 901 <p> To apply this combined transformation to a vector, multiply the vector by the created 902 matrix using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 903 </p> 904 </div> 905 </div> 906 907 <a name='android_rs:rsMatrixScale'></a> 908 <div class='jd-details'> 909 <h4 class='jd-details-title'> 910 <span class='sympad'>rsMatrixScale</span> 911 <span class='normal'>: Apply a scaling to a transformation matrix</span> 912 </h4> 913 <div class='jd-details-descr'> 914 <table class='jd-tagtable'><tbody> 915 <tr> 916 <td>void rsMatrixScale(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float x, float y, float z); 917 </td> 918 <td> </td> 919 </tr> 920 </tbody></table> 921 </div> 922 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 923 <table class='jd-tagtable'><tbody> 924 <tr><th>m</th><td>Matrix to modify.</td></tr> 925 <tr><th>x</th><td>Multiple to scale the x components by.</td></tr> 926 <tr><th>y</th><td>Multiple to scale the y components by.</td></tr> 927 <tr><th>z</th><td>Multiple to scale the z components by.</td></tr> 928 </tbody></table> 929 </div> 930 <div class='jd-tagdata jd-tagdescr'> 931 <p> Multiply the matrix m with a scaling matrix. 932 </p> 933 934 <p> This function modifies a transformation matrix to first do a scaling. When scaling, 935 each component of a vector is multiplied by a number. This number can be negative. 936 </p> 937 938 <p> To apply this combined transformation to a vector, multiply the vector by the created 939 matrix using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 940 </p> 941 </div> 942 </div> 943 944 <a name='android_rs:rsMatrixSet'></a> 945 <div class='jd-details'> 946 <h4 class='jd-details-title'> 947 <span class='sympad'>rsMatrixSet</span> 948 <span class='normal'>: Set one element</span> 949 </h4> 950 <div class='jd-details-descr'> 951 <table class='jd-tagtable'><tbody> 952 <tr> 953 <td>void rsMatrixSet(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> col, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> row, float v); 954 </td> 955 <td> </td> 956 </tr> 957 <tr> 958 <td>void rsMatrixSet(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> col, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> row, float v); 959 </td> 960 <td> </td> 961 </tr> 962 <tr> 963 <td>void rsMatrixSet(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> col, <a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> row, float v); 964 </td> 965 <td> </td> 966 </tr> 967 </tbody></table> 968 </div> 969 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 970 <table class='jd-tagtable'><tbody> 971 <tr><th>m</th><td>Matrix that will be modified.</td></tr> 972 <tr><th>col</th><td>Zero-based column of the element to be set.</td></tr> 973 <tr><th>row</th><td>Zero-based row of the element to be set.</td></tr> 974 <tr><th>v</th><td>Value to set.</td></tr> 975 </tbody></table> 976 </div> 977 <div class='jd-tagdata jd-tagdescr'> 978 <p> Set an element of a matrix. 979 </p> 980 981 <p> <b>Warning:</b> The order of the column and row parameters may be unexpected. 982 </p> 983 </div> 984 </div> 985 986 <a name='android_rs:rsMatrixTranslate'></a> 987 <div class='jd-details'> 988 <h4 class='jd-details-title'> 989 <span class='sympad'>rsMatrixTranslate</span> 990 <span class='normal'>: Apply a translation to a transformation matrix</span> 991 </h4> 992 <div class='jd-details-descr'> 993 <table class='jd-tagtable'><tbody> 994 <tr> 995 <td>void rsMatrixTranslate(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m, float x, float y, float z); 996 </td> 997 <td> </td> 998 </tr> 999 </tbody></table> 1000 </div> 1001 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 1002 <table class='jd-tagtable'><tbody> 1003 <tr><th>m</th><td>Matrix to modify.</td></tr> 1004 <tr><th>x</th><td>Number to add to each x component.</td></tr> 1005 <tr><th>y</th><td>Number to add to each y component.</td></tr> 1006 <tr><th>z</th><td>Number to add to each z component.</td></tr> 1007 </tbody></table> 1008 </div> 1009 <div class='jd-tagdata jd-tagdescr'> 1010 <p> Multiply the matrix m with a translation matrix. 1011 </p> 1012 1013 <p> This function modifies a transformation matrix to first do a translation. When 1014 translating, a number is added to each component of a vector. 1015 </p> 1016 1017 <p> To apply this combined transformation to a vector, multiply the vector by the 1018 created matrix using <a href='rs_matrix.html#android_rs:rsMatrixMultiply'>rsMatrixMultiply</a>(). 1019 </p> 1020 </div> 1021 </div> 1022 1023 <a name='android_rs:rsMatrixTranspose'></a> 1024 <div class='jd-details'> 1025 <h4 class='jd-details-title'> 1026 <span class='sympad'>rsMatrixTranspose</span> 1027 <span class='normal'>: Transpose a matrix place</span> 1028 </h4> 1029 <div class='jd-details-descr'> 1030 <table class='jd-tagtable'><tbody> 1031 <tr> 1032 <td>void rsMatrixTranspose(<a href='rs_value_types.html#android_rs:rs_matrix2x2'>rs_matrix2x2</a>* m); 1033 </td> 1034 <td> </td> 1035 </tr> 1036 <tr> 1037 <td>void rsMatrixTranspose(<a href='rs_value_types.html#android_rs:rs_matrix3x3'>rs_matrix3x3</a>* m); 1038 </td> 1039 <td> </td> 1040 </tr> 1041 <tr> 1042 <td>void rsMatrixTranspose(<a href='rs_value_types.html#android_rs:rs_matrix4x4'>rs_matrix4x4</a>* m); 1043 </td> 1044 <td> </td> 1045 </tr> 1046 </tbody></table> 1047 </div> 1048 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 1049 <table class='jd-tagtable'><tbody> 1050 <tr><th>m</th><td>Matrix to transpose.</td></tr> 1051 </tbody></table> 1052 </div> 1053 <div class='jd-tagdata jd-tagdescr'> 1054 <p> Transpose the matrix m in place. 1055 </p> 1056 </div> 1057 </div> 1058 1059 </div> 1060