3D 数学:根据“向上”和“向上”正交向量计算倾斜(滚动)角度

发布于 2024-09-06 02:01:38 字数 555 浏览 4 评论 0原文

我希望这是提出这个问题的正确位置,即 与此相同,但表示为纯数学而不是图形(至少我希望我正确地将问题转换为数学)。

考虑:

  • 两个正交向量:Up (ux, uy, uz) 和 Look (lx, ly, lz)
  • 垂直于 Look(因此包括 Up)的平面 P
  • Y1,它是 Y(垂直轴)沿的投影看P

问题:Y1和Up之间的角度值是多少?

正如数学家们会同意的那样,这是一个非常基本的问题,但我已经挠头至少两周了,无法想象如何将 Y 投影到 P 上……也许现在太老了,无法找到学校练习的解决方案。

我正在寻找三角解,而不是使用矩阵的解。谢谢。

编辑:我发现我需要确定角度的符号,相对于必须是“Look”的旋转轴。我在链接的问题上发布了最终代码(请参阅上面的链接)。感谢那些提供帮助的人。我很感激你的时间。

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).

Considering:

  • two vectors that are orthogonal: Up (ux, uy, uz) and Look (lx, ly, lz)
  • a plane P which is perpendicular to Look (hence including Up)
  • Y1 which is the projection of Y (vertical axis) along Look onto P

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

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

满地尘埃落定 2024-09-13 02:01:38

我只是在纸上做这件事。我希望这是对的。

假设 Up 和 Look 已标准化,即长度为 1。假设平面 P 包含原点,L 为其法线。 Y 为 (0, 1, 0)

将 Y 投影到 P 上,求其到 P 的距离...

d = Y dot L = ly

...然后将法线缩放 -d 以获得 Y1(即 Y 在 P 上的投影)

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

现在对 Y1 进行归一化,即将其缩放 (1 / 长度)。如果它的长度是 0 那么你就不走运了。

Y1 和 Up 的点积 = 角度的余弦。所以

angle = acos(Y1 dot Up)

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

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)

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

d = Y dot L = ly

...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)

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

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

angle = acos(Y1 dot Up)
ペ泪落弦音 2024-09-13 02:01:38
  • 两个正交向量:Up (ux, uy, uz) 和 Look (lx, ly, lz)
  • 垂直于 Look(因此包括 Up)的平面 P
  • Y1,它是 Y(垂直轴)沿 Look 的投影P

我假设 Up 和 Look 是单位向量。设 Y=(0,1,0)。
让我们找到Y1。

Y1 = Y - (Y*外观) * 外观
Y1 = Y - ly * 看
Y1 = ( -lylx, 1 - lyly, -ly*lz )

请注意,当 Look 为 (0,1,0) 或 (0, -1,0)。

就像 Detmar 所说,通过标准化 Y1 并找到 Y1*Up 的反余弦(其中 * 是点积)来找到 Y1 和 Up 之间的角度

  • two vectors that are orthogonal: Up (ux, uy, uz) and Look (lx, ly, lz)
  • a plane P which is perpendicular to Look (hence including Up)
  • Y1 which is the projection of Y (vertical axis) along Look onto P

I'll assume Up and Look are unit vectors. Let Y=(0,1,0).
Let's find Y1.

Y1 = Y - (Y*Look) * Look
Y1 = Y - ly * Look
Y1 = ( -lylx, 1 - lyly, -ly*lz )

Note that Y1 will be (0,0,0) when Look is (0,1,0) or (0,-1,0).

Like Detmar said, find the angle between Y1 and Up by normalizing Y1 and finding the arccos of Y1*Up (where * is dot product)

纵情客 2024-09-13 02:01:38

这是一个使用向量数学的相对简单的问题。使用矢量投影方程得到Y1,然后点积三角方程以获得Y1和Up之间的角度。

这个方程很容易用任何语言来实现,但如果你问这类问题,你可能打算做更多的重型向量数学,在这种情况下,我建议尝试找到第三个-党图书馆。

This is a relatively simple problem using vector math. Use the equation for vector projection to get Y1, then the trigonometric equation for the dot product to get the angle between Y1 and Up.

This equations would be pretty easy to implement yourself in just about any language, but if you're asking this sort of question you may be intending to do more heavy-duty vector math, in which case I'd suggest trying to find a third-party library.

梦里人 2024-09-13 02:01:38

您需要了解 3D 空间中的向量。我认为对这些的基本理解,尤其是点积和叉积,会让你有所了解。寻找一本基本向量教科书。

两个正交向量:Up
(ux, uy, uz) 和 Look (lx, ly, lz)

正交向量的点积为零。

垂直于平面 P
看(因此包括向上)

如果将 Look 的叉积取为 Up,您将得到第三个向量,该向量与 Up 一起定义垂直于 Look 的平面。

Y1 是 Y 的投影
(垂直轴)沿 P 方向看

我不知道你在这里得到什么,但是任何向量与 Look 的点积都会给你它在 Look 方向上的分量的大小。

You need to know about vectors in 3D space. I think that a fundamental understanding of those, especially dot and cross products, will sort you out. Seek out an elementary vectors textbook.

two vectors that are orthogonal: Up
(ux, uy, uz) and Look (lx, ly, lz)

Orthogonal vectors have a zero dot product.

a plane P which is perpendicular to
Look (hence including Up)

If you take the cross product of Look into Up, you'll get the third vector that, along with Up, defines the plane perpendicular to Look.

Y1 which is the projection of Y
(vertical axis) along Look onto P

I don't know what you're getting at here, but the dot product of any vector with Look gives you the magnitude of its component in the Look direction.

猛虎独行 2024-09-13 02:01:38

如果 Y = (0,1,0) 则

Y1 = (-lylx, 1 - lyly, -ly*lz)

|Y1| = sqrt(Y1x^2 + Y1y^2 + Y1z^2)

|上| = sqrt(Upx^2 + Upy^2 + Upz^2)

倾斜角 = (Y1xUpx + Y1yUpy + Y1zUpz)/(|Y1| |向上|)

If Y = (0,1,0) Then

Y1 = (-lylx, 1 - lyly, -ly*lz)

|Y1| = sqrt(Y1x^2 + Y1y^2 + Y1z^2)

|Up| = sqrt(Upx^2 + Upy^2 + Upz^2)

Bank Angle = (Y1xUpx + Y1yUpy + Y1zUpz)/(|Y1||Up|)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文