DAIRLab / dair_pll

DAIRLab Physics-based Learning Library
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Fix mesh export inconsistency #21

Closed ebianchi closed 8 months ago

ebianchi commented 8 months ago

Failure Case

Previously, it was possible (albeit unlikely) to generate an inconsistent MeshSummary from a learned deep support convex network. In the extract_mesh function, a mesh is generated by querying a multitude of directions and obtaining their corresponding support points. If any of the returned support points were redundant with one another, the resulting MeshSummary.vertices attribute would contain all of these redundant vertices (in support_points), but its faces attribute would reference indices of a different list of non-redundant vertices (in vertices).

Solution

The simple fix is to store the list of non-redundant vertices in the MeshSummary.vertices attribute instead of the original list of possibly redundant vertices.

Discovery

While it is extremely unlikely to obtain the exact same output from a neural network given different inputs (which is what extract_mesh does), we caught this code error when using the same MeshSummary generation logic with data in which identical inputs were likely to be present.