diff --git a/cpp/Point2.cpp b/cpp/Point2.cpp index 8e7acf675..fe6b29692 100644 --- a/cpp/Point2.cpp +++ b/cpp/Point2.cpp @@ -6,18 +6,24 @@ #include "Point2.h" +using namespace std; + namespace gtsam { -/* ************************************************************************* */ -bool assert_equal(const Point2& p, const Point2& q, double tol) { + /* ************************************************************************* */ + void Point2::print(const string& s) const { + cout << s << "(" << x_ << ", " << y_ << ")" << endl; + } - if(fabs(p.x() - q.x()) < tol && fabs(p.y() - q.y()) < tol) return true; - printf("not equal:\n"); - p.print("p = "); - q.print("q = "); - (p-q).print("p-q = "); - return false; -} + /* ************************************************************************* */ + bool assert_equal(const Point2& p, const Point2& q, double tol) { + if (fabs(p.x() - q.x()) < tol && fabs(p.y() - q.y()) < tol) return true; + printf("not equal:\n"); + p.print("p = "); + q.print("q = "); + (p - q).print("p-q = "); + return false; + } /* ************************************************************************* */ diff --git a/cpp/Point2.h b/cpp/Point2.h index 7ccb6c503..e29538c7f 100644 --- a/cpp/Point2.h +++ b/cpp/Point2.h @@ -50,9 +50,7 @@ namespace gtsam { inline Point2 operator - (const Point2& q) const {return Point2(x_-q.x_,y_-q.y_);} /** print with optional string */ - void print(const std::string& s = "") const { - std::cout << s << "(" << x_ << ", " << y_ << ")" << std::endl; - } + void print(const std::string& s = "") const; /** distance between two points */ double dist(const Point2& p2) const {