Formatting, and moved print to cpp.
parent
ea0e16caf5
commit
6e23d61221
|
@ -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;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue