I have a function that does a lot of post/right multiplication of transformation matrixes .Now I want to convert this function to use Eigen and the problem is Eigen Transformation class does the multiplications as pre/left multiplication. Which means it has row matrix format during multiplication While storage is in column matrix format.
is there a way to change Eigen::Transformation class members from row major to column major?
The full signature for the Eigen Matrix
class is
Matrix<typename Scalar,
int RowsAtCompileTime,
int ColsAtCompileTime,
int Options = 0,
int MaxRowsAtCompileTime = RowsAtCompileTime,
int MaxColsAtCompileTime = ColsAtCompileTime>
The 4th argument Options
is described as
Options is a bit field. Here, we discuss only one bit:
RowMajor
. It specifies that the matrices of this type use row-major storage order ; by default, the storage order is column-major. See the page on storage orders. For example, this type means row-major 3x3 matrices
So you could say, for example,
Matrix<int, 3, 4, ColMajor> foo; // column major
Matrix<int, 4, 3, RowMajor> bar; // row major
More documentation on Storage Orders
If the transformation you are referring to is Eigen::Transform
this also has an Options
template argument, which you can also pass RowMajor
vs ColMajor
. Any matrices it produces will follow the same convention that you specify.
Transform<typename Scalar,
int Dim,
int Mode,
int _Options = AutoAlign>
Again the _Options
argument is described as
_Options
has the same meaning as in classMatrix
. It allows to specifyDontAlign
and/orRowMajor
. TheseOptions
are passed directly to the underlying matrix type .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.