3D数学:计算银行(卷)从外观的角度和高达正交向量正交、向量、外观、角度

2023-09-08 10:40:09 作者:且行且珍惜

我希望这是正确的位置来问这个问题,这是的同这个,但EX pressed纯数学,而不是图形(至少我希望我正确的翻译问题,以数学)。

I hope this is the proper location to ask this question which is the same as this one, but expressed as pure math instead of graphically (at least I hope I translated the problem to math correctly).

考虑:

在两个向量相互正交:向上(UX,UY,UZ)和看(LX,LY,LZ) 在一个平面P垂直于看(因此包括高达) Y1是Y(垂直轴),以及外观的投影P

问题:什么是Y1和向上之间的角度的值

Question: what is the value of the angle between Y1 and Up?

正如数学家会同意,这是一个非常基本的问题,但我一直在抓我的头,至少有两个星期没有能够直观地了解项目Ÿ到P ...也许现在太老了寻求解决办法学校练习。

As mathematicians will agree, this is a very basic question, but I've been scratching my head for at least two weeks without being able to visualize how to project Y onto P... maybe now too old for finding solutions to school exercises.

我要寻找的三角函数解决方案,而不是使用矩阵解决方案。谢谢你。

I'm looking for the trigonometric solution, not a solution using a matrix. Thanks.

修改:我发现我需要确定角度的符号,相对于旋转轴这不得不看。我张贴的最后code对我的链接的问题(见以上链接)。感谢那些谁帮助。我AP preciate你的时间。

Edit: I found that I needed to determine the sign of the angle, relative to a rotation axis which had to be Look. I posted the final code on my linked question (see link above). Thanks to those who helped. I appreciate your time.

推荐答案

我只是在做这在纸面上。我希望这是正确的。

I'm just doing this on paper. I hope it's right.

让我们假设时望向归一,也就是,长度为1比方说,平面P包含原点,L为正常。 Y是(0,1,0)

Let's assume Up and Look are normalized, that is, length 1. Let's say that plane P contains the origin, and L is its normal. Y is (0, 1, 0)

要投射Ÿ到P,求其距离P ...

To project Y onto P, find its distance to P...

d = Y dot L = ly

...然后缩放正常通过-d得到Y1(即,Y对P的投影)

...and then scale the normal by -d to get the Y1 (that is, the projection of Y on P)

Y1 = (lx * ly, ly * ly, lz * ly)

现在归Y1,即,(1 /长度)缩放。如果它的长度为0,那么你的运气了。

Now normalize Y1, that is, scale it by (1 / length). If its length was 0 then you're out of luck.

Y1和向上的点积=的角度的余弦值。因此,

The dot product of Y1 and Up = the cosine of the angle. So

angle = acos(Y1 dot Up)