3D 线 - 平面相交?

发布于 2024-10-06 09:25:46 字数 530 浏览 7 评论 0原文

我有两个向量 (X,Y,Z),一个位于 Y=0 之上,一个位于 Y=0 之下。 我想找到两个原始向量之间的线与 Y=0 级别相交的向量 (X,Y,Z)。 我该怎么做?

示例点 A:

X = -43.54235
Y = 95.2679138
Z = -98.2120361

示例点 B:

X = -43.54235
Y = 97.23531
Z = -96.24464

这些点从用户点击的两个 UnProjections 中读取,我尝试将 unprojection 定位到 Y=0

(我发现 3D 线平面与简单平面相交,但没有'不明白接受的答案,因为它是 2D 的)

I am having two Vectors (X,Y,Z), one above Y=0 and one below Y=0.
I want to find the Vector (X,Y,Z) where the line between the two original vectors intersects with the Y=0 level.
How do I do that?

Example Point A:

X = -43.54235
Y = 95.2679138
Z = -98.2120361

Example Point B:

X = -43.54235
Y = 97.23531
Z = -96.24464

These points read from two UnProjections from a users click and I'm trying to target the unprojection to Y=0.

(I found 3D line plane intersection, with simple plane but didn't understand the accepted answer as it's for 2D)

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

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

发布评论

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

评论(2

请你别敷衍 2024-10-13 09:25:46

我怀疑两个向量实际上是指两个点,并且想要将连接这两个点的线与由 Y=0 定义的平面相交。

如果是这种情况,那么您可以使用两点之间的直线的定义:

其中 是您的一个点, 是另一个点。 u 是一个未定义的标量,用于计算沿这条线的点。

由于您要将此线与平面 Y=0 相交,因此您只需找到线上“Y”线段为 0 的点。

具体来说,求解 u code> 中的 B + (E - B)*u = 0,然后将其反馈到原始直线方程中以找到 X 和 Z 分量。

I suspect that by two vectors, you really mean two points, and want to intersect the line connecting those two points with the plane defined by Y=0.

If that's the case, then you could use the definition of a line between two points:

<A + (D - A)*u, B + (E - B)*u, C + (F - C)*u>

Where <A,B,C> is one of your points and <D,E,F> is the other point. u is an undefined scalar that is used to calculate the points along this line.

Since you're intersecting this line with the plane Y=0, you simply need to find the point on the line where the "Y" segment is 0.

Specifically, solve for u in B + (E - B)*u = 0, and then feed that back into the original line equation to find the X and Z components.

猫弦 2024-10-13 09:25:46

该线的方程为

(x–x1)/(x2–x1)  = (y–y1)/(y2–y1) = (z–z1)/(z2–z1)  

因此,使 y=0 产生交点的坐标。

x = -y1 * (x2-x1)/(y2-y1) + x1 

z = -y1 * (z2-z1) /(y2-y1) + z1 

The equation for the line is

(x–x1)/(x2–x1)  = (y–y1)/(y2–y1) = (z–z1)/(z2–z1)  

So making y=0 yields your coordinates for the intersection.

x = -y1 * (x2-x1)/(y2-y1) + x1 

and

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