# Is there a way to SurfaceArea of each face of 3D shape separately?

Consider the following 3D shape as an example:

ClearAll[cylinder];
cylinder[r_,z_]:=Cylinder[{{r,r,0},{r,r,z}},r];


It is a cylinder whose entire SurfaceArea, I can calculate as follows:

Expand@Simplify[SurfaceArea[cylinder[r,z]],Assumptions->z>0]


2 π r^2 + 2 π r z

But I want something like as follows:

<|1 -> π r^2, 2 -> 2 π r z, 3 -> π r^2|>

So if I want the total I can do the following:

Total[%]


I think maybe converting this shape to a Region and then applying some built-in function to get the faces of a 3D Region as separate 2D Regions would be helpful. Then maybe I can map Area on the 2D Regions to find what I need?

• So in your treatment, a cone will have two faces, and a sphere only one? Feb 3 at 0:49
• @J.M. yes but remember it should be possible to work with composite shapes. That is the entire goal here. Feb 3 at 1:42

ClearAll[cylinder];
cylinder[r_, z_] := Cylinder[{{r, r, 0}, {r, r, z}}, r];
Needs["OpenCascadeLink"]
#["Wireframe"] & /@ bms


Area[MeshRegion[#]] & /@ bms
{12.546193962183768, 3.121445152258052, 3.121445152258052}


Update: To refine the mesh, have a look in the documentation on the different methods to specify that. One option is to set the "LinearDeflection".

OpenCascadeShapeSurfaceMeshToBoundaryMesh[#,
"ShapeSurfaceMeshOptions" -> {"LinearDeflection" -> 0.001}] &

• This is very interesting. What is OpenCascade? Is it a separate program? Is it included with Mathematica installation? Do I need to install anything extra to make your code work? I don't have access to Mathematica right now and will test it when I am home. Feb 3 at 16:27
• @user13892 Everything is onboard. Feb 3 at 20:36
• Is there a way/option to get a denser mesh for the faces? The answers for their Area are not very accurate. Feb 4 at 6:53
• @user13892, see update and documentation. Feb 4 at 7:25