如何计算重叠的多重网格的总面积 [英] How to calculate overall area of multipy meshes that overlap itself

查看:104
本文介绍了如何计算重叠的多重网格的总面积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Unity中很少有有时重叠/相交的网格.

I have few meshes in Unity that are sometimes overlap / intersect.

这些网格是平坦的(z = 0).可能是如下图所示的3种情况.每次我要计算总面积(图片上标记为黑色)

These meshes are flat (z=0). It can be 3 situation like on picture below. Each time I want to calculate overall area (marked black color on the picture)

我认为可以仅根据合并网格的外点计算面积来完成?任何人都可以提供任何想法示例的例子吗?

I think that it can be done based on calculate area taking only outer points of combined mesh? Does anyone can provide any example on idea how to do it?

推荐答案

我可以为您介绍Weiler-Atherton裁剪算法这里

I can point you to Weiler-Atherton clipping algorithm here and a C++ implementation here

另一种替代方法(但我认为更耗时)将是以下方法:

Another alternative (but more time consuming I think) method would be the following:

  1. 对多边形(较硬的部分)进行三角剖分,并用原始多边形的标签进行标记
  2. 计算所有三角形之间的交点列表(因为您只需将2个三角形相交就更容易了)
  3. 计算与不同标签相交的三角形的面积=>所需的输出

这篇关于如何计算重叠的多重网格的总面积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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