Overview/Examples/1. Inspecting a mesh before you touch it
worked example 1 of 6
Inspecting a mesh before you touch it
Running Stats::of once turns three guesses into three printed facts: how big the mesh is, whether it is closed and manifold, and how many separate pieces it holds.
Example 1 of six - the program sits on the examples page, and this page takes it from the running end: the console it produces, the Status values that end it early, and the options worth changing.
What it prints
47218 verts 94216 tris 3 components
closed=0 manifold=1 oriented=0 loops=5
warning: 0 non-manifold edges
An open scan prints closed=0, so the genus and volume lines are skipped - exactly the two values that would otherwise be nonsense.
When it goes wrong
- The path is wrong
readreturnsStatus::FileNotFound; the program prints the message and exits 2 beforeStatsruns.- The file is an unsupported PLY variant
Status::UnsupportedFormat- for example a PLY carrying double coordinates, which is rejected rather than narrowed (RF-74).- The mesh loaded but is empty
verticesandtrianglesread 0; nothing crashes, and every boolean comes back as if for a degenerate shape.
Variations
- Only the counts
- Skip the closed/manifold block;
Stats::ofstill does one pass, so there is no saving in asking for less. - Feed a view you already hold
Stats::oftakes aMeshView, so a mesh living in someone else's buffer needs no copy.