<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<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 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 class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#a8699d72c996ca6cb4673e810fe3a616c">QuaternionBase::squaredNorm()</a>,
<a class="el"
href="http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a0be1b433c65ce9d92c81a4718daf54e5">MatrixBase::norm()</a>
</dd>
</dl>
</div>
<br>
On 06/29/2012 04:53 PM, Alexander Duda wrote:<br>
</div>
<blockquote cite="mid:4FEDC16F.7050503@dfki.de" type="cite">
<pre wrap="">Hi,
the base type samples::RigidBodyState has a function to check if the
orientation is valid.
At the moment it only checks if the values of the quaternion
representing the orientation are different to NaN.
I propose that we also add a check that the quaternion is an unit
quaternion because otherwise wrongly initialised orientations might lead
to strange transformation matrices and vanishing objects in OSG.
Any opinions?
Alex
static bool isValidValue(base::Orientation const& ori)
{
return !base::isNaN(ori.w()) &&
!base::isNaN(ori.x()) &&
!base::isNaN(ori.y()) &&
!base::isNaN(ori.z()) &&
ori.w()*ori.w()+ori.x()*ori.x()+ori.y()*ori.y()+ori.z()*ori.z()-1e6 < 1;
}
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Javier Hidalgo Carrió
ESA - NPI Programme
Researcher
DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
<a class="moz-txt-link-freetext" href="http://robotik.dfki-bremen.de">http://robotik.dfki-bremen.de</a>
Phone:+49(0)421 17845 6661
Fax: +49(0)421 17845 4150
</pre>
</body>
</html>