Add volume and area calculations
Add volume, and area calculations to IndexedMesh. Volume calculations are based on https://doi.org/10.1109/ICIP.2001.958278. Added tests to make sure the calculations were valid. For valid volume calculations the input mesh cannot contain any holes. For this reason I've added another bunny model to the testdata folder.
any thoughts @hmeyer? I will gladly change anything if it is not up to your standards.
Sorry - this fell off my radar. I'm not sure those metrics belong in this crate, as I intended it to be purely for Io of STL files. Thoughts?
Casper Lamboo @.***> schrieb am Di., 18. Mai 2021, 23:15:
any thoughts @hmeyer https://github.com/hmeyer? I will gladly change anything if it is not up to your standards.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hmeyer/stl_io/pull/12#issuecomment-843568536, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAE7LAORZ3CSLGQMINKSO3TOLKHVANCNFSM44VHIVBQ .
I would argue that volume is actually pretty inherent to stl files. Or at least as inherent to stl files as the validate function; valid stl models cannot have negative volume.
Example, a popular tool for fixing meshes (admesh) shows the volume pretty prominently when analysing an stl file.
================= Results produced by ADMesh version 0.98 =================
Input file : sphere.stl
File type : Binary STL file
Header : Processed by ADMesh version 0.98
============== Size ==============
Min X = -1.334557, Max X = 1.370952
Min Y = -1.377953, Max Y = 1.377230
Min Z = -1.373225, Max Z = 1.242838
========= Facet Status ========== Original ============ Final ====
Number of facets : 3656 3656
Facets with 1 disconnected edge : 18 0
Facets with 2 disconnected edges : 3 0
Facets with 3 disconnected edges : 0 0
Total disconnected facets : 21 0
=== Processing Statistics === ===== Other Statistics =====
Number of parts : 1 Volume : 10.889216
Degenerate facets : 0
Edges fixed : 24
Facets removed : 0
Facets added : 0
Facets reversed : 0
Backwards edges : 0
Normals fixed : 0
Ofcourse io is not the same as "fixing" but I would argue that volume calculations are as foreign to io as they are to mesh-fixing.
In my opinion such elementary operations do fit in nicely in an io library such as this. Tut as the creator/maintainer you have final say ofcourse!
Given you already invested this much, and the code is quite compact for now, I think it is fine to add. But we should draw a line somewhere close, to what are the limits of this library.