mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 02:04:35 +00:00
176 lines
18 KiB
HTML
176 lines
18 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<title>GLM: quaternion.hpp Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<!-- Generated by Doxygen 1.6.1 -->
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<h1>quaternion.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
|
|
<a name="l00002"></a>00002 <span class="comment">// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)</span>
|
|
<a name="l00004"></a>00004 <span class="comment"></span><span class="comment">// Created : 2005-12-21</span>
|
|
<a name="l00005"></a>00005 <span class="comment">// Updated : 2009-05-21</span>
|
|
<a name="l00006"></a>00006 <span class="comment">// Licence : This source is under MIT License</span>
|
|
<a name="l00007"></a>00007 <span class="comment">// File : glm/gtx/quaternion.hpp</span>
|
|
<a name="l00009"></a>00009 <span class="comment"></span><span class="comment">// Dependency:</span>
|
|
<a name="l00010"></a>00010 <span class="comment">// - GLM core</span>
|
|
<a name="l00012"></a>00012 <span class="comment"></span><span class="comment">// ToDo:</span>
|
|
<a name="l00013"></a>00013 <span class="comment">// - Study constructors with angles and axis</span>
|
|
<a name="l00014"></a>00014 <span class="comment">// - Study constructors with vec3 that are the imaginary component of quaternion</span>
|
|
<a name="l00016"></a>00016 <span class="comment"></span>
|
|
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef glm_gtx_quaternion</span>
|
|
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define glm_gtx_quaternion</span>
|
|
<a name="l00019"></a>00019 <span class="preprocessor"></span>
|
|
<a name="l00020"></a>00020 <span class="comment">// Dependency:</span>
|
|
<a name="l00021"></a>00021 <span class="preprocessor">#include "../glm.hpp"</span>
|
|
<a name="l00022"></a>00022 <span class="preprocessor">#include "../gtc/quaternion.hpp"</span>
|
|
<a name="l00023"></a>00023
|
|
<a name="l00024"></a>00024 <span class="keyword">namespace </span>glm
|
|
<a name="l00025"></a>00025 {
|
|
<a name="l00026"></a>00026 <span class="keyword">namespace </span>gtx{
|
|
<a name="l00028"></a><a class="code" href="a00197.html">00028</a> <span class="keyword">namespace </span>quaternion
|
|
<a name="l00029"></a>00029 {
|
|
<a name="l00030"></a>00030 <span class="keyword">using namespace </span>gtc::quaternion;
|
|
<a name="l00031"></a>00031
|
|
<a name="l00034"></a>00034 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00035"></a>00035 detail::tvec3<valType> <a class="code" href="a00197.html#a2a222a07e879ab25de36d6b5a8f6610d" title="Compute a cross product between a quaternion and a vector.">cross</a>(
|
|
<a name="l00036"></a>00036 detail::tquat<valType> <span class="keyword">const</span> & q,
|
|
<a name="l00037"></a>00037 detail::tvec3<valType> <span class="keyword">const</span> & v);
|
|
<a name="l00038"></a>00038
|
|
<a name="l00041"></a>00041 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00042"></a>00042 detail::tvec3<valType> <a class="code" href="a00197.html#a2a222a07e879ab25de36d6b5a8f6610d" title="Compute a cross product between a quaternion and a vector.">cross</a>(
|
|
<a name="l00043"></a>00043 detail::tvec3<valType> <span class="keyword">const</span> & v,
|
|
<a name="l00044"></a>00044 detail::tquat<valType> <span class="keyword">const</span> & q);
|
|
<a name="l00045"></a>00045
|
|
<a name="l00049"></a>00049 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00050"></a>00050 detail::tquat<valType> <a class="code" href="a00197.html#a203b736245b7519eb151ac46e0bf7f21" title="Compute a point on a path according squad equation.">squad</a>(
|
|
<a name="l00051"></a>00051 detail::tquat<valType> <span class="keyword">const</span> & q1,
|
|
<a name="l00052"></a>00052 detail::tquat<valType> <span class="keyword">const</span> & q2,
|
|
<a name="l00053"></a>00053 detail::tquat<valType> <span class="keyword">const</span> & s1,
|
|
<a name="l00054"></a>00054 detail::tquat<valType> <span class="keyword">const</span> & s2,
|
|
<a name="l00055"></a>00055 valType <span class="keyword">const</span> & h);
|
|
<a name="l00056"></a>00056
|
|
<a name="l00059"></a>00059 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00060"></a>00060 detail::tquat<valType> <a class="code" href="a00197.html#aa15c443e97ac7476d04627d868995891" title="Returns an intermediate control point for squad interpolation.">intermediate</a>(
|
|
<a name="l00061"></a>00061 detail::tquat<valType> <span class="keyword">const</span> & prev,
|
|
<a name="l00062"></a>00062 detail::tquat<valType> <span class="keyword">const</span> & curr,
|
|
<a name="l00063"></a>00063 detail::tquat<valType> <span class="keyword">const</span> & next);
|
|
<a name="l00064"></a>00064
|
|
<a name="l00067"></a>00067 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00068"></a>00068 detail::tquat<valType> <a class="code" href="a00197.html#aed2302270ec468d26de745516ccb5d4b" title="Returns a exp of a quaternion.">exp</a>(
|
|
<a name="l00069"></a>00069 detail::tquat<valType> <span class="keyword">const</span> & q,
|
|
<a name="l00070"></a>00070 valType <span class="keyword">const</span> & exponent);
|
|
<a name="l00071"></a>00071
|
|
<a name="l00074"></a>00074 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00075"></a>00075 detail::tquat<valType> <a class="code" href="a00197.html#a11af1897310ec8a09210fb7b4deb0027" title="Returns a log of a quaternion.">log</a>(
|
|
<a name="l00076"></a>00076 detail::tquat<valType> <span class="keyword">const</span> & q);
|
|
<a name="l00077"></a>00077
|
|
<a name="l00080"></a>00080 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00081"></a>00081 detail::tquat<valType> <a class="code" href="a00197.html#a42873121534327c9e5238f3ca3d6cd03" title="Returns x raised to the y power.">pow</a>(
|
|
<a name="l00082"></a>00082 detail::tquat<valType> <span class="keyword">const</span> & x,
|
|
<a name="l00083"></a>00083 valType <span class="keyword">const</span> & y);
|
|
<a name="l00084"></a>00084
|
|
<a name="l00087"></a>00087 <span class="comment">//template <typename valType> </span>
|
|
<a name="l00088"></a>00088 <span class="comment">//detail::tquat<valType> sqrt(</span>
|
|
<a name="l00089"></a>00089 <span class="comment">// detail::tquat<valType> const & q);</span>
|
|
<a name="l00090"></a>00090
|
|
<a name="l00093"></a>00093 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00094"></a>00094 detail::tvec3<valType> <a class="code" href="a00197.html#a7f163c787898b76dc1d91eb48523ce87" title="Returns quarternion square root.">rotate</a>(
|
|
<a name="l00095"></a>00095 detail::tquat<valType> <span class="keyword">const</span> & q,
|
|
<a name="l00096"></a>00096 detail::tvec3<valType> <span class="keyword">const</span> & v);
|
|
<a name="l00097"></a>00097
|
|
<a name="l00100"></a>00100 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00101"></a>00101 detail::tvec4<valType> <a class="code" href="a00197.html#a7f163c787898b76dc1d91eb48523ce87" title="Returns quarternion square root.">rotate</a>(
|
|
<a name="l00102"></a>00102 detail::tquat<valType> <span class="keyword">const</span> & q,
|
|
<a name="l00103"></a>00103 detail::tvec4<valType> <span class="keyword">const</span> & v);
|
|
<a name="l00104"></a>00104
|
|
<a name="l00107"></a>00107 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00108"></a>00108 valType <a class="code" href="a00197.html#a6a3387a7d60728f60d86546b2f4d4d30" title="Returns the q rotation angle.">angle</a>(
|
|
<a name="l00109"></a>00109 detail::tquat<valType> <span class="keyword">const</span> & x);
|
|
<a name="l00110"></a>00110
|
|
<a name="l00113"></a>00113 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00114"></a>00114 detail::tvec3<valType> <a class="code" href="a00197.html#a6dd1904e2a6cc8e54bd324994094a6f9" title="Returns the q rotation axis.">axis</a>(
|
|
<a name="l00115"></a>00115 detail::tquat<valType> <span class="keyword">const</span> & x);
|
|
<a name="l00116"></a>00116
|
|
<a name="l00119"></a>00119 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00120"></a>00120 detail::tquat<valType> <a class="code" href="a00197.html#a4412b01c376d9cfc9cc06b2d511d0f16" title="Build a quaternion from an angle and an axis.">angleAxis</a>(
|
|
<a name="l00121"></a>00121 valType <span class="keyword">const</span> & angle,
|
|
<a name="l00122"></a>00122 valType <span class="keyword">const</span> & x,
|
|
<a name="l00123"></a>00123 valType <span class="keyword">const</span> & y,
|
|
<a name="l00124"></a>00124 valType <span class="keyword">const</span> & z);
|
|
<a name="l00125"></a>00125
|
|
<a name="l00128"></a>00128 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00129"></a>00129 detail::tquat<valType> <a class="code" href="a00197.html#a4412b01c376d9cfc9cc06b2d511d0f16" title="Build a quaternion from an angle and an axis.">angleAxis</a>(
|
|
<a name="l00130"></a>00130 valType <span class="keyword">const</span> & angle,
|
|
<a name="l00131"></a>00131 detail::tvec3<valType> <span class="keyword">const</span> & v);
|
|
<a name="l00132"></a>00132
|
|
<a name="l00135"></a>00135 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00136"></a>00136 valType <a class="code" href="a00197.html#a23eb8e1aeaf751f7cc46fbaa291e223d" title="Extract the real component of a quaternion.">extractRealComponent</a>(
|
|
<a name="l00137"></a>00137 detail::tquat<valType> <span class="keyword">const</span> & q);
|
|
<a name="l00138"></a>00138
|
|
<a name="l00141"></a>00141 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00142"></a>00142 valType <a class="code" href="a00197.html#a60a4f955b2836d85f3d21ded84879926" title="Returns roll value of euler angles.">roll</a>(
|
|
<a name="l00143"></a>00143 detail::tquat<valType> <span class="keyword">const</span> & x);
|
|
<a name="l00144"></a>00144
|
|
<a name="l00147"></a>00147 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00148"></a>00148 valType <a class="code" href="a00197.html#afad23e37f1723bbbbd7f9498cd729126" title="Returns pitch value of euler angles.">pitch</a>(
|
|
<a name="l00149"></a>00149 detail::tquat<valType> <span class="keyword">const</span> & x);
|
|
<a name="l00150"></a>00150
|
|
<a name="l00153"></a>00153 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00154"></a>00154 valType <a class="code" href="a00197.html#a4795f1cc522d82d672f7be9a405583c4" title="Returns yaw value of euler angles.">yaw</a>(
|
|
<a name="l00155"></a>00155 detail::tquat<valType> <span class="keyword">const</span> & x);
|
|
<a name="l00156"></a>00156
|
|
<a name="l00159"></a>00159 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00160"></a>00160 detail::tvec3<valType> <a class="code" href="a00197.html#a49d24e9d018f400ee11176b7e9433384" title="Returns euler angles, yitch as x, yaw as y, roll as z.">eularAngles</a>(
|
|
<a name="l00161"></a>00161 detail::tquat<valType> <span class="keyword">const</span> & x);
|
|
<a name="l00162"></a>00162
|
|
<a name="l00165"></a>00165 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00166"></a><a class="code" href="a00197.html#a61ec971322157330116a3aefe5bae609">00166</a> detail::tmat3x3<valType> <a class="code" href="a00197.html#a61ec971322157330116a3aefe5bae609" title="Converts a quaternion to a 3 * 3 matrix.">toMat3</a>(
|
|
<a name="l00167"></a>00167 detail::tquat<valType> <span class="keyword">const</span> & x){<span class="keywordflow">return</span> <a class="code" href="a00148.html#a3f6d3a2eec09de0c3d191a6b5235a744" title="Converts a quaternion to a 3 * 3 matrix.">gtc::quaternion::mat3_cast</a>(x);}
|
|
<a name="l00168"></a>00168
|
|
<a name="l00171"></a>00171 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00172"></a><a class="code" href="a00197.html#a80622343bd7ccf43c9b4cb677ba3ce38">00172</a> detail::tmat4x4<valType> <a class="code" href="a00197.html#a80622343bd7ccf43c9b4cb677ba3ce38" title="Converts a quaternion to a 4 * 4 matrix.">toMat4</a>(
|
|
<a name="l00173"></a>00173 detail::tquat<valType> <span class="keyword">const</span> & x){<span class="keywordflow">return</span> <a class="code" href="a00148.html#a09599c3024ab423b26d4c1b440893cb8" title="Converts a quaternion to a 4 * 4 matrix.">gtc::quaternion::mat4_cast</a>(x);}
|
|
<a name="l00174"></a>00174
|
|
<a name="l00177"></a>00177 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00178"></a><a class="code" href="a00197.html#a991e534718ab690ff21e201f27bfd43b">00178</a> detail::tquat<valType> <a class="code" href="a00197.html#a991e534718ab690ff21e201f27bfd43b" title="Converts a 3 * 3 matrix to a quaternion.">toQuat</a>(
|
|
<a name="l00179"></a>00179 detail::tmat3x3<valType> <span class="keyword">const</span> & x){<span class="keywordflow">return</span> <a class="code" href="a00148.html#a619b445502abad1cc98207919116e7fd" title="Converts a 3 * 3 matrix to a quaternion.">gtc::quaternion::quat_cast</a>(x);}
|
|
<a name="l00180"></a>00180
|
|
<a name="l00183"></a>00183 <span class="keyword">template</span> <<span class="keyword">typename</span> valType>
|
|
<a name="l00184"></a><a class="code" href="a00197.html#a2d9d1916258d13bd5f0373341400f18c">00184</a> detail::tquat<valType> <a class="code" href="a00197.html#a991e534718ab690ff21e201f27bfd43b" title="Converts a 3 * 3 matrix to a quaternion.">toQuat</a>(
|
|
<a name="l00185"></a>00185 detail::tmat4x4<valType> <span class="keyword">const</span> & x){<span class="keywordflow">return</span> <a class="code" href="a00148.html#a619b445502abad1cc98207919116e7fd" title="Converts a 3 * 3 matrix to a quaternion.">gtc::quaternion::quat_cast</a>(x);}
|
|
<a name="l00186"></a>00186
|
|
<a name="l00187"></a>00187 }<span class="comment">//namespace quaternion</span>
|
|
<a name="l00188"></a>00188 }<span class="comment">//namespace gtx</span>
|
|
<a name="l00189"></a>00189 } <span class="comment">//namespace glm</span>
|
|
<a name="l00190"></a>00190
|
|
<a name="l00191"></a>00191 <span class="preprocessor">#define GLM_GTX_quaternion namespace gtx::quaternion</span>
|
|
<a name="l00192"></a>00192 <span class="preprocessor"></span><span class="preprocessor">#ifndef GLM_GTX_GLOBAL</span>
|
|
<a name="l00193"></a>00193 <span class="preprocessor"></span><span class="keyword">namespace </span>glm {<span class="keyword">using</span> GLM_GTX_quaternion;}
|
|
<a name="l00194"></a>00194 <span class="preprocessor">#endif//GLM_GTX_GLOBAL</span>
|
|
<a name="l00195"></a>00195 <span class="preprocessor"></span>
|
|
<a name="l00196"></a>00196 <span class="preprocessor">#include "quaternion.inl"</span>
|
|
<a name="l00197"></a>00197
|
|
<a name="l00198"></a>00198 <span class="preprocessor">#endif//glm_gtx_quaternion</span>
|
|
</pre></div></div>
|
|
<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Nov 16 11:23:23 2009 for GLM by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
|
|
</body>
|
|
</html>
|