New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 806 - Missing scalar type cast in Quaternion setFromTwoVectors()
Missing scalar type cast in Quaternion setFromTwoVectors()
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Geometry
3.2
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-05 10:50 UTC by newstzpz
Modified: 2016-02-03 14:05 UTC (History)
5 users (show)



Attachments

Description newstzpz 2014-05-05 10:50:47 UTC
In the function QuaternionBase<Derived>::setFromTwoVectors() (file Quaternion.h line 587), I think the scalar -1 in the code 

    c = max<Scalar>(c, -1);

should be casted to Scalar like the following

    c = max<Scalar>(c, Scalar(-1));

as other scalars were done in the code.

This would be helpful for some scalar types like ceres::Jet. A compile error will occur if it is not casted.
Comment 1 Christoph Hertzberg 2014-05-05 14:35:45 UTC
Fixed in devel and 3.2. 

https://bitbucket.org/eigen/eigen/commits/bc6cd05
https://bitbucket.org/eigen/eigen/commits/06143e9

Thanks for the report
Comment 2 Gael Guennebaud 2016-02-03 14:05:20 UTC
*** Bug 1163 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.