Formatting, and moved print to cpp.

release/4.3a0
Frank Dellaert 2009-08-29 01:22:40 +00:00
parent ea0e16caf5
commit 6e23d61221
2 changed files with 16 additions and 12 deletions

View File

@ -6,18 +6,24 @@
#include "Point2.h" #include "Point2.h"
using namespace std;
namespace gtsam { 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"); bool assert_equal(const Point2& p, const Point2& q, double tol) {
p.print("p = "); if (fabs(p.x() - q.x()) < tol && fabs(p.y() - q.y()) < tol) return true;
q.print("q = "); printf("not equal:\n");
(p-q).print("p-q = "); p.print("p = ");
return false; q.print("q = ");
} (p - q).print("p-q = ");
return false;
}
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -50,9 +50,7 @@ namespace gtsam {
inline Point2 operator - (const Point2& q) const {return Point2(x_-q.x_,y_-q.y_);} inline Point2 operator - (const Point2& q) const {return Point2(x_-q.x_,y_-q.y_);}
/** print with optional string */ /** print with optional string */
void print(const std::string& s = "") const { void print(const std::string& s = "") const;
std::cout << s << "(" << x_ << ", " << y_ << ")" << std::endl;
}
/** distance between two points */ /** distance between two points */
double dist(const Point2& p2) const { double dist(const Point2& p2) const {