如何在Eigen中转换矩阵(4x4)?
//identity matrix 4x4 /*type=*/Eigen::Matrix/*name=*/result = Eigen::Matrix ::Identity(); //translation vector // 3.0f // 4.0f // 5.0f Translation trans(3.0f, 4.0f, 5.0f);
即,我有矩阵:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
我想得到:
1.0 0.0 0.0 3.0
0.0 1.0 0.0 4.0
0.0 0.0 1.0 5.0
0.0 0.0 0.0 1.0
对?我怎么能这样做?
我可以做这个:
result(0, 3) = 3.0f; result(1, 3) = 4.0f; result(2, 3) = 5.0f;
但它并不优雅.=)你的建议是什么?
像这样:
Affine3f transform(Translation3f(1,2,3)); Matrix4f matrix = transform.matrix();
这是更详细的文档.