How to calculate overall area of multipy meshes that overlap itself

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

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?

Answers


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. Triangulate your polygons (harder part) and mark them with the label of the original polygon
  2. Compute the list of intersection between all triangles (much easier since you just have to intersect 2 triangles)
  3. Compute the area of triangles intersected with different labels => the needed output

Need Your Help

How to optimize gradle build performance regarding build duration and RAM usage?

performance build heap gradle

I am currently switching from ant to gradle for my multi module web application and at the moment it seems that the current version of Gradle (M9) might be running up against its limits. But maybe (

DriverUnload not called on Windows restart/shutdown

windows driver windows-xp-embedded windows-embedded

I'm debugging a driver with WinDbg. In the DriverUnload function, there's a call to KdBreakPoint().