Bugzilla – Attachment 266 Details for
Bug 458
Quaternion to rotation matrix
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
[patch]
patch
quaternion_to_rotation.patch (text/plain), 1.14 KB, created by
Hauke Strasdat
on 2012-05-05 23:51:16 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Hauke Strasdat
Created:
2012-05-05 23:51:16 UTC
Size:
1.14 KB
patch
obsolete
>--- /tmp/tmplrsu9G-meld/Eigen/src/Geometry/Quaternion.h >+++ /home/strasdat/src/ScaViSLAM/EXTERNAL/eigen3.1/Eigen/src/Geometry/Quaternion.h >@@ -545,8 +545,8 @@ > return derived(); > } > >-/** Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to >- * be normalized, otherwise the result is undefined. >+/** Convert the quaternion to a 3x3 rotation matrix. >+ * The quaternion is not required to be normalized. > */ > template<class Derived> > inline typename QuaternionBase<Derived>::Matrix3 >@@ -558,9 +558,17 @@ > // it has to be inlined, and so the return by value is not an issue > Matrix3 res; > >- const Scalar tx = Scalar(2)*this->x(); >- const Scalar ty = Scalar(2)*this->y(); >- const Scalar tz = Scalar(2)*this->z(); >+ Scalar n2 = this->squaredNorm(); >+ if (n2 == 0) >+ { >+ res.setIdentity(); >+ return res; >+ } >+ >+ const Scalar two_by_squarednorm = 2./n2; >+ const Scalar tx = two_by_squarednorm*this->x(); >+ const Scalar ty = two_by_squarednorm*this->y(); >+ const Scalar tz = two_by_squarednorm*this->z(); > const Scalar twx = tx*this->w(); > const Scalar twy = ty*this->w(); > const Scalar twz = tz*this->w();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
strasdat
:
review?
(
gael.guennebaud
)
Actions:
View
|
Diff
Attachments on
bug 458
: 266