Re: [eigen] Cumbersome syntax questions/feedback

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi again,

Another thing that would make my life a bit easier is adding col() and
row() methods to Eigen::Transform, similar to the operator()(int row,
int col) shortcut already available.

I.e. being able to write:

  Eigen::Transform3f T;
  ...
  T.row(0) = ...;

rather than

  T.matrix().row(0) = ...;

Are there any reasons this is a bad idea? I tried it out and it seems to
work alright, the patch against 2.0.4 is attached.

/Staffan
--- /home/staffan/Download/eigen2/Eigen/src/Geometry/Transform.h	2009-08-01 00:58:09.000000000 +0200
+++ Eigen/src/Geometry/Transform.h	2009-08-16 20:38:16.654153680 +0200
@@ -156,6 +156,16 @@
     * \sa MatrixBase::operaror(int,int) */
   inline Scalar& operator() (int row, int col) { return m_matrix(row,col); }
 
+  /** \sa MatrixBase::row(int) */
+  inline typename MatrixType::RowXpr row(int row) { return m_matrix.row(row); }
+  /** \sa MatrixBase::row(int) */
+  inline const typename MatrixType::RowXpr row(int row) const { return m_matrix.row(row); }
+
+  /** \sa MatrixBase::col(int) */
+  inline typename MatrixType::ColXpr col(int col) { return m_matrix.col(col); }
+  /** \sa MatrixBase::col(int) */
+  inline const typename MatrixType::ColXpr col(int col) const { return m_matrix.col(col); }
+
   /** \returns a read-only expression of the transformation matrix */
   inline const MatrixType& matrix() const { return m_matrix; }
   /** \returns a writable expression of the transformation matrix */

Attachment: signature.asc
Description: This is a digitally signed message part



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/