<p>I'm trying to figure out the surface area of a mesh that is the result of various CSG union operations between an arbitrary number of other meshes by summing up the same property of each one of  it's faces (triangles, in this case) but the result is far greater than expected. I believe that this is happening because the mesh that results from the CSG union operations have internal faces, but I'm trying to find only the surface area of it's exterior.</p>

<p>Is there any technique to remove the inner faces of a triangulated mesh, or maybe some way to just ignore these ones while calculating it's surface area?</p>

<p>Currently I'm using <a href="https://github.com/Arakis/Net3dBool" rel="nofollow noreferrer">Net3dBool</a> to perform the CSG operations. The code that performs the intersection is on the file <a href="https://github.com/Arakis/Net3dBool/blob/master/src/Net3dBool/BooleanModeller.cs" rel="nofollow noreferrer">BooleanModeller.cs</a>, on the <code>getIntersection</code> method, wich calls the <code>composeSolid</code> method.</p>

CC BY-SA 3.0
2017-06-07T15:01:15.320Z
If your Constructive Solid Geometry method allows intersection as well as union, then you can use this to find the internal area, and subtract that from the total to give the external area. Would that make a useful answer?
trichoplax is on Codidact now
CC BY-SA 3.0
2017-06-07T15:08:42.777Z
This would depend on all the initial meshes having no internal triangles. If you can guarantee this then the method will work. For example, a hollow ball constructed from two concentric spheres would not give correct results when intersected with another sphere. However, if the construction is using only unions, then intersections can be used to subtract the area of the internal triangles.
trichoplax is on Codidact now
CC BY-SA 3.0
2017-06-07T19:50:23.823Z
I think that this could be the answer, but for example, if one of the meshes is inside the other the one that's inside should be completely ignored. Would that be the case? I tried to use intersection as stated and found the same results.
Liordino Neto
CC BY-SA 3.0
2017-06-08T09:15:06.203Z
If your intersection method returns the surface that encloses the volume enclosed by both the first mesh and the second mesh, then the intersection of the two meshes you describe will simply be the entire inner mesh, which is precisely the triangles that you wish to exclude. So it sounds like either your intersection method works differently, or there is a separate problem causing overcounting. Could you include your code so we can analyse it?
trichoplax is on Codidact now
CC BY-SA 3.0
2017-06-08T12:13:17.157Z
Sure! Currently I'm using [Net3dBool](https://github.com/Arakis/Net3dBool) to perform the CSG operations. The code that performs the intersection is on the file [BooleanModeller.cs](https://github.com/Arakis/Net3dBool/blob/master/src/Net3dBool/BooleanModeller.cs), on the **getIntersection** method, wich calls the **composeSolid** method. Thanks!
Liordino Neto
CC BY-SA 3.0
2017-06-20T13:03:33.967Z
@trichoplax I think that you're right, and the library that I'm using is computing something wrong on the CSG operations. Just for testing I tried the method powered by Carve used in Blender and it gave the results that I expected, so I'll try to use another library (maybe Carve itself) to do the operations and will answer the question acordingly if it works. Thanks!
Liordino Neto
CC BY-SA 3.0
2017-06-20T18:38:29.417Z
Thanks for the update, and a self answer if it works would be great!
trichoplax is on Codidact now
<computational-geometry>
Algorithm to remove inner faces of a triangulated mesh
Liordino Neto
# Algorithm to remove inner faces of a triangulated mesh

(Asked by: username_0 on 2017-06-06)

I'm trying to figure out the surface area of a mesh that is the result of various CSG union operations between an arbitrary number of other meshes by summing up the same property of each one of it's faces (triangles, in this case) but the result is far greater than expected. I believe that this is happening because the mesh that results from the CSG union operations have internal faces, but I'm trying to find only the surface area of it's exterior.

Is there any technique to remove the inner faces of a triangulated mesh, or maybe some way to just ignore these ones while calculating it's surface area?

Currently I'm using [Net3dBool](https://github.com/Arakis/Net3dBool) to perform the CSG operations. The code that performs the intersection is on the file [BooleanModeller.cs](https://github.com/Arakis/Net3dBool/blob/master/src/Net3dBool/BooleanModeller.cs), on the `getIntersection` method, wich calls the `composeSolid` method.

**Tags:** computational-geometry

> **Comments:**
> **username_1**: If your Constructive Solid Geometry method allows intersection as well as union, then you can use this to find the internal area, and subtract that from the total to give the external area. Would that make a useful answer?  
> **username_1**: This would depend on all the initial meshes having no internal triangles. If you can guarantee this then the method will work. For example, a hollow ball constructed from two concentric spheres would not give correct results when intersected with another sphere. However, if the construction is using only unions, then intersections can be used to subtract the area of the internal triangles.  
> **username_0**: I think that this could be the answer, but for example, if one of the meshes is inside the other the one that's inside should be completely ignored. Would that be the case? I tried to use intersection as stated and found the same results.  
> **username_1**: If your intersection method returns the surface that encloses the volume enclosed by both the first mesh and the second mesh, then the intersection of the two meshes you describe will simply be the entire inner mesh, which is precisely the triangles that you wish to exclude. So it sounds like either your intersection method works differently, or there is a separate problem causing overcounting. Could you include your code so we can analyse it?  
> **username_0**: Sure! Currently I'm using [Net3dBool](https://github.com/Arakis/Net3dBool) to perform the CSG operations. The code that performs the intersection is on the file [BooleanModeller.cs](https://github.com/Arakis/Net3dBool/blob/master/src/Net3dBool/BooleanModeller.cs), on the **getIntersection** method, wich calls the **composeSolid** method. Thanks!  
> **username_0**: @username_1 I think that you're right, and the library that I'm using is computing something wrong on the CSG operations. Just for testing I tried the method powered by Carve used in Blender and it gave the results that I expected, so I'll try to use another library (maybe Carve itself) to do the operations and will answer the question acordingly if it works. Thanks!  
> **username_1**: Thanks for the update, and a self answer if it works would be great!  

---

## 0 answers

