Arcball旋转90度 [英] Arcball Rotation at 90 degrees

查看:385
本文介绍了Arcball旋转90度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地通过四元数实现了Arcball旋转,但是当相机的方向向量与向上的向量平行时,我会感到困惑。目前,当方向向量和向量向量的点积超过0.99时,我只是限制沿x轴(节距)的旋转。在Maya(或Max,XSI,其中使用arcball旋转)例如,您可以非常顺利地在一个完整的圆周围旋转。我希望有一个类似于Maya旋转的解决方案。

I have successfully implemented Arcball rotation through quaternions, but am confused at what to do when the direction vector of the camera is parallel to up vector. Currently I am just restricting the rotation along the x-axis (the pitch) when the dot product of the direction vector and the up vector exceeds 0.99. In Maya (or Max, XSI where arcball rotation is used) for example, you can rotate around in a full circle very smoothly. I am hoping for a solution similar to that of Maya's rotation.

谢谢

推荐答案

您需要同时调整视图法向量(VNV)和向上视图向量(VUV),并将它们旋转在一起,以便它们始终保持彼此正交。跟踪一个正确(或左)向量有时是有用的,它只是正常向量和向量向量的叉积。

You need to adjust both the view normal vector (VNV) and the view up vector (VUV) and rotate both of them together so they always remain orthogonal to each other. It is sometimes useful to keep track of a "right" (or "left") vector as well which is just the cross product of the normal and up vectors.

这篇关于Arcball旋转90度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆