More doxygen documentation and grouping as a gold standard for Nick :-)

release/4.3a0
Frank Dellaert 2012-01-24 03:05:28 +00:00
parent 4e2d7a69bd
commit 210d0612d0
1 changed files with 36 additions and 36 deletions

View File

@ -42,20 +42,20 @@ public:
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{
///TODO: comment /// default constructor
Point2(): x_(0), y_(0) {} Point2(): x_(0), y_(0) {}
///TODO: comment /// copy constructor
Point2(const Point2 &p) : x_(p.x_), y_(p.y_) {} Point2(const Point2 &p) : x_(p.x_), y_(p.y_) {}
///TODO: comment /// construct from doubles
Point2(double x, double y): x_(x), y_(y) {} Point2(double x, double y): x_(x), y_(y) {}
/// @} /// @}
/// @name Advanced Constructors /// @name Advanced Constructors
/// @{ /// @{
///TODO: comment /// construct from 2D vector
Point2(const Vector& v) : x_(v(0)), y_(v(1)) { assert(v.size() == 2); } Point2(const Vector& v) : x_(v(0)), y_(v(1)) { assert(v.size() == 2); }
/// @} /// @}
@ -80,6 +80,9 @@ public:
/// "Inverse" - negates each coordinate such that compose(p,inverse(p))=Point2() /// "Inverse" - negates each coordinate such that compose(p,inverse(p))=Point2()
inline Point2 inverse() const { return Point2(-x_, -y_); } inline Point2 inverse() const { return Point2(-x_, -y_); }
/// syntactic sugar for inverse
inline Point2 operator- () const {return Point2(-x_,-y_);}
/// "Compose", just adds the coordinates of two points. With optional derivatives /// "Compose", just adds the coordinates of two points. With optional derivatives
inline Point2 compose(const Point2& p2, inline Point2 compose(const Point2& p2,
boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H1=boost::none,
@ -89,21 +92,21 @@ public:
return *this + p2; return *this + p2;
} }
///TODO: comment /// syntactic sugar for adding two points (compose())
inline Point2 operator- () const {return Point2(-x_,-y_);}
///TODO: comment
inline Point2 operator + (const Point2& q) const {return Point2(x_+q.x_,y_+q.y_);} inline Point2 operator + (const Point2& q) const {return Point2(x_+q.x_,y_+q.y_);}
///TODO: comment /// "Between", subtracts point coordinates. between(p,q) = compose(inverse(p),q)
inline Point2 between(const Point2& p2,
boost::optional<Matrix&> H1=boost::none,
boost::optional<Matrix&> H2=boost::none) const {
if(H1) *H1 = -eye(2);
if(H2) *H2 = eye(2);
return p2 - (*this);
}
/// syntactic sugar for vector subtraction, i.e., between()
inline Point2 operator - (const Point2& q) const {return Point2(x_-q.x_,y_-q.y_);} inline Point2 operator - (const Point2& q) const {return Point2(x_-q.x_,y_-q.y_);}
///TODO: comment
inline Point2 operator * (double s) const {return Point2(x_*s,y_*s);}
///TODO: comment
inline Point2 operator / (double q) const {return Point2(x_/q,y_/q);}
/// @} /// @}
/// @name Manifold /// @name Manifold
/// @{ /// @{
@ -131,7 +134,7 @@ public:
static inline Vector Logmap(const Point2& dp) { return Vector_(2, dp.x(), dp.y()); } static inline Vector Logmap(const Point2& dp) { return Vector_(2, dp.x(), dp.y()); }
/// @} /// @}
/// @name Vector Operators /// @name Vector Space
/// @{ /// @{
/** norm of point */ /** norm of point */
@ -145,27 +148,18 @@ public:
return (p2 - *this).norm(); return (p2 - *this).norm();
} }
///TODO: comment /// multiply with a scalar
inline void operator += (const Point2& q) {x_+=q.x_;y_+=q.y_;} inline Point2 operator * (double s) const {return Point2(x_*s,y_*s);}
///TODO: comment /// divide by a scalar
inline void operator *= (double s) {x_*=s;y_*=s;} inline Point2 operator / (double q) const {return Point2(x_/q,y_/q);}
///TODO: comment
inline bool operator ==(const Point2& q) const {return x_==q.x_ && q.y_==q.y_;}
/// @} /// @}
/// @name Standard Interface /// @name Standard Interface
/// @{ /// @{
/** "Between", subtracts point coordinates */ /// equality
inline Point2 between(const Point2& p2, inline bool operator ==(const Point2& q) const {return x_==q.x_ && q.y_==q.y_;}
boost::optional<Matrix&> H1=boost::none,
boost::optional<Matrix&> H2=boost::none) const {
if(H1) *H1 = -eye(2);
if(H2) *H2 = eye(2);
return p2 - (*this);
}
/// get x /// get x
double x() const {return x_;} double x() const {return x_;}
@ -173,12 +167,18 @@ public:
/// get y /// get y
double y() const {return y_;} double y() const {return y_;}
/** return vectorized form (column-wise) */ /// return vectorized form (column-wise). TODO: why does this function exist?
Vector vector() const { return Vector_(2, x_, y_); } Vector vector() const { return Vector_(2, x_, y_); }
/// @}
/// @name Deprecated (non-const, non-functional style. Do not use).
/// @{
inline void operator += (const Point2& q) {x_+=q.x_;y_+=q.y_;}
inline void operator *= (double s) {x_*=s;y_*=s;}
/// @}
private: private:
/// @}
/// @name Advanced Interface /// @name Advanced Interface
/// @{ /// @{
@ -191,12 +191,12 @@ private:
ar & BOOST_SERIALIZATION_NVP(y_); ar & BOOST_SERIALIZATION_NVP(y_);
} }
/// @}
}; };
/** multiply with scalar */ /// multiply with scalar
inline Point2 operator*(double s, const Point2& p) {return p*s;} inline Point2 operator*(double s, const Point2& p) {return p*s;}
/// @}
} }