iSAM
Point2d.h
Go to the documentation of this file.
00001 
00028 #pragma once
00029 
00030 #include <Eigen/Dense>
00031 
00032 namespace Eigen {
00033  typedef Matrix<bool, Dynamic, 1> VectorXb;
00034 }
00035 
00036 namespace isam {
00037 
00038 class Point2d {
00039   friend std::ostream& operator<<(std::ostream& out, const Point2d& p) {
00040     p.write(out);
00041     return out;
00042   }
00043 
00044   double _x;
00045   double _y;
00046 
00047 public:
00048   static const int dim = 2;
00049   static const int size = 2;
00050   static const char* name() {
00051     return "Point2d";
00052   }
00053   Point2d() : _x(0), _y(0) {}
00054   Point2d(double x, double y) : _x(x), _y(y) {}
00055   Point2d(const Eigen::Vector2d& vec) : _x(vec(0)), _y(vec(1)) {}
00056 
00057   double x() const {return _x;}
00058   double y() const {return _y;}
00059 
00060   void set_x(double x) {_x = x;}
00061   void set_y(double y) {_y = y;}
00062 
00063   Point2d exmap(const Eigen::Vector2d& delta) const {
00064     Point2d res = *this;
00065     res._x += delta(0);
00066     res._y += delta(1);
00067     return res;
00068   }
00069 
00070   Eigen::Vector2d vector() const {
00071     Eigen::Vector2d v(_x, _y);
00072     return v;
00073   }
00074   void set(double x, double y) {
00075     _x = x;
00076     _y = y;
00077   }
00078   void set(const Eigen::Vector2d& v) {
00079     _x = v(0);
00080     _y = v(1);
00081   }
00082   void write(std::ostream &out) const {
00083     out << "(" << _x << ", " << _y << ")";
00084   }
00085   
00086   Eigen::VectorXb is_angle() const {
00087     return Eigen::VectorXb::Zero(size);
00088   }
00089   
00090 };
00091 
00092 }
 All Classes Files Functions Variables