]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/doc/Swizzling.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / qvm / doc / Swizzling.html
1 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
2 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
3 <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
4 <head>
5 <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
6 <title>Swizzling</title>
7 <link href='reno.css' type='text/css' rel='stylesheet'/>
8 </head>
9 <body>
10 <div class="body-0">
11 <div class="body-1">
12 <div class="body-2">
13 <div>
14 <h1>QVM: Quaternions, Vectors, Matrices</h1>
15 </div>
16 <!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. -->
17 <!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
18 <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
19 <div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Swizzling</h3>
20 </div>
21 <p>Boost QVM allows <span class="RenoLink"><a href="accessing_vector_elements_and_swizzling_reference.html">accessing vector elements by swizzling</a></span>, exposing vector views of different dimensions, and/or views with reordered elements. The example below rotates <i>v</i> around the X axis, and stores the resulting vector back in <i>v</i> but with the X and Y elements swapped:</p>
22 <pre>float3 v = {0,0,7};
23 <span class="RenoLink"><a href="accessing_vector_elements_and_swizzling_reference.html">YXZ</a></span>(v) = <span class="RenoLink"><a href="rotx_mat_scalar_.html">rotx_mat</a></span>&lt;3&gt;(3.14159f) <span class="RenoLink"><a href="operator_times_mat_vec_.html">*</a></span> v;</pre>
24 <p>A special case of swizzling provides next-dimension-view of a vector object, adding either 0 or 1 as its last component. Assuming <i>float3</i> is a 3D vector type, and <i>float4</i> is a 4D vector type, the following statements are valid:</p>
25 <pre>float3 v = {0,0,7};
26 float4 point = <span class="RenoLink"><a href="accessing_vector_elements_and_swizzling_reference.html">XYZ1</a></span>(v); //{0,0,7,1}
27 float4 vector = <span class="RenoLink"><a href="accessing_vector_elements_and_swizzling_reference.html">XYZ0</a></span>(v); //{0,0,7,0}</pre>
28 <p>It is also valid for swizzling to address vector elements more than once:</p>
29 <pre>float3 v = {0,0,7};
30 float4 v1 = <span class="RenoLink"><a href="accessing_vector_elements_and_swizzling_reference.html">ZZZZ</a></span>(v); //{7,7,7,7}</pre>
31 <p>Boost QVM defines all permutations of <i>X</i>, <i>Y</i>, <i>Z</i>, <i>W</i> for 1D, 2D, 3D and 4D swizzling, plus each dimension defines variants with <i>0</i> or <i>1</i> used at any position (if 0 or 1 appear at the first position, the swizzling function name begins with underscore, e.g. <i>_1XY</i>).</p>
32 </div><div class="RenoIncludeDIV"><div class="RenoHR"><hr/></div>
33 <p><b>Tutorial navigation:</b> <span class="RenoLink"><a href="quaternions_vectors_matrices.html">Quaternions, Vectors, Matrices</a></span> | <span class="RenoLink"><a href="c_arrays.html">C Arrays</a></span> | <span class="RenoLink"><a href="Views.html">Views</a></span> | <span class="RenoLink">Swizzling</span> | <span class="RenoLink"><a href="Interoperability.html">Interoperability</a></span><span class="RenoBR">&nbsp;</span><br/><span class="RenoBR">&nbsp;</span><br/>See also: <span class="RenoLink"><a href="index.html">Boost QVM</a></span></p>
34 </div><!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. -->
35 <!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
36 <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
37 <div id="footer">
38 <p>
39 <a class="logo" href="http://jigsaw.w3.org/css-validator/check/referer"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a>
40 <a class="logo" href="http://validator.w3.org/check?uri=referer"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a>
41 <small>Copyright (c) 2008-2016 by Emil Dotchevski and Reverge Studios, Inc.<br/>
42 Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
43 </p>
44 </div>
45 </div>
46 </div>
47 </div>
48 </body>
49 </html>