计算两条线投影相交点处的哪条线在前面

发布于 2024-08-26 02:14:03 字数 99 浏览 7 评论 0原文

3d 中的两条线投影到 2d 屏幕上,它们的投影相交于可以计算的点。

如果 3d 空间中线的端点已知并且它们在投影平面中的交点也已知,那么如何确定该交点处哪条线在前面?

Two lines in 3d are projected onto 2d screen, and their projections intersect at a point which can be calculated.

If the endpoints of the lines in 3d space are known and their intersection point in the projection plane is also known, how can I determine which line is in front at this intersection point?

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

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

发布评论

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

评论(1

何以心动 2024-09-02 02:14:03

作为一个简单的解决方案,您可以将交点作为一段(从 zNear 到 zFar)取消投影到 3D 空间中,并将这条线与两条测试线相交,采用更近的交点。

编辑:更深入一点,您知道光线在形成光线时会与两条线相交,因此您可以用四个点形成一个平面(两个点用于投影线段,两个点来自测试线段的端点)现在您可以使用标准参数线方程以二维方式完成相交测试。

此站点有直线相交的示例。

As a naive solution, you can unproject the intersection point into 3D space as a segment(from zNear to zFar) and intersect this line with both of your test lines, taking the closer intersection.

edit: A bit more in-depth, you know your ray will intersect both lines when you form it so you can form a plane with the four points (two points for the projected segment and two points from the endpoints of your test line segment) and now your intersection test can be done in 2D using the standard parametric line equation.

This site has samples for line-line intersection.

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