[Rock-dev] RigidBodyState detecting invalid orientations
Alexander Duda
Alexander.Duda at dfki.de
Fri Jun 29 16:53:35 CEST 2012
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;
}
--
Dipl.-Ing. Alexander Duda
Unterwasserrobotik
DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178-456620
Fax: +49 (0)421 178-454150
E-Mail: alexander.duda at dfki.de
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/673/0060/3
More information about the Rock-dev
mailing list