]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/doc/quat_traits.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / qvm / doc / quat_traits.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>quat_traits</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>quat_traits</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_quat_traits_hpp.html">boost/qvm/quat_traits.hpp</a></span>&gt;</p>
22 <pre>namespace
23 boost
24 {
25 namespace
26 <span class="RenoLink"><a href="qvm.html">qvm</a></span>
27 {
28 <span class="RenoIncludeSPAN"> template &lt;class Q&gt;
29 struct <span class="RenoLink">quat_traits</span>
30 {
31 /*main template members unspecified*/
32 };
33
34 /*
35 User-defined (possibly partial) specializations:
36
37 template &lt;&gt;
38 struct <span class="RenoLink">quat_traits</span>&lt;Q&gt;
39 {
40 <span class="RenoIncludeSPAN"> typedef /*user-defined*/ <span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span>;</span>
41
42 <span class="RenoIncludeSPAN"> template &lt;int I&gt; static inline <span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span> <span class="RenoLink"><a href="quat_traits_Q_read_element.html">read_element</a></span>( Quaternion const &amp; q );</span>
43 <span class="RenoIncludeSPAN"> template &lt;int I&gt; static inline <span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span> &amp; <span class="RenoLink"><a href="quat_traits_Q_write_element.html">write_element</a></span>( Quaternion &amp; q );</span>
44 };
45 */</span>
46 }
47 }</pre>
48 </div><p>The <i><span class="RenoLink">quat_traits</span></i> template must be specialized for (user-defined) quaternion types in order to enable quaternion operations defined in Boost QVM headers for objects of those types.</p>
49 <p><i>Note: quaternion types are not required to be copyable.</i></p>
50 <p>The main <i><span class="RenoLink">quat_traits</span></i> template members are not specified. Valid specializations are required to define the following members:</p>
51 <div><ul><li> <i><span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span></i>: the expression <i><span class="RenoLink">quat_traits</span>&lt;Quaternion&gt;::<span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span></i> must be a value type which satisfies the <span class="RenoLink"><a href="scalar_requirements.html">scalar requirements</a></span>.</li>
52 </ul></div>
53 <p>In addition, valid specializations of the <i><span class="RenoLink">quat_traits</span></i> template must define at least one of the following access functions as static members, where <i>q</i> is an object of type Quaternion, and <i>I</i> is compile-time integer constant:</p>
54 <div><ul><li> <i><span class="RenoLink"><a href="quat_traits_Q_read_element.html">read_element</a></span></i>: the expression <i><span class="RenoLink">quat_traits</span>&lt;Quaternion&gt;::<span class="RenoLink"><a href="quat_traits_Q_read_element.html">read_element</a></span>&lt;I&gt;(q)</i> returns either a copy of or a const reference to the <i>I</i>-th element of <i>q</i>.</li>
55 <li> <i><span class="RenoLink"><a href="quat_traits_Q_write_element.html">write_element</a></span></i>: the expression <i><span class="RenoLink">quat_traits</span>&lt;Quaternion&gt;::<span class="RenoLink"><a href="quat_traits_Q_write_element.html">write_element</a></span>&lt;I&gt;(q)</i> returns mutable reference to the <i>I</i>-th element of <i>q</i>.</li>
56 </ul></div>
57 <div class="RenoIncludeDIV"><p><b>Note:</b> For the quaternion <i>a + bi + cj + dk</i>, the elements are assumed to be in the following order: <i>a</i>, <i>b</i>, <i>c</i>, <i>d</i>; that is, <i>I</i>=<i>0</i>/<i>1</i>/<i>2</i>/<i>3</i> would access <i>a</i>/<i>b</i>/<i>c</i>/<i>d</i>.</p>
58 </div><p>It is illegal to call any of the above functions unless <i><span class="RenoLink"><a href="is_quat.html">is_quat</a></span>&lt;Quaternion&gt;::value</i>' is true. Even then, quaternion types are allowed to define only a subset of the access functions.</p>
59 <p>Below is an example of a user-defined quaternion type, and its corresponding specialization of the <i><span class="RenoLink">quat_traits</span></i> template:</p>
60 <div class="RenoIncludeDIV"><pre>#include &lt;<span class="RenoLink"><a href="boost_qvm_quat_traits_hpp.html">boost/qvm/quat_traits.hpp</a></span>&gt;
61
62 struct fquat { float a[4]; };
63
64 namespace boost
65 {
66 namespace <span class="RenoLink"><a href="qvm.html">qvm</a></span>
67 {
68 template &lt;&gt;
69 struct
70 <span class="RenoLink">quat_traits</span>&lt;fquat&gt;
71 {
72 typedef float <span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span>;
73
74 template &lt;int I&gt; static inline <span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span> &amp; <span class="RenoLink"><a href="quat_traits_Q_write_element.html">write_element</a></span>( fquat &amp; q ) { return q.a[I]; }
75 template &lt;int I&gt; static inline <span class="RenoLink"><a href="quat_traits_Q_scalar_type.html">scalar_type</a></span> <span class="RenoLink"><a href="quat_traits_Q_read_element.html">read_element</a></span>( fquat const &amp; q ) { return q.a[I]; }
76 };
77 }
78 }</pre>
79 </div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
80 See also: <span class="RenoPageList"><a href="boost_qvm_quat_traits_hpp.html">boost/qvm/quat_traits.hpp</a>&nbsp;| <a href="boost_qvm_quat_traits_array_hpp.html">boost/qvm/quat_traits_array.hpp</a>&nbsp;| <a href="is_quat.html">is_quat</a>&nbsp;| <a href="mag_quat_.html">mag(quat)</a>&nbsp;| <a href="mag_sqr_quat_.html">mag_sqr(quat)</a>&nbsp;| <a href="normalize_quat_.html">normalize(quat)</a>&nbsp;| <a href="quat.html">quat</a>&nbsp;| <a href="quat_traits_Q_read_element.html">quat_traits&lt;Q&gt;::read_element</a>&nbsp;| <a href="quat_traits_Q_scalar_type.html">quat_traits&lt;Q&gt;::scalar_type</a>&nbsp;| <a href="quat_traits_Q_write_element.html">quat_traits&lt;Q&gt;::write_element</a>&nbsp;| <a href="rotate_quat_vec_scalar_.html">rotate(quat,vec,scalar)</a>&nbsp;| <a href="rotate_x_quat_scalar_.html">rotate_x(quat,scalar)</a>&nbsp;| <a href="rotate_y_quat_scalar_.html">rotate_y(quat,scalar)</a>&nbsp;| <a href="rotate_z_quat_scalar_.html">rotate_z(quat,scalar)</a>&nbsp;| <a href="scalar.html">scalar</a>&nbsp;| <a href="set_identity_quat_.html">set_identity(quat)</a>&nbsp;| <a href="set_rotx_quat_scalar_.html">set_rotx(quat,scalar)</a>&nbsp;| <a href="set_roty_quat_scalar_.html">set_roty(quat,scalar)</a>&nbsp;| <a href="set_rotz_quat_scalar_.html">set_rotz(quat,scalar)</a>&nbsp;| <a href="set_zero_quat_.html">set_zero(quat)</a>&nbsp;| <a href="view_proxy.html">View Proxy</a></span>
81 </div>
82 <!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. -->
83 <!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
84 <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
85 <div id="footer">
86 <p>
87 <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>
88 <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>
89 <small>Copyright (c) 2008-2016 by Emil Dotchevski and Reverge Studios, Inc.<br/>
90 Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
91 </p>
92 </div>
93 </div>
94 </div>
95 </div>
96 </body>
97 </html>