Cleaned up printing of Pose3
parent
0e42a96294
commit
7815a27e21
|
|
@ -104,9 +104,7 @@ Vector6 Pose3::adjointTranspose(const Vector6& xi, const Vector6& y,
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Pose3::print(const string& s) const {
|
void Pose3::print(const string& s) const {
|
||||||
cout << s;
|
cout << (s.empty() ? s : s + " ") << *this << endl;
|
||||||
R_.print("R:\n");
|
|
||||||
cout << t_ << ";" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
@ -436,9 +434,9 @@ boost::optional<Pose3> align(const vector<Point3Pair>& baPointPairs) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
std::ostream &operator<<(std::ostream &os, const Pose3& pose) {
|
std::ostream &operator<<(std::ostream &os, const Pose3& pose) {
|
||||||
os << pose.rotation() << "\n";
|
// Both Rot3 and Point3 have ostream definitions so we use them.
|
||||||
const Point3& t = pose.translation();
|
os << "R: " << pose.rotation() << "\n";
|
||||||
os << '[' << t.x() << ", " << t.y() << ", " << t.z() << "]\';\n";
|
os << "t: " << pose.translation();
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -839,7 +839,7 @@ TEST( Pose3, stream)
|
||||||
Pose3 T;
|
Pose3 T;
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << T;
|
os << T;
|
||||||
string expected = "[\n\t1, 0, 0;\n\t0, 1, 0;\n\t0, 0, 1\n]\n\n[0, 0, 0]';\n";
|
string expected = "R: [\n\t1, 0, 0;\n\t0, 1, 0;\n\t0, 0, 1\n]\nt: [0, 0, 0]'";
|
||||||
EXPECT(os.str() == expected);
|
EXPECT(os.str() == expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1011,14 +1011,14 @@ TEST(Pose3, print) {
|
||||||
Point3 translation(1, 2, 3);
|
Point3 translation(1, 2, 3);
|
||||||
|
|
||||||
// Add expected rotation
|
// Add expected rotation
|
||||||
expected << "R:\n[\n\t1, 0, 0;\n\t0, 1, 0;\n\t0, 0, 1\n]\n";
|
expected << "R: [\n\t1, 0, 0;\n\t0, 1, 0;\n\t0, 0, 1\n]\n";
|
||||||
|
|
||||||
#ifdef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
#ifdef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
expected << "1\n"
|
expected << "1\n"
|
||||||
"2\n"
|
"2\n"
|
||||||
"3;\n";
|
"3;\n";
|
||||||
#else
|
#else
|
||||||
expected << '[' << translation.x() << ", " << translation.y() << ", " << translation.z() << "]\';\n";
|
expected << "t: [" << translation.x() << ", " << translation.y() << ", " << translation.z() << "]'\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// reset cout to the original stream
|
// reset cout to the original stream
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue