检测三角形 - 三角形交叉点的最有效方法是什么? [英] What's the most efficient way to detect triangle-triangle intersections?

查看:168
本文介绍了检测三角形 - 三角形交叉点的最有效方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何判断两个三角形是否在二维欧氏空间中相交? (即经典的2D几何)给定每个三角形中每个顶点的(X,Y)坐标。

How can I tell whether two triangles intersect in 2D Euclidean space? (i.e. classic 2D geometry) given the (X,Y) coordinates of each vertex in each triangle.

推荐答案

其中一种方法是检查三角形的两边是否是三角形B的任意一边相交,然后检查B内点A的所有六种可能性, B在A内。

One way is to check if two sides of triangle A intersect with any side of triangle B, and then check all six possibilities of a point of A inside B or a point of B inside A.

对于三角形内的点,请参阅:点三角形测试。

For a point inside a triangle see for example: Point in triangle test.

当我们在多边形上测试碰撞时,我们的多边形也有一个周围的矩形。因此,我们首先测试矩形碰撞,如果有撞击,我们继续进行多边形碰撞检测。

When we test collisions on polygons we also have a surrounding rectangle for our polygons. So we first test for rectangle collisions and if there is a hit we proceed with polygon collision detection.

这篇关于检测三角形 - 三角形交叉点的最有效方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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