]>
Commit | Line | Data |
---|---|---|
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>c arrays</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>C Arrays</h3> | |
20 | </div> | |
21 | <p>In <i><span class="RenoLink"><a href="boost_qvm_quat_traits_array_hpp.html">boost/qvm/quat_traits_array.hpp</a></span></i>, <i><span class="RenoLink"><a href="boost_qvm_vec_traits_array_hpp.html">boost/qvm/vec_traits_array.hpp</a></span></i> and <i><span class="RenoLink"><a href="boost_qvm_mat_traits_array_hpp.html">boost/qvm/mat_traits_array.hpp</a></span></i> Boost QVM defines appropriate <i><span class="RenoLink"><a href="quat_traits.html">quat_traits</a></span></i>, <i><span class="RenoLink"><a href="vec_traits.html">vec_traits</a></span></i> and <i><span class="RenoLink"><a href="mat_traits.html">mat_traits</a></span></i> specializations that allow Boost QVM functions to operate directly on plain old C arrays:</p> | |
22 | <pre>float v[3] = {0,0,7}; | |
23 | float3 vrot = <span class="RenoLink"><a href="rotx_mat_scalar_.html">rotx_mat</a></span><3>(3.14159f) <span class="RenoLink"><a href="operator_times_mat_vec_.html">*</a></span> v;</pre> | |
24 | <p>Naturally, operator overloads cannot kick in if all elements of an expression are of built-in types. The following is illegal:</p> | |
25 | <pre>float v[3] = {0,0,7}; | |
26 | v *= 42;</pre> | |
27 | <p>The <i><span class="RenoLink"><a href="vref.html">vref</a></span></i> and <i><span class="RenoLink"><a href="mref.html">mref</a></span></i> function templates can be used to work around this issue:</p> | |
28 | <pre>float v[3] = {0,0,7}; | |
29 | <span class="RenoLink"><a href="vref.html">vref</a></span>(v) <span class="RenoLink"><a href="operator_mul_eq_vec_scalar_.html">*=</a></span> 42;</pre> | |
30 | </div><div class="RenoIncludeDIV"><div class="RenoHR"><hr/></div> | |
31 | <p><b>Tutorial navigation:</b> <span class="RenoLink"><a href="quaternions_vectors_matrices.html">Quaternions, Vectors, Matrices</a></span> | <span class="RenoLink">C Arrays</span> | <span class="RenoLink"><a href="Views.html">Views</a></span> | <span class="RenoLink"><a href="Swizzling.html">Swizzling</a></span> | <span class="RenoLink"><a href="Interoperability.html">Interoperability</a></span><span class="RenoBR"> </span><br/><span class="RenoBR"> </span><br/>See also: <span class="RenoLink"><a href="index.html">Boost QVM</a></span></p> | |
32 | </div><!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. --> | |
33 | <!-- Distributed under the Boost Software License, Version 1.0. (See accompanying --> | |
34 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> | |
35 | <div id="footer"> | |
36 | <p> | |
37 | <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> | |
38 | <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> | |
39 | <small>Copyright (c) 2008-2016 by Emil Dotchevski and Reverge Studios, Inc.<br/> | |
40 | Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small> | |
41 | </p> | |
42 | </div> | |
43 | </div> | |
44 | </div> | |
45 | </div> | |
46 | </body> | |
47 | </html> |