简体   繁体   English

2D段与矩形的交点

[英]Intersection of a 2D segment with a rectangle

I using C# and XNA. 我使用C#和XNA。 I need an algorithm in any language to obtain the border intersection point(s) of a rectangle with a 2d segment. 我需要一种任何语言的算法来获得具有2d段的矩形的边界交叉点。

I've been looking for an answer for my question for over 3 hours already and couldn't find a solution that works. 我一直在寻找我的问题的答案超过3个小时,并找不到有效的解决方案。

Can anyone help me please? 有人可以帮我吗?

Thanks a lot. 非常感谢。

You can find an example for a line segment intersection with an aabb box here . 您可以在此处找到与aabb框相交的线段交叉的示例。

Or the same question as your question here 还是同样的问题,你的问题在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM