From 8f17fbcc8e06f9bf1b79129a28ebf1f2f5961a51 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 17 Mar 2020 13:11:48 -0400 Subject: [PATCH] improved printing for Point3 and Unit3 --- gtsam/geometry/Point3.cpp | 5 ++++- gtsam/geometry/Unit3.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gtsam/geometry/Point3.cpp b/gtsam/geometry/Point3.cpp index 8aa339a89..c9452efff 100644 --- a/gtsam/geometry/Point3.cpp +++ b/gtsam/geometry/Point3.cpp @@ -29,7 +29,10 @@ bool Point3::equals(const Point3 &q, double tol) const { } void Point3::print(const string& s) const { - cout << s << *this << endl; + if (s.size() != 0) { + cout << s << " "; + } + cout << *this << endl; } /* ************************************************************************* */ diff --git a/gtsam/geometry/Unit3.cpp b/gtsam/geometry/Unit3.cpp index 3d46b18b8..a2a7e6851 100755 --- a/gtsam/geometry/Unit3.cpp +++ b/gtsam/geometry/Unit3.cpp @@ -154,7 +154,10 @@ std::ostream& operator<<(std::ostream& os, const Unit3& pair) { /* ************************************************************************* */ void Unit3::print(const std::string& s) const { - cout << s << ":" << p_ << endl; + if(s.size() != 0) { + cout << s << ":"; + } + cout << p_ << endl; } /* ************************************************************************* */