gtsam/cpp/Point2.cpp

31 lines
829 B
C++
Raw Normal View History

2009-08-22 06:23:24 +08:00
/**
* @file Point2.cpp
* @brief 2D Point
* @author Frank Dellaert
*/
#include "Point2.h"
2009-08-29 09:22:40 +08:00
using namespace std;
2009-08-22 06:23:24 +08:00
namespace gtsam {
2009-08-29 09:22:40 +08:00
/* ************************************************************************* */
void Point2::print(const string& s) const {
cout << s << "(" << x_ << ", " << y_ << ")" << endl;
}
2009-08-22 06:23:24 +08:00
2009-09-07 11:35:32 +08:00
/* ************************************************************************* */
bool Point2::equals(const Point2& q, double tol) const {
return (fabs(x_ - q.x()) < tol && fabs(y_ - q.y()) < tol);
}
2009-08-29 09:22:40 +08:00
/* ************************************************************************* */
double Point2::dist(const Point2& p2) const {
return sqrt(pow(x() - p2.x(), 2.0) + pow(y() - p2.y(), 2.0));
2009-08-29 09:22:40 +08:00
}
2009-08-22 06:23:24 +08:00
/* ************************************************************************* */
} // namespace gtsam