3D 线 - 平面相交?
我有两个向量 (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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑两个向量实际上是指两个点,并且想要将连接这两个点的线与由
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
inB + (E - B)*u = 0
, and then feed that back into the original line equation to find the X and Z components.该线的方程为
因此,使 y=0 产生交点的坐标。
和
The equation for the line is
So making y=0 yields your coordinates for the intersection.
and