From 3f1d0cdc2270f13fbc72d6b7080012e22329aabd Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 3 Nov 2016 11:03:08 +0100 Subject: [PATCH] bug #1337: improve doc of homogeneous() and hnormalized() --- Eigen/src/Core/VectorwiseOp.h | 2 +- Eigen/src/Geometry/Homogeneous.h | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 14f403594..4fe267e9f 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -602,7 +602,7 @@ template class VectorwiseOp return m_matrix / extendedTo(other.derived()); } - /** \returns an expression where each column of row of the referenced matrix are normalized. + /** \returns an expression where each column (or row) of the referenced matrix are normalized. * The referenced matrix is \b not modified. * \sa MatrixBase::normalized(), normalize() */ diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h index b4d7946e3..5f0da1a9e 100644 --- a/Eigen/src/Geometry/Homogeneous.h +++ b/Eigen/src/Geometry/Homogeneous.h @@ -114,7 +114,9 @@ template class Homogeneous /** \geometry_module \ingroup Geometry_Module * - * \return an expression of the equivalent homogeneous vector + * \returns a vector expression that is one longer than the vector argument, with the value 1 symbolically appended as the last coefficient. + * + * This can be used to convert affine coordinates to homogeneous coordinates. * * \only_for_vectors * @@ -133,7 +135,9 @@ MatrixBase::homogeneous() const /** \geometry_module \ingroup Geometry_Module * - * \returns a matrix expression of homogeneous column (or row) vectors + * \returns an expression where the value 1 is symbolically appended as the final coefficient to each column (or row) of the matrix. + * + * This can be used to convert affine coordinates to homogeneous coordinates. * * Example: \include VectorwiseOp_homogeneous.cpp * Output: \verbinclude VectorwiseOp_homogeneous.out @@ -148,7 +152,16 @@ VectorwiseOp::homogeneous() const /** \geometry_module \ingroup Geometry_Module * - * \returns an expression of the homogeneous normalized vector of \c *this + * \brief homogeneous normalization + * + * \returns a vector expression of the N-1 first coefficients of \c *this divided by that last coefficient. + * + * This can be used to convert homogeneous coordinates to affine coordinates. + * + * It is essentially a shortcut for: + * \code + this->head(this->size()-1)/this->coeff(this->size()-1); + \endcode * * Example: \include MatrixBase_hnormalized.cpp * Output: \verbinclude MatrixBase_hnormalized.out @@ -166,7 +179,13 @@ MatrixBase::hnormalized() const /** \geometry_module \ingroup Geometry_Module * - * \returns an expression of the homogeneous normalized vector of \c *this + * \brief column or row-wise homogeneous normalization + * + * \returns an expression of the first N-1 coefficients of each column (or row) of \c *this divided by the last coefficient of each column (or row). + * + * This can be used to convert homogeneous coordinates to affine coordinates. + * + * It is conceptually equivalent to calling MatrixBase::hnormalized() to each column (or row) of \c *this. * * Example: \include DirectionWise_hnormalized.cpp * Output: \verbinclude DirectionWise_hnormalized.out