Bug fix in Rot3 for logmap(identity)
parent
1dcc864d97
commit
b0fd5396ad
|
@ -158,7 +158,7 @@ namespace gtsam {
|
|||
// Log map at identity - return the canonical coordinates of this rotation
|
||||
inline Vector logmap(const Rot3& R) {
|
||||
double tr = R.r1().x()+R.r2().y()+R.r3().z();
|
||||
if (tr==3.0) return ones(3); // todo: identity?
|
||||
if (tr==3.0) return zero(3);
|
||||
if (tr==-1.0) throw std::domain_error("Rot3::log: trace == -1 not yet handled :-(");;
|
||||
double theta = acos((tr-1.0)/2.0);
|
||||
return (theta/2.0/sin(theta))*Vector_(3,
|
||||
|
|
|
@ -121,6 +121,14 @@ TEST(Rot3, log)
|
|||
Vector w = Vector_(3, 0.1, 0.4, 0.2);
|
||||
Rot3 R = rodriguez(w);
|
||||
CHECK(assert_equal(w, logmap(R)));
|
||||
|
||||
Vector w5 = Vector_(3, 0.0, 0.0, 0.0);
|
||||
Rot3 R5 = rodriguez(w5);
|
||||
CHECK(assert_equal(w5, logmap(R5)));
|
||||
|
||||
// Vector w6 = Vector_(3, M_PI, 0.0, 0.0);
|
||||
// Rot3 R6 = rodriguez(w6);
|
||||
// CHECK(assert_equal(w6, logmap(R6)));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
Loading…
Reference in New Issue