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"
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;
}
/* ************************************************************************* */

View File

@ -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 {