Cleaned up printing of Rot3

release/4.3a0
Varun Agrawal 2020-06-18 11:09:37 -05:00
parent f7141f4333
commit 0e42a96294
3 changed files with 5 additions and 4 deletions

View File

@ -32,7 +32,8 @@ namespace gtsam {
/* ************************************************************************* */
void Rot3::print(const std::string& s) const {
gtsam::print((Matrix)matrix(), s);
cout << (s.empty() ? "R: " : s + " ");
gtsam::print((Matrix)matrix());
}
/* ************************************************************************* */
@ -222,7 +223,7 @@ pair<Matrix3, Vector3> RQ(const Matrix3& A) {
/* ************************************************************************* */
ostream &operator<<(ostream &os, const Rot3& R) {
os << R.matrix().format(matlab) << endl;
os << R.matrix().format(matlab);
return os;
}

View File

@ -254,7 +254,7 @@ namespace gtsam {
/// @{
/** print */
void print(const std::string& s="R") const;
void print(const std::string& s="") const;
/** equals with an tolerance */
bool equals(const Rot3& p, double tol = 1e-9) const;

View File

@ -608,7 +608,7 @@ TEST( Rot3, stream)
Rot3 R;
std::ostringstream os;
os << R;
string expected = "[\n\t1, 0, 0;\n\t0, 1, 0;\n\t0, 0, 1\n]\n";
string expected = "[\n\t1, 0, 0;\n\t0, 1, 0;\n\t0, 0, 1\n]";
EXPECT(os.str() == expected);
}