Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > cd34bbe24503efb80ebebb7e33511ba0 > files > 121

libQGLViewer-doc-2.3.1-10.fc12.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>libQGLViewer: Quaternion Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="../images/qglviewer.ico" type="image/x-icon" /><link rel="icon" href="../images/qglviewer.icon.png" type="image/png" />
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="../index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>

    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
  </div>
</div>
<div class="contents">
<h1>Quaternion Class Reference</h1><!-- doxytag: class="qglviewer::Quaternion" -->The <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> class represents 3D rotations and orientations.  
<a href="#_details">More...</a>
<p>

<p>
<a href="classqglviewer_1_1Quaternion-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defining a Quaternion</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#65ed15cc19af958b5933b5c522f10e66">Quaternion</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#d0347716e801bcdeab909493817edc85">Quaternion</a> (const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;axis, double angle)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#1b60be34a715145efc3b91e6dfba1634">Quaternion</a> (const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;from, const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;to)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#81ba24ffd95778f3ca4e51b2b9922f45">Quaternion</a> (double q0, double q1, double q2, double q3)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#71a4d1a3b760854468ff270a982e5f59">Quaternion</a> (const Quaternion &amp;Q)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#d20a1310f5fac88d5e00fa055e09fe72">operator=</a> (const Quaternion &amp;Q)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#d6bd25e80a18f6bd38ae5c4e5337b53b">setAxisAngle</a> (const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;axis, double angle)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#be7dd94e4fb48e0c8e0d994cac84064a">setValue</a> (double q0, double q1, double q2, double q3)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#1880f20e8080ee670b6a88ed0c7d69ac">setFromRotationMatrix</a> (const double m[3][3])</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#760617f082c950633b5642d2f60b2dd9">setFromRotatedBasis</a> (const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;X, const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;Y, const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;Z)</td></tr>

<tr><td colspan="2"><br><h2>Accessing values</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">float&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#46b7892fe36e140862b9c71e5cfe8292">getAxisAngle</a> (<a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;axis, float &amp;angle) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#605b34d1fc87b2ccaf49a45419c2e46f">operator[]</a> (int i) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">double &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#f1a8c9c4769161714a5a1a2c7fad446b">operator[]</a> (int i)</td></tr>

<tr><td colspan="2"><br><h2>Rotation computations</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#0caef8e6e702101a45fdc0af3920c49d">operator*=</a> (const Quaternion &amp;q)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#5e2421069d88e576334e10f634625815">rotate</a> (const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;v) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#74d79bc1afcc02fdbfe0eb390c3546f5">inverseRotate</a> (const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;v) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#76b3ffdb188246ff6559069cb3f5b919">operator*</a> (const Quaternion &amp;a, const Quaternion &amp;b)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#19ce6efe5ef2744c8293e8ba1a39b9e4">operator*</a> (const Quaternion &amp;q, const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;v)</td></tr>

<tr><td colspan="2"><br><h2>Inversion</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#7fa1616cc61c19a5efcc863c950f7f30">invert</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#bcdb1512395327f8236a4f4a4d4ff648">negate</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#05826e509c686f39baaec4656f1a7231">normalize</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#e347ecf6e0a78618e8fd1a3b9107df32">normalized</a> () const </td></tr>

<tr><td colspan="2"><br><h2>Associated matrix</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const GLdouble *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#a12123cf45f68b9f7fe0526b70ab0047">matrix</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix</a> (GLdouble m[4][4]) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#15f0dc7596dc78437154302466ac3c0a">getMatrix</a> (GLdouble m[16]) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#ad37aa66da74be6fb8d9d66f059f0872">getRotationMatrix</a> (float m[3][3]) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">const GLdouble *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#32992f152b7377da431c69f15384ed22">inverseMatrix</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#ee97ea226e31ac805a2245e7c73dac7b">getInverseMatrix</a> (GLdouble m[4][4]) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#315cf039df621a101a953df20acc7155">getInverseMatrix</a> (GLdouble m[16]) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#e1455acb1cbf59befe65295734d48c4a">getInverseRotationMatrix</a> (float m[3][3]) const </td></tr>

<tr><td colspan="2"><br><h2>Slerp interpolation</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#4db67fbb8171a5e781b56404112cf848">log</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#5c546a33cc0c65f24b7e9c48e5069ba7">exp</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#755201c9a752fd892a3656a517b190e4">slerp</a> (const Quaternion &amp;a, const Quaternion &amp;b, float t, bool allowFlip=true)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#4b218b205d88a4dd50c8de38522b5812">squad</a> (const Quaternion &amp;a, const Quaternion &amp;tgA, const Quaternion &amp;tgB, const Quaternion &amp;b, float t)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#80d06247e39abf2980e56d2fe8c4bb83">dot</a> (const Quaternion &amp;a, const Quaternion &amp;b)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#f4c74176967acca6e3947977351e1c68">lnDif</a> (const Quaternion &amp;a, const Quaternion &amp;b)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#2a27d43a68da6c7c5243fe81e5a9d005">squadTangent</a> (const Quaternion &amp;before, const Quaternion &amp;center, const Quaternion &amp;after)</td></tr>

<tr><td colspan="2"><br><h2>XML representation</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#87faf5efc96c9b5af85a611985b6618f">Quaternion</a> (const QDomElement &amp;element)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">QDomElement&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#48e0e2dd26cd96418c8b889ceabe80f6">domElement</a> (const QString &amp;name, QDomDocument &amp;document) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#cd13d2ddeca530cb9f26ead47f7d25d3">initFromDOMElement</a> (const QDomElement &amp;element)</td></tr>

<tr><td colspan="2"><br><h2>Output stream</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::ostream &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#16d5f2f021103b05006b0c58fbd48796">operator&lt;&lt;</a> (std::ostream &amp;o, const <a class="el" href="classqglviewer_1_1Vec.html">qglviewer::Vec</a> &amp;)</td></tr>

<tr><td colspan="2"><br><h2>Random Quaternion</h2></td></tr>
<tr><td colspan="2"><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static Quaternion&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classqglviewer_1_1Quaternion.html#87d5e98d958fdc63100979fcff1d9976">randomQuaternion</a> ()</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> class represents 3D rotations and orientations. 
<p>
The <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> is an appropriate (although not very intuitive) representation for 3D rotations and orientations. Many tools are provided to ease the definition of a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>: see constructors, <a class="el" href="classqglviewer_1_1Quaternion.html#d6bd25e80a18f6bd38ae5c4e5337b53b">setAxisAngle()</a>, <a class="el" href="classqglviewer_1_1Quaternion.html#1880f20e8080ee670b6a88ed0c7d69ac">setFromRotationMatrix()</a>, <a class="el" href="classqglviewer_1_1Quaternion.html#760617f082c950633b5642d2f60b2dd9">setFromRotatedBasis()</a>.<p>
You can apply the rotation represented by the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> to 3D points using <a class="el" href="classqglviewer_1_1Quaternion.html#5e2421069d88e576334e10f634625815">rotate()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#74d79bc1afcc02fdbfe0eb390c3546f5">inverseRotate()</a>. See also the <a class="el" href="classqglviewer_1_1Frame.html" title="The Frame class represents a coordinate system, defined by a position and an orientation...">Frame</a> class that represents a coordinate system and provides other conversion functions like <a class="el" href="classqglviewer_1_1Frame.html#c706b338b08d9d7b511fd84d0b6ecf96">Frame::coordinatesOf()</a> and <a class="el" href="classqglviewer_1_1Frame.html#05a3e18419f02427366a95b1e299f12e">Frame::transformOf()</a>.<p>
You can apply the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> <code>q</code> rotation to the OpenGL matrices using: <div class="fragment"><pre class="fragment">        glMultMatrixd(q.matrix());
        <span class="comment">// equvalent to glRotate(q.angle()*180.0/M_PI, q.axis().x, q.axis().y, q.axis().z);</span>
</pre></div><p>
</pre></div><p>
<h3>Internal representation</h3>
<p>
The internal representation of a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> corresponding to a rotation around axis <code>axis</code>, with an angle <code>alpha</code> is made of four doubles q[i]: <div class="fragment"><pre class="fragment">        {q[0],q[1],q[2]} = sin(alpha/2) * {<a class="code" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis</a>[0],<a class="code" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis</a>[1],axis[2]}
        q[3] = cos(alpha/2)
</pre></div><p>
Note that certain implementations place the cosine term in first position (instead of last here).<p>
The <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> is always normalized, so that its <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a> is actually its conjugate.<p>
See also the <a class="el" href="classqglviewer_1_1Vec.html" title="The Vec class represents 3D positions and 3D vectors.">Vec</a> and <a class="el" href="classqglviewer_1_1Frame.html" title="The Frame class represents a coordinate system, defined by a position and an orientation...">Frame</a> classes' documentations. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="65ed15cc19af958b5933b5c522f10e66"></a><!-- doxytag: member="qglviewer::Quaternion::Quaternion" ref="65ed15cc19af958b5933b5c522f10e66" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Default constructor, builds an identity rotation. 
</div>
</div><p>
<a class="anchor" name="d0347716e801bcdeab909493817edc85"></a><!-- doxytag: member="qglviewer::Quaternion::Quaternion" ref="d0347716e801bcdeab909493817edc85" args="(const Vec &amp;axis, double angle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>axis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>angle</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Constructor from rotation axis (non null) and angle (in radians). See also <a class="el" href="classqglviewer_1_1Quaternion.html#d6bd25e80a18f6bd38ae5c4e5337b53b">setAxisAngle()</a>. 
</div>
</div><p>
<a class="anchor" name="1b60be34a715145efc3b91e6dfba1634"></a><!-- doxytag: member="qglviewer::Quaternion::Quaternion" ref="1b60be34a715145efc3b91e6dfba1634" args="(const Vec &amp;from, const Vec &amp;to)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>to</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Constructs a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> that will rotate from the <code>from</code> direction to the <code>to</code> direction.<p>
Note that this rotation is not uniquely defined. The selected axis is usually orthogonal to <code>from</code> and <code>to</code>. However, this method is robust and can handle small or almost identical vectors. 
</div>
</div><p>
<a class="anchor" name="81ba24ffd95778f3ca4e51b2b9922f45"></a><!-- doxytag: member="qglviewer::Quaternion::Quaternion" ref="81ba24ffd95778f3ca4e51b2b9922f45" args="(double q0, double q1, double q2, double q3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion           </td>
          <td>(</td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Constructor from the four values of a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. First three values are axis*sin(angle/2) and last one is cos(angle/2).<p>
<dl class="attention" compact><dt><b>Attention:</b></dt><dd>The identity <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> is Quaternion(0,0,0,1) and <em>not</em> Quaternion(0,0,0,0) (which is not unitary). The default <a class="el" href="classqglviewer_1_1Quaternion.html#65ed15cc19af958b5933b5c522f10e66">Quaternion()</a> creates such identity <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. </dd></dl>

</div>
</div><p>
<a class="anchor" name="71a4d1a3b760854468ff270a982e5f59"></a><!-- doxytag: member="qglviewer::Quaternion::Quaternion" ref="71a4d1a3b760854468ff270a982e5f59" args="(const Quaternion &amp;Q)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>Q</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Copy constructor. 
</div>
</div><p>
<a class="anchor" name="87faf5efc96c9b5af85a611985b6618f"></a><!-- doxytag: member="qglviewer::Quaternion::Quaternion" ref="87faf5efc96c9b5af85a611985b6618f" args="(const QDomElement &amp;element)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion           </td>
          <td>(</td>
          <td class="paramtype">const QDomElement &amp;&nbsp;</td>
          <td class="paramname"> <em>element</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Constructs a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> from a <code>QDomElement</code> representing an XML code of the form <div class="fragment"><pre class="fragment"> &lt; anyTagName q0=<span class="stringliteral">".."</span> q1=<span class="stringliteral">".."</span> q2=<span class="stringliteral">".."</span> q3=<span class="stringliteral">".."</span> /&gt;
</pre></div><p>
If one of these attributes is missing or is not a number, a warning is displayed and the associated value is respectively set to 0, 0, 0 and 1 (identity <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>).<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#48e0e2dd26cd96418c8b889ceabe80f6">domElement()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#cd13d2ddeca530cb9f26ead47f7d25d3">initFromDOMElement()</a>. 
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="d20a1310f5fac88d5e00fa055e09fe72"></a><!-- doxytag: member="qglviewer::Quaternion::operator=" ref="d20a1310f5fac88d5e00fa055e09fe72" args="(const Quaternion &amp;Q)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion&amp; operator=           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>Q</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Equal operator. 
</div>
</div><p>
<a class="anchor" name="d6bd25e80a18f6bd38ae5c4e5337b53b"></a><!-- doxytag: member="qglviewer::Quaternion::setAxisAngle" ref="d6bd25e80a18f6bd38ae5c4e5337b53b" args="(const Vec &amp;axis, double angle)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void setAxisAngle           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>axis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>angle</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> as a rotation of axis <code>axis</code> and angle <code>angle</code> (in radians).<p>
<code>axis</code> does not need to be normalized. A null <code>axis</code> will result in an identity <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. 
</div>
</div><p>
<a class="anchor" name="be7dd94e4fb48e0c8e0d994cac84064a"></a><!-- doxytag: member="qglviewer::Quaternion::setValue" ref="be7dd94e4fb48e0c8e0d994cac84064a" args="(double q0, double q1, double q2, double q3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void setValue           </td>
          <td>(</td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>q3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> value. See the <a class="el" href="classqglviewer_1_1Quaternion.html#81ba24ffd95778f3ca4e51b2b9922f45">Quaternion(double, double, double, double)</a> constructor documentation. 
</div>
</div><p>
<a class="anchor" name="1880f20e8080ee670b6a88ed0c7d69ac"></a><!-- doxytag: member="qglviewer::Quaternion::setFromRotationMatrix" ref="1880f20e8080ee670b6a88ed0c7d69ac" args="(const double m[3][3])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void setFromRotationMatrix           </td>
          <td>(</td>
          <td class="paramtype">const double&nbsp;</td>
          <td class="paramname"> <em>m</em>[3][3]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> from a (supposedly correct) 3x3 rotation matrix.<p>
The matrix is expressed in European format: its three <em>columns</em> are the images by the rotation of the three vectors of an orthogonal basis. Note that OpenGL uses a symmetric representation for its matrices.<p>
<a class="el" href="classqglviewer_1_1Quaternion.html#760617f082c950633b5642d2f60b2dd9">setFromRotatedBasis()</a> sets a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> from the three axis of a rotated frame. It actually fills the three columns of a matrix with these rotated basis vectors and calls this method. 
</div>
</div><p>
<a class="anchor" name="760617f082c950633b5642d2f60b2dd9"></a><!-- doxytag: member="qglviewer::Quaternion::setFromRotatedBasis" ref="760617f082c950633b5642d2f60b2dd9" args="(const Vec &amp;X, const Vec &amp;Y, const Vec &amp;Z)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void setFromRotatedBasis           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>X</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>Y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>Z</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> from the three rotated vectors of an orthogonal basis.<p>
The three vectors do not have to be normalized but must be orthogonal and direct (X^Y=k*Z, with k&gt;0).<p>
<div class="fragment"><pre class="fragment">  <a class="code" href="classqglviewer_1_1Quaternion.html#65ed15cc19af958b5933b5c522f10e66">Quaternion</a> q;
  q.setFromRotatedBasis(X, Y, Z);
  <span class="comment">// Now q.rotate(Vec(1,0,0)) == X and q.inverseRotate(X) == Vec(1,0,0)</span>
  <span class="comment">// Same goes for Y and Z with Vec(0,1,0) and Vec(0,0,1).</span>
</pre></div><p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#1880f20e8080ee670b6a88ed0c7d69ac">setFromRotationMatrix()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#1b60be34a715145efc3b91e6dfba1634">Quaternion(const Vec&amp;, const Vec&amp;)</a>. 
</div>
</div><p>
<a class="anchor" name="63f3f585fd25e9cb32700a26d54f8ee4"></a><!-- doxytag: member="qglviewer::Quaternion::axis" ref="63f3f585fd25e9cb32700a26d54f8ee4" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a> axis           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the normalized axis direction of the rotation represented by the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
It is null for an identity <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. See also <a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#46b7892fe36e140862b9c71e5cfe8292">getAxisAngle()</a>. 
</div>
</div><p>
<a class="anchor" name="39bde10d142ce0cbc9614988ca0a0e59"></a><!-- doxytag: member="qglviewer::Quaternion::angle" ref="39bde10d142ce0cbc9614988ca0a0e59" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float angle           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the angle (in radians) of the rotation represented by the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
This value is always in the range [0-pi]. Larger rotational angles are obtained by inverting the <a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis()</a> direction.<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#46b7892fe36e140862b9c71e5cfe8292">getAxisAngle()</a>. 
</div>
</div><p>
<a class="anchor" name="46b7892fe36e140862b9c71e5cfe8292"></a><!-- doxytag: member="qglviewer::Quaternion::getAxisAngle" ref="46b7892fe36e140862b9c71e5cfe8292" args="(Vec &amp;axis, float &amp;angle) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getAxisAngle           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>axis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float &amp;&nbsp;</td>
          <td class="paramname"> <em>angle</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the axis vector and the angle (in radians) of the rotation represented by the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. See the <a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle()</a> documentations. 
</div>
</div><p>
<a class="anchor" name="605b34d1fc87b2ccaf49a45419c2e46f"></a><!-- doxytag: member="qglviewer::Quaternion::operator[]" ref="605b34d1fc87b2ccaf49a45419c2e46f" args="(int i) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double operator[]           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>i</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Bracket operator, with a constant return value. <code>i</code> must range in [0..3]. See the <a class="el" href="classqglviewer_1_1Quaternion.html#81ba24ffd95778f3ca4e51b2b9922f45">Quaternion(double, double, double, double)</a> documentation. 
</div>
</div><p>
<a class="anchor" name="f1a8c9c4769161714a5a1a2c7fad446b"></a><!-- doxytag: member="qglviewer::Quaternion::operator[]" ref="f1a8c9c4769161714a5a1a2c7fad446b" args="(int i)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double&amp; operator[]           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>i</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Bracket operator returning an l-value. <code>i</code> must range in [0..3]. See the <a class="el" href="classqglviewer_1_1Quaternion.html#81ba24ffd95778f3ca4e51b2b9922f45">Quaternion(double, double, double, double)</a> documentation. 
</div>
</div><p>
<a class="anchor" name="0caef8e6e702101a45fdc0af3920c49d"></a><!-- doxytag: member="qglviewer::Quaternion::operator*=" ref="0caef8e6e702101a45fdc0af3920c49d" args="(const Quaternion &amp;q)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion&amp; operator*=           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>q</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> rotation is composed with <code>q</code>.<p>
See <a class="el" href="classqglviewer_1_1Quaternion.html#76b3ffdb188246ff6559069cb3f5b919">operator*()</a>, since this is equivalent to <code>this</code> = <code>this</code> * <code>q</code>.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>For efficiency reasons, the resulting <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> is not normalized. You may <a class="el" href="classqglviewer_1_1Quaternion.html#05826e509c686f39baaec4656f1a7231">normalize()</a> it after each application in case of numerical drift. </dd></dl>

</div>
</div><p>
<a class="anchor" name="5e2421069d88e576334e10f634625815"></a><!-- doxytag: member="qglviewer::Quaternion::rotate" ref="5e2421069d88e576334e10f634625815" args="(const Vec &amp;v) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a> rotate           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>v</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the image of <code>v</code> by the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> rotation.<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#74d79bc1afcc02fdbfe0eb390c3546f5">inverseRotate()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#19ce6efe5ef2744c8293e8ba1a39b9e4">operator*(const Quaternion&amp;, const Vec&amp;)</a>. 
</div>
</div><p>
<a class="anchor" name="74d79bc1afcc02fdbfe0eb390c3546f5"></a><!-- doxytag: member="qglviewer::Quaternion::inverseRotate" ref="74d79bc1afcc02fdbfe0eb390c3546f5" args="(const Vec &amp;v) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a> inverseRotate           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>v</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the image of <code>v</code> by the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a> rotation.<p>
<a class="el" href="classqglviewer_1_1Quaternion.html#5e2421069d88e576334e10f634625815">rotate()</a> performs an inverse transformation. Same as <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a>.rotate(v). 
</div>
</div><p>
<a class="anchor" name="c378ebc684d691dc25336b895f24a82e"></a><!-- doxytag: member="qglviewer::Quaternion::inverse" ref="c378ebc684d691dc25336b895f24a82e" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion inverse           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the inverse <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> (inverse rotation).<p>
Result has a negated <a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis()</a> direction and the same <a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle()</a>. A composition (see <a class="el" href="classqglviewer_1_1Quaternion.html#76b3ffdb188246ff6559069cb3f5b919">operator*()</a>) of a <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> and its <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a> results in an identity function.<p>
Use <a class="el" href="classqglviewer_1_1Quaternion.html#7fa1616cc61c19a5efcc863c950f7f30">invert()</a> to actually modify the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. 
</div>
</div><p>
<a class="anchor" name="7fa1616cc61c19a5efcc863c950f7f30"></a><!-- doxytag: member="qglviewer::Quaternion::invert" ref="7fa1616cc61c19a5efcc863c950f7f30" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void invert           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Inverses the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> (same rotation <a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle()</a>, but negated <a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis()</a>).<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a>. 
</div>
</div><p>
<a class="anchor" name="bcdb1512395327f8236a4f4a4d4ff648"></a><!-- doxytag: member="qglviewer::Quaternion::negate" ref="bcdb1512395327f8236a4f4a4d4ff648" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void negate           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Negates all the coefficients of the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
This results in an other representation of the <em>same</em> rotation (opposite rotation angle, but with a negated axis direction: the two cancel out). However, note that the results of <a class="el" href="classqglviewer_1_1Quaternion.html#63f3f585fd25e9cb32700a26d54f8ee4">axis()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle()</a> are unchanged after a call to this method since <a class="el" href="classqglviewer_1_1Quaternion.html#39bde10d142ce0cbc9614988ca0a0e59">angle()</a> always returns a value in [0,pi].<p>
This method is mainly useful for <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> interpolation, so that the spherical interpolation takes the shortest path on the unit sphere. See <a class="el" href="classqglviewer_1_1Quaternion.html#755201c9a752fd892a3656a517b190e4">slerp()</a> for details. 
</div>
</div><p>
<a class="anchor" name="05826e509c686f39baaec4656f1a7231"></a><!-- doxytag: member="qglviewer::Quaternion::normalize" ref="05826e509c686f39baaec4656f1a7231" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double normalize           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Normalizes the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> coefficients.<p>
This method should not need to be called since we only deal with unit Quaternions. This is however useful to prevent numerical drifts, especially with small rotational increments. See also <a class="el" href="classqglviewer_1_1Quaternion.html#e347ecf6e0a78618e8fd1a3b9107df32">normalized()</a>. 
</div>
</div><p>
<a class="anchor" name="e347ecf6e0a78618e8fd1a3b9107df32"></a><!-- doxytag: member="qglviewer::Quaternion::normalized" ref="e347ecf6e0a78618e8fd1a3b9107df32" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion normalized           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns a normalized version of the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#05826e509c686f39baaec4656f1a7231">normalize()</a>. 
</div>
</div><p>
<a class="anchor" name="a12123cf45f68b9f7fe0526b70ab0047"></a><!-- doxytag: member="qglviewer::Quaternion::matrix" ref="a12123cf45f68b9f7fe0526b70ab0047" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const GLdouble * matrix           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> associated 4x4 OpenGL rotation matrix.<p>
Use <code>glMultMatrixd</code>(q.matrix()) to apply the rotation represented by <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> <code>q</code> to the current OpenGL matrix.<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix()</a>, <a class="el" href="classqglviewer_1_1Quaternion.html#ad37aa66da74be6fb8d9d66f059f0872">getRotationMatrix()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#32992f152b7377da431c69f15384ed22">inverseMatrix()</a>.<p>
<dl class="attention" compact><dt><b>Attention:</b></dt><dd>The result is only valid until the next call to <a class="el" href="classqglviewer_1_1Quaternion.html#a12123cf45f68b9f7fe0526b70ab0047">matrix()</a>. Use it immediately (as shown above) or consider using <a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix()</a> instead.<p>
The matrix is given in OpenGL format (row-major order) and is the transpose of the actual mathematical European representation. Consider using <a class="el" href="classqglviewer_1_1Quaternion.html#ad37aa66da74be6fb8d9d66f059f0872">getRotationMatrix()</a> instead. </dd></dl>

</div>
</div><p>
<a class="anchor" name="4915640a54a6b48a99cbdd0cd42fec48"></a><!-- doxytag: member="qglviewer::Quaternion::getMatrix" ref="4915640a54a6b48a99cbdd0cd42fec48" args="(GLdouble m[4][4]) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getMatrix           </td>
          <td>(</td>
          <td class="paramtype">GLdouble&nbsp;</td>
          <td class="paramname"> <em>m</em>[4][4]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Fills <code>m</code> with the OpenGL representation of the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> rotation.<p>
Use <a class="el" href="classqglviewer_1_1Quaternion.html#a12123cf45f68b9f7fe0526b70ab0047">matrix()</a> if you do not need to store this matrix and simply want to alter the current OpenGL matrix. See also <a class="el" href="classqglviewer_1_1Quaternion.html#ee97ea226e31ac805a2245e7c73dac7b">getInverseMatrix()</a> and <a class="el" href="classqglviewer_1_1Frame.html#4915640a54a6b48a99cbdd0cd42fec48">Frame::getMatrix()</a>. 
</div>
</div><p>
<a class="anchor" name="15f0dc7596dc78437154302466ac3c0a"></a><!-- doxytag: member="qglviewer::Quaternion::getMatrix" ref="15f0dc7596dc78437154302466ac3c0a" args="(GLdouble m[16]) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getMatrix           </td>
          <td>(</td>
          <td class="paramtype">GLdouble&nbsp;</td>
          <td class="paramname"> <em>m</em>[16]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Same as <a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix()</a>, but with a <code>GLdouble</code>[16] parameter. See also <a class="el" href="classqglviewer_1_1Quaternion.html#ee97ea226e31ac805a2245e7c73dac7b">getInverseMatrix()</a> and <a class="el" href="classqglviewer_1_1Frame.html#4915640a54a6b48a99cbdd0cd42fec48">Frame::getMatrix()</a>. 
</div>
</div><p>
<a class="anchor" name="ad37aa66da74be6fb8d9d66f059f0872"></a><!-- doxytag: member="qglviewer::Quaternion::getRotationMatrix" ref="ad37aa66da74be6fb8d9d66f059f0872" args="(float m[3][3]) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getRotationMatrix           </td>
          <td>(</td>
          <td class="paramtype">float&nbsp;</td>
          <td class="paramname"> <em>m</em>[3][3]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Fills <code>m</code> with the 3x3 rotation matrix associated with the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
See also <a class="el" href="classqglviewer_1_1Quaternion.html#e1455acb1cbf59befe65295734d48c4a">getInverseRotationMatrix()</a>.<p>
<dl class="attention" compact><dt><b>Attention:</b></dt><dd><code>m</code> uses the European mathematical representation of the rotation matrix. Use <a class="el" href="classqglviewer_1_1Quaternion.html#a12123cf45f68b9f7fe0526b70ab0047">matrix()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix()</a> to retrieve the OpenGL transposed version. </dd></dl>

</div>
</div><p>
<a class="anchor" name="32992f152b7377da431c69f15384ed22"></a><!-- doxytag: member="qglviewer::Quaternion::inverseMatrix" ref="32992f152b7377da431c69f15384ed22" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const GLdouble * inverseMatrix           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the associated 4x4 OpenGL <em>inverse</em> rotation matrix. This is simply the <a class="el" href="classqglviewer_1_1Quaternion.html#a12123cf45f68b9f7fe0526b70ab0047">matrix()</a> of the <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a>.<p>
<dl class="attention" compact><dt><b>Attention:</b></dt><dd>The result is only valid until the next call to <a class="el" href="classqglviewer_1_1Quaternion.html#32992f152b7377da431c69f15384ed22">inverseMatrix()</a>. Use it immediately (as in <code>glMultMatrixd</code>(q.inverseMatrix())) or use <a class="el" href="classqglviewer_1_1Quaternion.html#ee97ea226e31ac805a2245e7c73dac7b">getInverseMatrix()</a> instead.<p>
The matrix is given in OpenGL format (row-major order) and is the transpose of the actual mathematical European representation. Consider using <a class="el" href="classqglviewer_1_1Quaternion.html#e1455acb1cbf59befe65295734d48c4a">getInverseRotationMatrix()</a> instead. </dd></dl>

</div>
</div><p>
<a class="anchor" name="ee97ea226e31ac805a2245e7c73dac7b"></a><!-- doxytag: member="qglviewer::Quaternion::getInverseMatrix" ref="ee97ea226e31ac805a2245e7c73dac7b" args="(GLdouble m[4][4]) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getInverseMatrix           </td>
          <td>(</td>
          <td class="paramtype">GLdouble&nbsp;</td>
          <td class="paramname"> <em>m</em>[4][4]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Fills <code>m</code> with the OpenGL matrix corresponding to the <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a> rotation.<p>
Use <a class="el" href="classqglviewer_1_1Quaternion.html#32992f152b7377da431c69f15384ed22">inverseMatrix()</a> if you do not need to store this matrix and simply want to alter the current OpenGL matrix. See also <a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix()</a>. 
</div>
</div><p>
<a class="anchor" name="315cf039df621a101a953df20acc7155"></a><!-- doxytag: member="qglviewer::Quaternion::getInverseMatrix" ref="315cf039df621a101a953df20acc7155" args="(GLdouble m[16]) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getInverseMatrix           </td>
          <td>(</td>
          <td class="paramtype">GLdouble&nbsp;</td>
          <td class="paramname"> <em>m</em>[16]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Same as <a class="el" href="classqglviewer_1_1Quaternion.html#ee97ea226e31ac805a2245e7c73dac7b">getInverseMatrix()</a>, but with a <code>GLdouble</code>[16] parameter. See also <a class="el" href="classqglviewer_1_1Quaternion.html#4915640a54a6b48a99cbdd0cd42fec48">getMatrix()</a>. 
</div>
</div><p>
<a class="anchor" name="e1455acb1cbf59befe65295734d48c4a"></a><!-- doxytag: member="qglviewer::Quaternion::getInverseRotationMatrix" ref="e1455acb1cbf59befe65295734d48c4a" args="(float m[3][3]) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void getInverseRotationMatrix           </td>
          <td>(</td>
          <td class="paramtype">float&nbsp;</td>
          <td class="paramname"> <em>m</em>[3][3]          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<code>m</code> is set to the 3x3 <em>inverse</em> rotation matrix associated with the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
<dl class="attention" compact><dt><b>Attention:</b></dt><dd>This is the classical mathematical rotation matrix. The OpenGL format uses its transposed version. See <a class="el" href="classqglviewer_1_1Quaternion.html#32992f152b7377da431c69f15384ed22">inverseMatrix()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#ee97ea226e31ac805a2245e7c73dac7b">getInverseMatrix()</a>. </dd></dl>

</div>
</div><p>
<a class="anchor" name="755201c9a752fd892a3656a517b190e4"></a><!-- doxytag: member="qglviewer::Quaternion::slerp" ref="755201c9a752fd892a3656a517b190e4" args="(const Quaternion &amp;a, const Quaternion &amp;b, float t, bool allowFlip=true)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion slerp           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&nbsp;</td>
          <td class="paramname"> <em>t</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>allowFlip</em> = <code>true</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the slerp interpolation of Quaternions <code>a</code> and <code>b</code>, at time <code>t</code>.<p>
<code>t</code> should range in [0,1]. Result is <code>a</code> when <code>t=0</code> and <code>b</code> when <code>t=1</code>.<p>
When <code>allowFlip</code> is <code>true</code> (default) the slerp interpolation will always use the "shortest path" between the Quaternions' orientations, by "flipping" the source <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> if needed (see <a class="el" href="classqglviewer_1_1Quaternion.html#bcdb1512395327f8236a4f4a4d4ff648">negate()</a>). 
</div>
</div><p>
<a class="anchor" name="4b218b205d88a4dd50c8de38522b5812"></a><!-- doxytag: member="qglviewer::Quaternion::squad" ref="4b218b205d88a4dd50c8de38522b5812" args="(const Quaternion &amp;a, const Quaternion &amp;tgA, const Quaternion &amp;tgB, const Quaternion &amp;b, float t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion squad           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>tgA</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>tgB</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&nbsp;</td>
          <td class="paramname"> <em>t</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the slerp interpolation of the two Quaternions <code>a</code> and <code>b</code>, at time <code>t</code>, using tangents <code>tgA</code> and <code>tgB</code>.<p>
The resulting <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> is "between" <code>a</code> and <code>b</code> (result is <code>a</code> when <code>t=0</code> and <code>b</code> for <code>t=1</code>).<p>
Use <a class="el" href="classqglviewer_1_1Quaternion.html#2a27d43a68da6c7c5243fe81e5a9d005">squadTangent()</a> to define the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> tangents <code>tgA</code> and <code>tgB</code>. 
</div>
</div><p>
<a class="anchor" name="80d06247e39abf2980e56d2fe8c4bb83"></a><!-- doxytag: member="qglviewer::Quaternion::dot" ref="80d06247e39abf2980e56d2fe8c4bb83" args="(const Quaternion &amp;a, const Quaternion &amp;b)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static double dot           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>b</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the "dot" product of <code>a</code> and <code>b:</code> a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]. 
</div>
</div><p>
<a class="anchor" name="4db67fbb8171a5e781b56404112cf848"></a><!-- doxytag: member="qglviewer::Quaternion::log" ref="4db67fbb8171a5e781b56404112cf848" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion log           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the logarithm of the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. See also <a class="el" href="classqglviewer_1_1Quaternion.html#5c546a33cc0c65f24b7e9c48e5069ba7">exp()</a>. 
</div>
</div><p>
<a class="anchor" name="5c546a33cc0c65f24b7e9c48e5069ba7"></a><!-- doxytag: member="qglviewer::Quaternion::exp" ref="5c546a33cc0c65f24b7e9c48e5069ba7" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion exp           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the exponential of the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>. See also <a class="el" href="classqglviewer_1_1Quaternion.html#4db67fbb8171a5e781b56404112cf848">log()</a>. 
</div>
</div><p>
<a class="anchor" name="f4c74176967acca6e3947977351e1c68"></a><!-- doxytag: member="qglviewer::Quaternion::lnDif" ref="f4c74176967acca6e3947977351e1c68" args="(const Quaternion &amp;a, const Quaternion &amp;b)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion lnDif           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>b</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns log(a. <a class="el" href="classqglviewer_1_1Quaternion.html#c378ebc684d691dc25336b895f24a82e">inverse()</a> * b). Useful for <a class="el" href="classqglviewer_1_1Quaternion.html#2a27d43a68da6c7c5243fe81e5a9d005">squadTangent()</a>. 
</div>
</div><p>
<a class="anchor" name="2a27d43a68da6c7c5243fe81e5a9d005"></a><!-- doxytag: member="qglviewer::Quaternion::squadTangent" ref="2a27d43a68da6c7c5243fe81e5a9d005" args="(const Quaternion &amp;before, const Quaternion &amp;center, const Quaternion &amp;after)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion squadTangent           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>before</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>center</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>after</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns a tangent <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> for <code>center</code>, defined by <code>before</code> and <code>after</code> Quaternions.<p>
Useful for smooth spline interpolation of <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> with <a class="el" href="classqglviewer_1_1Quaternion.html#4b218b205d88a4dd50c8de38522b5812">squad()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#755201c9a752fd892a3656a517b190e4">slerp()</a>. 
</div>
</div><p>
<a class="anchor" name="87d5e98d958fdc63100979fcff1d9976"></a><!-- doxytag: member="qglviewer::Quaternion::randomQuaternion" ref="87d5e98d958fdc63100979fcff1d9976" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion randomQuaternion           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns a random unit <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
You can create a randomly directed unit vector using: <div class="fragment"><pre class="fragment">Vec randomDir = <a class="code" href="classqglviewer_1_1Quaternion.html#87d5e98d958fdc63100979fcff1d9976">Quaternion::randomQuaternion</a>() * Vec(1.0, 0.0, 0.0); <span class="comment">// or any other Vec</span>
</pre></div><p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This function uses rand() to create pseudo-random numbers and the random number generator can be initialized using srand(). </dd></dl>

</div>
</div><p>
<a class="anchor" name="48e0e2dd26cd96418c8b889ceabe80f6"></a><!-- doxytag: member="qglviewer::Quaternion::domElement" ref="48e0e2dd26cd96418c8b889ceabe80f6" args="(const QString &amp;name, QDomDocument &amp;document) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QDomElement domElement           </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QDomDocument &amp;&nbsp;</td>
          <td class="paramname"> <em>document</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns an XML <code>QDomElement</code> that represents the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>.<p>
<code>name</code> is the name of the QDomElement tag. <code>doc</code> is the <code>QDomDocument</code> factory used to create QDomElement.<p>
When output to a file, the resulting QDomElement will look like: <div class="fragment"><pre class="fragment"> &lt;name q0=<span class="stringliteral">".."</span> q1=<span class="stringliteral">".."</span> q2=<span class="stringliteral">".."</span> q3=<span class="stringliteral">".."</span> /&gt;
</pre></div><p>
Use <a class="el" href="classqglviewer_1_1Quaternion.html#cd13d2ddeca530cb9f26ead47f7d25d3">initFromDOMElement()</a> to restore the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> state from the resulting <code>QDomElement</code>. See also the <a class="el" href="classqglviewer_1_1Quaternion.html#87faf5efc96c9b5af85a611985b6618f">Quaternion(const QDomElement&amp;)</a> constructor.<p>
See the <a class="el" href="classqglviewer_1_1Vec.html#48e0e2dd26cd96418c8b889ceabe80f6">Vec::domElement()</a> documentation for a complete QDomDocument creation and saving example.<p>
See also <a class="el" href="classqglviewer_1_1Frame.html#48e0e2dd26cd96418c8b889ceabe80f6">Frame::domElement()</a>, <a class="el" href="classqglviewer_1_1Camera.html#48e0e2dd26cd96418c8b889ceabe80f6">Camera::domElement()</a>, <a class="el" href="classqglviewer_1_1KeyFrameInterpolator.html#48e0e2dd26cd96418c8b889ceabe80f6">KeyFrameInterpolator::domElement()</a>... 
</div>
</div><p>
<a class="anchor" name="cd13d2ddeca530cb9f26ead47f7d25d3"></a><!-- doxytag: member="qglviewer::Quaternion::initFromDOMElement" ref="cd13d2ddeca530cb9f26ead47f7d25d3" args="(const QDomElement &amp;element)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void initFromDOMElement           </td>
          <td>(</td>
          <td class="paramtype">const QDomElement &amp;&nbsp;</td>
          <td class="paramname"> <em>element</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Restores the <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> state from a <code>QDomElement</code> created by <a class="el" href="classqglviewer_1_1Quaternion.html#48e0e2dd26cd96418c8b889ceabe80f6">domElement()</a>.<p>
The <code>QDomElement</code> should contain the <code>q0</code>, <code>q1</code> , <code>q2</code> and <code>q3</code> attributes. If one of these attributes is missing or is not a number, a warning is displayed and these fields are respectively set to 0.0, 0.0, 0.0 and 1.0 (identity <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a>).<p>
See also the <a class="el" href="classqglviewer_1_1Quaternion.html#87faf5efc96c9b5af85a611985b6618f">Quaternion(const QDomElement&amp;)</a> constructor. 
</div>
</div><p>
<a class="anchor" name="16d5f2f021103b05006b0c58fbd48796"></a><!-- doxytag: member="qglviewer::Quaternion::operator&lt;&lt;" ref="16d5f2f021103b05006b0c58fbd48796" args="(std::ostream &amp;o, const qglviewer::Vec &amp;)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::ostream&amp; operator&lt;&lt;           </td>
          <td>(</td>
          <td class="paramtype">std::ostream &amp;&nbsp;</td>
          <td class="paramname"> <em>o</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">qglviewer::Vec</a> &amp;&nbsp;</td>
          <td class="paramname"></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Output stream operator. Enables debugging code like: <div class="fragment"><pre class="fragment">                <a class="code" href="classqglviewer_1_1Quaternion.html#65ed15cc19af958b5933b5c522f10e66">Quaternion</a> rot(...);
                cout &lt;&lt; <span class="stringliteral">"Rotation="</span> &lt;&lt; rot &lt;&lt; endl;
</pre></div> 
</div>
</div><p>
<hr><h2>Friends And Related Function Documentation</h2>
<a class="anchor" name="76b3ffdb188246ff6559069cb3f5b919"></a><!-- doxytag: member="qglviewer::Quaternion::operator*" ref="76b3ffdb188246ff6559069cb3f5b919" args="(const Quaternion &amp;a, const Quaternion &amp;b)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Quaternion operator*           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>b</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the composition of the <code>a</code> and <code>b</code> rotations.<p>
The order is important. When applied to a <a class="el" href="classqglviewer_1_1Vec.html" title="The Vec class represents 3D positions and 3D vectors.">Vec</a> <code>v</code> (see <a class="el" href="classqglviewer_1_1Quaternion.html#19ce6efe5ef2744c8293e8ba1a39b9e4">operator*(const Quaternion&amp;, const Vec&amp;)</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#5e2421069d88e576334e10f634625815">rotate()</a>) the resulting <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> acts as if <code>b</code> was applied first and then <code>a</code> was applied. This is obvious since the image <code>v'</code> of <code>v</code> by the composited rotation satisfies: <div class="fragment"><pre class="fragment">                v<span class="stringliteral">'= (a*b) * v = a * (b*v) </span>
</pre></div><p>
Note that a*b usually differs from b*a.<p>
<dl class="attention" compact><dt><b>Attention:</b></dt><dd>For efficiency reasons, the resulting <a class="el" href="classqglviewer_1_1Quaternion.html" title="The Quaternion class represents 3D rotations and orientations.">Quaternion</a> is not normalized. Use <a class="el" href="classqglviewer_1_1Quaternion.html#05826e509c686f39baaec4656f1a7231">normalize()</a> in case of numerical drift with small rotation composition. </dd></dl>

</div>
</div><p>
<a class="anchor" name="19ce6efe5ef2744c8293e8ba1a39b9e4"></a><!-- doxytag: member="qglviewer::Quaternion::operator*" ref="19ce6efe5ef2744c8293e8ba1a39b9e4" args="(const Quaternion &amp;q, const Vec &amp;v)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classqglviewer_1_1Vec.html">Vec</a> operator*           </td>
          <td>(</td>
          <td class="paramtype">const Quaternion &amp;&nbsp;</td>
          <td class="paramname"> <em>q</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classqglviewer_1_1Vec.html">Vec</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>v</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the image of <code>v</code> by the rotation <code>q</code>.<p>
Same as q.rotate(v). See <a class="el" href="classqglviewer_1_1Quaternion.html#5e2421069d88e576334e10f634625815">rotate()</a> and <a class="el" href="classqglviewer_1_1Quaternion.html#74d79bc1afcc02fdbfe0eb390c3546f5">inverseRotate()</a>. 
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>libQGLViewer 2.3.1 documentation generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>