[eigen] Quaternion toRotationMatrix
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: [eigen] Quaternion toRotationMatrix
• From: Gabriel <gnuetzi@xxxxxxxxx>
• Date: Wed, 30 Sep 2015 17:38:09 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=wbe8BGw5EuHeyOPNeHRGJKyieqDFZXFqkPL1ar6DoaM=; b=vepcT83nmfakV3JlWE7/+H2rJx7IuBnuFSY2IiEYDW51y9lKWpXz3Y6Ra7CVfDbB8H w62+ol/qE4/bhHpPngtBUZ3x429E3TME0cNb4NQ/YelohlkQDuMfbTX3+zSDK7osXt8i V8j0VMJsTazwfxfUUj5Zck5X6q1B9hIYLXYeIkVZR+uutZH11ZP//xDpnr6PcZxJi1d7 b9XR9VHgAos+p+c7Be0ptPy1K4mvvORZClMi07yL2peDU9ryDsJ8isXPqH3Oc4EQ/KLR 5ctHsPRn1NRzdFZ4h1WKj3tI4vRWFgOnbjEXjHeTowqV1ATZyUkp0ikculht+wrUJKgH z8FA==

 Hello, I have the following suggestions for the function toRotationMatrix()   for the QuaternionBase class: The function is shown here: http://pastebin.com/QPRANVU6 The documentation says that this function is undefined if a non unit quaternion is used! This is absolutely correct! The function so far implemented is equation 1.112 in http://snag.gy/J6rDH.jpg  ( tilde is the skew-symetric matrix of a vector  -> cross product) If we want to use the Eigen function toRotationMatrix()   we need to normalize the quaternion beforehand which is expensive! A better way is to use equation 1.110 directly in http://snag.gy/J6rDH.jpg, which directly normalizes the quaternion but only needs the square norm of the quaternion "s" which is much cheaper. Equation 1.110 directly gives a proper rotation matrix! (orthogonal, and det(R)=1) I would provide the following adaption: template QuaternionBase<...>::toRotationMatrix() where toRotationMatrix       -> same function as already implemented (user should use this if quaternion is already normalized) toRotationMatrix      -> no normalized quaternion is given as argument, use an implementation which uses equation 1.110 in http://snag.gy/J6rDH.jpg Maybe the default behavior should be "true" so there is no change to the interface for the user who used these functions.... BR Gabriel Nützi

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/