diff --git a/cpp/Point2.h b/cpp/Point2.h index 3dafe50ea..c1579b610 100644 --- a/cpp/Point2.h +++ b/cpp/Point2.h @@ -20,6 +20,10 @@ namespace gtsam { * Functional, so no set functions: once created, a point is constant. */ class Point2: Testable, public Lie { + public: + /// dimension of the variable - used to autodetect sizes + static inline size_t dim() {return 2;} + private: double x_, y_; diff --git a/cpp/visualSLAM.h b/cpp/visualSLAM.h index 119f9addf..c59cc8f86 100644 --- a/cpp/visualSLAM.h +++ b/cpp/visualSLAM.h @@ -34,8 +34,8 @@ namespace gtsam { namespace visualSLAM { * Non-linear factor for a constraint derived from a 2D measurement, * i.e. the main building block for visual SLAM. */ - template - class GenericProjectionFactor : public NonlinearFactor2, Testable > { + template + class GenericProjectionFactor : public NonlinearFactor2, Testable > { private: // Keep a copy of measurement and calibration for I/O @@ -45,7 +45,7 @@ namespace gtsam { namespace visualSLAM { public: // shorthand for base class type - typedef NonlinearFactor2 Base; + typedef NonlinearFactor2 Base; // shorthand for a smart pointer to a factor typedef boost::shared_ptr shared_ptr; @@ -64,8 +64,8 @@ namespace gtsam { namespace visualSLAM { * @param K the constant calibration */ GenericProjectionFactor(const Point2& z, - const SharedGaussian& model, PoseKey j_pose, - PointKey j_landmark, const shared_ptrK& K) : + const SharedGaussian& model, PosK j_pose, + LmK j_landmark, const shared_ptrK& K) : z_(z), K_(K), Base(model, j_pose, j_landmark) { } @@ -113,7 +113,8 @@ namespace gtsam { namespace visualSLAM { } }; - typedef GenericProjectionFactor ProjectionFactor; + // Typedef for general use + typedef GenericProjectionFactor ProjectionFactor;