如何确保本征等轴测图保持等轴测图

如何确保本征等轴测图保持等轴测图

本文介绍了如何确保本征等轴测图保持等轴测图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究Eigen::Isometry3f,其定义为typedef Transform<float,3,Isometry> Isometry3f;.

I am currently looking into Eigen::Isometry3f, defined astypedef Transform<float,3,Isometry> Isometry3f;.

因此,例如,我无法将Affine3f分配给该Isometry3f,这对于保持等轴测图完整无缺. (原因是在Transform的赋值运算符中检查了Mode.)

Therewith i cannot, for example, assign an Affine3f to that Isometry3f, which is good to keep the isometry intact. (The reason is, that Mode is checked in the assignment operator of Transform.)

但是我可以-通过Transform::operator(...)快捷方式-

I can however - via the Transform::operator(...), which shortcuts to Transform::m_matrix(...) - do

Eigen::Isometry3f iso;
iso.setIdentity();
iso(1, 1) = 2; //works (but should not ?!)

从而破坏了等轴测图.

第一季度:不应禁止Transform::operator(...)或至少发出警告吗?如果您真的想弄乱,仍然可以使用Transform.matrix()(1,1) = 2 ...

Q1:Shouldn't Transform::operator(...) be disallowed or at least issue a warning? If you really want to mess up you could still use Transform.matrix()(1,1) = 2 ...

第二季度:还有其他陷阱可以使我不小心破坏等轴测图吗?

Q2:Are there other pitfalls where i could accidentally destroy my isometry?

第三季度:如果还有其他陷阱:Mode==Isometry的意图是什么?是不是要确保封闭性/安全性?

Q3:If there are other pitfalls: what is the intention of Mode==Isometry? Is it not to ensure closedness/safety?

推荐答案

Mode==Isometry的主要目的是提高某些操作的速度,例如反转或提取旋转部分.它本质上是在说我,用户,对Eigen的保证是底层矩阵表示等轴测图".因此,用户有责任不射击自己.您还可以通过用不良矩阵替换线性部分来破坏初始等距图:

The main purpose of Mode==Isometry is to improve the speed of some operations, like inversion, or extraction of rotation part. It essentially says "I, the user, guaranty to Eigen that the underlying matrix represent an isometry". So it is the responsibility of the user to no shoot itself. You can also break an initial isometry by replacing the linear part with a bad matrix:

iso.linear() = Matrix3f::Random();

检查等距并不便宜,因此在各处添加检查会破坏最初的目的.也许添加bool Transform::checkIsometry()有助于跟踪用户代码中的问题,但这超出了SO的范围.

Checking for isometry is not cheap at all, so adding checks everywhere would break the initial purpose. Perhaps, adding a bool Transform::checkIsometry() would help tracking issues in user code, but this is out-of the scope of SO.

这篇关于如何确保本征等轴测图保持等轴测图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 06:29