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?


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:

To calculate the volume:

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