C++ 如何将参数转换为需要所有常量值的方法?
为了 此调用返回true,即successC++ 如何将参数转换为需要所有常量值的方法?,c++,constants,C++,Constants,为了 此调用返回true,即success camera->set( cVector3d (1, 0.0, 3), // camera position (eye) cVector3d (0.0, 0.0, 0.0), // lookat position (target) cVector3d (-1.0, 0.0, 0.0)); // direction of the "up" vector); } 我没有收到任何错误,但是这个调
camera->set( cVector3d (1, 0.0, 3), // camera position (eye)
cVector3d (0.0, 0.0, 0.0), // lookat position (target)
cVector3d (-1.0, 0.0, 0.0)); // direction of the "up" vector);
}
我没有收到任何错误,但是这个调用返回false,这是因为无法设置摄像机的新位置,为什么
camera->set( cVector3d(toolPos.x,toolPos.y,toolPos.z),
cVector3d(toolPos.x,toolPos.y,toolPos.z),
cVector3d (1.0, 0.0, 0.0));
当我使用断点检查时,工具是一个cVector3d变量,具有有效值
cVector3d的定义是
cVector3d (const double a_x, const double a_y, const double a_z)
构造函数通过传递一个double来初始化向量 您的第一个向量(相机位置)和第二个向量(注视位置)具有相同的值。设置新位置的算法无法确定相机所面对的方向,因为没有从
眼睛
到注视
的方向。只需将lookat position
从eye
移动到您想看的方向。这不意味着什么?它怎么不起作用?编译失败?seg故障?
cVector3d (const double a_x, const double a_y, const double a_z)