我正在使用Eigen库,并收到以下非常奇怪的异常:
运行时检查失败#2-变量'myVariableCopy'周围的堆栈已损坏。
它来自以下代码:
void get_new_handle_locations()
{
int count = 0;
for (long vi = 0; vi < V.rows(); ++vi)
{
if (handle_id[vi] >= 0)
{
Eigen::RowVector3f myVariable = V.row(vi).cast<float>();
if (handle_id[vi] == moving_handle)
{
Eigen::RowVector3f myVariableCopy = myVariable;
myVariable -= handle_centroids.row(moving_handle).cast<float>();
igl::rotate_by_quat(myVariable.data(), rotation.data(), myVariableCopy.data());
myVariable = myVariableCopy;
myVariable += handle_centroids.row(moving_handle).cast<float>();
}
handle_vertex_positions.row(count++) = myVariable.cast<double>();
}
}
} // This is where the exception is thrown
循环结束后会引发异常,并且条件在最后约100次迭代中均未通过,因此,此时应确保变量超出范围
我正在使用VS 2017。
我抑制了此异常,但是我应该担心还是VS错误?
损坏的原因是期望具有4维的igl::rotate_by_quat
调用,但已将其声明为3维向量。igl::quat_mult
goalPositionCopy.data()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句