Mesh information

Using the helpful tips from Triangular mesh of random points on a sphere, it's easy to generate solids:

reg = DiscretizeGraphics[Sphere[{0, 0, 0}, 5], 
  MaxCellMeasure -> {"Length" -> 15}]


The interrogation tab provides useful information, but it would be helpful if the data could be captured in a text format.


How can the information in the information tab (shown below) be harvested with a script?

Screen capture

enter image description here


1 Answer 1


I don't think there's anything particularly special in the mesh info tab. All of it can be found with various functions which I've encapsulated below:

meshinfo[mesh_] := {{"Embedding Dimension", RegionEmbeddingDimension[#]},
    {"Geometric Dimension", RegionDimension[#]},
    {"Vertex Cells" , MeshPrimitives[#, 0] // Length},
    {"Edge Cells" , MeshPrimitives[#, 1] // Length},
    {"Face Cells" , MeshPrimitives[#, 2] // Length},
    {"Volume Cells" , MeshPrimitives[#, 3] // Length},
    {"Area", Area[#]},
    {"Region Bounds", RegionBounds[#]},
    {"Region Centroid", RegionCentroid[#]}} &@mesh

meshinfo[reg] // Grid

Association[Rule @@@ meshinfo[reg]]
  • 1
    $\begingroup$ (Here) MeshPrimitives[#, 0] // Length == VertexCount[MeshConnectivityGraph[reg]], MeshPrimitives[#, 1] // Length == EdgeCount[MeshConnectivityGraph[reg]], and MeshPrimitives[#, 2] // Length == Length@FindCycle[MeshConnectivityGraph[reg], {3}, All] $\endgroup$ Jun 26, 2020 at 20:21
  • 3
    $\begingroup$ You can use MeshCellCount instead of listing out and counting all primitives. $\endgroup$
    – Greg Hurst
    Jun 27, 2020 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.