techoe / ceres-solver

Automatically exported from code.google.com/p/ceres-solver
Other
0 stars 0 forks source link

Possibly incorrect Taylor series expansion in rotation.h AngleAxisToRotationMatrix #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

The near 0 approximation in AngleAxisToRotationMatrix seems to have reversed 
sign for the skew-symmetric matrix component.  I'm not actually sure if this 
would affect many users in real situations, since it's only used when amount of 
rotation is quite close to 0.

What steps will reproduce the problem?
1. Generate random 3D points
2. Rotate by small amounts, decreasing amount of rotation on each iteration
3. Observe discontinuity when theta2 < threshhold

What is the expected output? What do you see instead?

Expected result is for continuous approximation at small angles. Discontinuity 
is observed.

What version of the product are you using? On what operating system?

1.7

Please provide any additional information below.

I switched the signs on it, tested, and it works fine.

from rotation.h, AngleAxisToRotationMatrix

#if 0
    // At zero, we switch to using the first order Taylor expansion.
    R(0, 0) =  kOne;
    R(1, 0) = -angle_axis[2];
    R(2, 0) =  angle_axis[1];
    R(0, 1) =  angle_axis[2];
    R(1, 1) =  kOne;
    R(2, 1) = -angle_axis[0];
    R(0, 2) = -angle_axis[1];
    R(1, 2) =  angle_axis[0];
    R(2, 2) = kOne;
#else
    R(0, 0) =  kOne;
    R(1, 0) =  angle_axis[2];
    R(2, 0) =  -angle_axis[1];
    R(0, 1) =  -angle_axis[2];
    R(1, 1) =  kOne;
    R(2, 1) =  angle_axis[0];
    R(0, 2) =  angle_axis[1];
    R(1, 2) = -angle_axis[0];
    R(2, 2) = kOne;

#endif

Original issue reported on code.google.com by michael....@gmail.com on 25 Oct 2013 at 4:57

GoogleCodeExporter commented 9 years ago
Thanks Michael, let me take a look. I did some "cleanup" recently and I 
probably screwed something up and the tests did not catch it.

Original comment by sameerag...@google.com on 25 Oct 2013 at 5:01

GoogleCodeExporter commented 9 years ago
Michael,

https://ceres-solver-review.googlesource.com/#/c/4180/

is out for review and should fix this.

Original comment by sameerag...@google.com on 25 Oct 2013 at 5:23

GoogleCodeExporter commented 9 years ago
This is now merged into the master branch.

Original comment by sameerag...@google.com on 25 Oct 2013 at 8:57