计算两个三角形的相交面积 [英] calculate intersection area of two triangle

查看:111
本文介绍了计算两个三角形的相交面积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试找到一种算法,该算法可以计算两个三角形的相交面积,但是我找不到任何三角形.任何人都可以提供线索来编写该算法吗?

I have been trying to find an algorithm which computes the intersecting area of two triangles but I failed to find any. Can anybody give a clue how to write this algorithm?

我想要类似的东西

  double getAreaOfIntersection(Vector2 p1,Vector2 p2, Vector2 p3,Vector2 p4,Vector2 p5,Vector2 p6 )

其中pX代表2个三角形.

where pX represents the 2 triangles.

推荐答案

您可以首先通过裁剪算法来计算描述相交区域的多边形,例如:

You could first compute the polygon which describes the intersection area by a clipping algorithm, e.g.:

Sutherland-Hodgman算法

然后,您将计算所得凸多边形的面积,这非常简单,例如,请参见此处:

Then you would compute the area of the resulting convex polygon, which is rather easy, see, e.g., here:

凸多边形的面积

这篇关于计算两个三角形的相交面积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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