]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/qvm/doc/accessing_vector_elements_and_swizzling_reference.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / qvm / doc / accessing_vector_elements_and_swizzling_reference.html
CommitLineData
7c673cae
FG
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>accessing vector elements by 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>Accessing Vector Elements by Swizzling</h3>
20</div>
21<div class="RenoIncludeDIV"><p><span class="RenoEscape">&#35;<!--<wiki>`&#35;</wiki>--></span>include &lt;<span class="RenoLink"><a href="boost_qvm_swizzle_hpp.html">boost/qvm/swizzle.hpp</a></span>&gt;</p>
22<pre>namespace boost
23{
24 namespace <span class="RenoLink"><a href="qvm.html">qvm</a></span>
25 {
26<span class="RenoIncludeSPAN"> //*** Accessing vector elements by swizzling ***
27
28 <span class="RenoIncludeSPAN">//2D <span class="RenoLink"><a href="view_proxy.html">view proxies</a></span>, only <span class="RenoLink"><a href="SFINAE_enable_if.html">enabled if</a></span>:
29 // <span class="RenoLink"><a href="is_vec.html">is_vec</a></span>&lt;V&gt;::value
30 template &lt;class V&gt; -unspecified-2D-vector-type- XX( V &amp; v );
31 template &lt;class V&gt; -unspecified-2D-vector-type- XY( V &amp; v );
32 template &lt;class V&gt; -unspecified-2D-vector-type- XZ( V &amp; v );
33 template &lt;class V&gt; -unspecified-2D-vector-type- XW( V &amp; v );
34 template &lt;class V&gt; -unspecified-2D-vector-type- X0( V &amp; v );
35 template &lt;class V&gt; -unspecified-2D-vector-type- X1( V &amp; v );
36 template &lt;class V&gt; -unspecified-2D-vector-type- YX( V &amp; v );
37 template &lt;class V&gt; -unspecified-2D-vector-type- YY( V &amp; v );
38 template &lt;class V&gt; -unspecified-2D-vector-type- YZ( V &amp; v );
39 template &lt;class V&gt; -unspecified-2D-vector-type- YW( V &amp; v );
40 template &lt;class V&gt; -unspecified-2D-vector-type- Y0( V &amp; v );
41 template &lt;class V&gt; -unspecified-2D-vector-type- Y1( V &amp; v );
42 template &lt;class V&gt; -unspecified-2D-vector-type- ZX( V &amp; v );
43 template &lt;class V&gt; -unspecified-2D-vector-type- ZY( V &amp; v );
44 template &lt;class V&gt; -unspecified-2D-vector-type- ZZ( V &amp; v );
45 template &lt;class V&gt; -unspecified-2D-vector-type- ZW( V &amp; v );
46 template &lt;class V&gt; -unspecified-2D-vector-type- Z0( V &amp; v );
47 template &lt;class V&gt; -unspecified-2D-vector-type- Z1( V &amp; v );
48 template &lt;class V&gt; -unspecified-2D-vector-type- WX( V &amp; v );
49 template &lt;class V&gt; -unspecified-2D-vector-type- WY( V &amp; v );
50 template &lt;class V&gt; -unspecified-2D-vector-type- WZ( V &amp; v );
51 template &lt;class V&gt; -unspecified-2D-vector-type- WW( V &amp; v );
52 template &lt;class V&gt; -unspecified-2D-vector-type- W0( V &amp; v );
53 template &lt;class V&gt; -unspecified-2D-vector-type- W1( V &amp; v );
54 ...
55 -unspecified-2D-vector-type- _00();
56 -unspecified-2D-vector-type- _01();
57 -unspecified-2D-vector-type- _10();
58 -unspecified-2D-vector-type- _11();
59
60 //3D <span class="RenoLink"><a href="view_proxy.html">view proxies</a></span>, only <span class="RenoLink"><a href="SFINAE_enable_if.html">enabled if</a></span>:
61 // <span class="RenoLink"><a href="is_vec.html">is_vec</a></span>&lt;V&gt;::value
62 template &lt;class V&gt; -unspecified-3D-vector-type- XXX( V &amp; v );
63 ...
64 template &lt;class V&gt; -unspecified-3D-vector-type- XXW( V &amp; v );
65 template &lt;class V&gt; -unspecified-3D-vector-type- XX0( V &amp; v );
66 template &lt;class V&gt; -unspecified-3D-vector-type- XX1( V &amp; v );
67 template &lt;class V&gt; -unspecified-3D-vector-type- XYX( V &amp; v );
68 ...
69 template &lt;class V&gt; -unspecified-3D-vector-type- XY1( V &amp; v );
70 ...
71 template &lt;class V&gt; -unspecified-3D-vector-type- WW1( V &amp; v );
72 ...
73 -unspecified-3D-vector-type- _000();
74 -unspecified-3D-vector-type- _001();
75 -unspecified-3D-vector-type- _010();
76 ...
77 -unspecified-3D-vector-type- _111();
78
79 //4D <span class="RenoLink"><a href="view_proxy.html">view proxies</a></span>, only <span class="RenoLink"><a href="SFINAE_enable_if.html">enabled if</a></span>:
80 // <span class="RenoLink"><a href="is_vec.html">is_vec</a></span>&lt;V&gt;::value
81 template &lt;class V&gt; -unspecified-4D-vector-type- XXXX( V &amp; v );
82 ...
83 template &lt;class V&gt; -unspecified-4D-vector-type- XXXW( V &amp; v );
84 template &lt;class V&gt; -unspecified-4D-vector-type- XXX0( V &amp; v );
85 template &lt;class V&gt; -unspecified-4D-vector-type- XXX1( V &amp; v );
86 template &lt;class V&gt; -unspecified-4D-vector-type- XXYX( V &amp; v );
87 ...
88 template &lt;class V&gt; -unspecified-4D-vector-type- XXY1( V &amp; v );
89 ...
90 template &lt;class V&gt; -unspecified-4D-vector-type- WWW1( V &amp; v );
91 ...
92 -unspecified-4D-vector-type- _0000();
93 -unspecified-4D-vector-type- _0001();
94 -unspecified-4D-vector-type- _0010();
95 ...
96 -unspecified-4D-vector-type- _1111();</span> </span>
97 }
98}</pre>
99</div><p>Swizzling allows zero-overhead direct access to a (possibly rearranged) subset of the elements of 2D, 3D and 4D vectors. For example, if <i>v</i> is a 4D vector, the expression <i>(v,YX)</i> is a 2D <span class="RenoLink"><a href="view_proxy.html">view proxy</a></span> whose <i>X</i> element refers to the <i>Y</i> element of <i>v</i>, and whose <i>Y</i> element refers to the <i>X</i> element of <i>v</i>. Like other <span class="RenoLink"><a href="view_proxy.html">view proxies</a></span> <i>YX</i> is an lvalue, that is, if <i>v2</i> is a 2D vector, one could write:</p>
100<pre>YX(v) = v2;</pre>
101<p>The above will leave the <i>Z</i> and <i>W</i> elements of <i>v</i> unchanged but assign the <i>Y</i> element of <i>v2</i> to the <i>X</i> element of <i>v</i> and the <i>X</i> element of <i>v2</i> to the <i>Y</i> element of <i>v</i>.</p>
102<p>It is also possible to repeat the same vector element in rvalue swizzling: the expression <i>ZZZ(v)</i> is a 3D vector whose <i>X</i>, <i>Y</i> and <i>Z</i> elements all refer to the <i>Z</i> element of <i>v</i>.</p>
103</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
104See also: <span class="RenoPageList"><a href="index.html">Boost QVM</a>&nbsp;| <a href="boost_qvm_swizzle2_hpp.html">boost/qvm/swizzle2.hpp</a>&nbsp;| <a href="boost_qvm_swizzle3_hpp.html">boost/qvm/swizzle3.hpp</a>&nbsp;| <a href="boost_qvm_swizzle4_hpp.html">boost/qvm/swizzle4.hpp</a>&nbsp;| <a href="Synopsis.html">Synopsis</a>&nbsp;| <a href="transform_point.html">transform_point</a>&nbsp;| <a href="transform_vector.html">transform_vector</a></span>
105</div>
106<!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. -->
107<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
108<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
109<div id="footer">
110<p>
111<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>
112<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>
113<small>Copyright (c) 2008-2016 by Emil Dotchevski and Reverge Studios, Inc.<br/>
114Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
115</p>
116</div>
117</div>
118</div>
119</div>
120</body>
121</html>