<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 06/29/2012 05:20 PM, Alexander Duda wrote:
<blockquote cite="mid:4FEDC7D6.6010602@dfki.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
On 06/29/2012 05:02 PM, Javier Hidalgo Carrió wrote:
<blockquote cite="mid:4FEDC387.8010806@dfki.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">+1<br>
Since Orientation is a Eigen::Quaternion we could even use the
norm() method.<br>
<br>
Javier.<br>
<br>
<table class="memname">
<tbody>
<tr>
<td class="memname"><a moz-do-not-send="true" class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a844358c46408e878e60c4026c52eb1e9">Scalar</a>
norm </td>
<td>(</td>
<td class="paramname"><br>
</td>
<td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</tbody>
</table>
<div class="memdoc">
<dl class="return">
<dt><b>Returns:</b></dt>
<dd>the norm of the quaternion's coefficients </dd>
</dl>
<dl class="see">
<dt><b>See also:</b></dt>
<dd><a moz-do-not-send="true" class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a8699d72c996ca6cb4673e810fe3a616c">QuaternionBase::squaredNorm()</a>,
<a moz-do-not-send="true" class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a0be1b433c65ce9d92c81a4718daf54e5">MatrixBase::norm()</a>
</dd>
</dl>
</div>
<br>
</div>
</blockquote>
I think you do not gain so much from this functions as you will
get a scalar which you have to sum anyway. Do you know if there is
a function which checks if the quaternion is valid?<br>
<br>
The proposed code was terrible wrong -- so here is the correction<br>
fabs(ori.w()*ori.w()+ori.x()*ori.x()+ori.y()*ori.y()+ori.z()*ori.z()-1.0)
< 1e-6<br>
<br>
</blockquote>
I would also vote for using the norm() function. Its much clearer,
less error prone, and the sqrt() you save may not be worth the
effort. You will still have to do what you are doing with the fabs
of course.<br>
<br>
Jakob<br>
<br>
</body>
</html>