3D线 - 平面相交? [英] 3D Line - Plane intersection?

查看:142
本文介绍了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中读取,我试图将未投影到 Y = 0



(我发现 3D线平面相交,简单的平面,但不理解接受的答案,因为它是2D)

解决方案

我猜想通过两个向量,你真的意味着两个点,并且想要将连接这两个点的线与由 Y = 0



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



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

其中< A,B,C> 是您的要点之一,< D ,E,F> 是另一点。 u 是一个未定义的标量,用于计算沿此线的点。



由于您正在相交与平面 Y = 0 一致,你只需要找到Y段为0的那一行上的点。



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


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)

解决方案

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.

这篇关于3D线 - 平面相交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆