开发者

Compare Quaternion to axis

开发者 https://www.devze.com 2023-01-15 22:31 出处:网络
I have the orientation of an object stored as a unit quaternion, and I want to see what angle the object\'s local x axis makes with the global y axis.What\'s the easiest way t开发者_开发技巧o do that?

I have the orientation of an object stored as a unit quaternion, and I want to see what angle the object's local x axis makes with the global y axis. What's the easiest way t开发者_开发技巧o do that?

Thanks!


I was overthinking it... rotate the vector (1, 0, 0), the local x axis into the global frame. Dot it with the global y vector, and take the arcCos of it. Since I didn't care about the object being upside down, I took

acos(abs(rotateVector(myQuat, vector(1, 0, 0)), upVector))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号