How might I measure the total area of a mesh during displacement?

I’m displacing/warping/stretching a cloth component with a sphere collider, and in doing so I’m stretching the distance between vertices.

Is there a way I can measure the total area (or sum of the line lengths) of the mesh at each timestep, which would be correspondent to the amount of stretching?

I’m sure it involves some math on Mesh.vertices. Would it be too expensive to add up all the distances between every set of adjacent vertices?

Hello,

I had a look on google and found these answers on StackOverflow. You might need to retrofit them for Unity but they should give you what you want.

To calculate the area:
https://stackoverflow.com/questions/26312570/calculate-surface-area-of-a-3d-mesh

To calculate the volume:
https://stackoverflow.com/questions/1406029/how-to-calculate-the-volume-of-a-3d-mesh-object-the-surface-of-which-is-made-up

As for performance, that depends on the number of vertices but I can’t imagine it being super expensive.