Hello,

What is the math behind the volume computation performed in VTKMassProperties? Also what does Volume - X, Y and Z mean?

(I could see a research paper being cited, but can someone explain in a layman terms?)

Thanks

Hello,

What is the math behind the volume computation performed in VTKMassProperties? Also what does Volume - X, Y and Z mean?

(I could see a research paper being cited, but can someone explain in a layman terms?)

Thanks

I think it computes the surface integral of the Z position vector over all the triangles that make up the surface. What I mean by Z position vector is the Z component of the (X,Y,Z) position vector, multiplied by the unit vector in the Z direction. Okay, that’s not the best explanation… you know how a position vector (or any vector) can be expressed as the sum of vectors in the X, Y, and Z directions? So the Z position vector is just the Z part.

So for every point on the surface, you take the dot product of the Z position vector at that point with the surface normal, and integrate that over the entire surface. Except this isn’t done point-by-point, but rather triangle-by-triangle. That’s the basic gist I get when I read the code. ~~The choice of Z rather than X or Y seems to be arbitrary.~~

Edit: I guess I should add an explanation of why this works. Imagine a simple surface, like a sphere. Image a line along the Z direction that passes through the sphere, it will intersect the surface twice. There will be a certain distance between the “entry” point and the “exit” point. Now imagine a line along Z for every possible (X,Y) position, a whole bunch of parallel lines in a dense grid. You can see how the sum of all the entry-to-exit distances for all these lines will give you the volume of the sphere. Well, you can measure the “entry” Z position and “exit” Z position separately, in fact the only difference is the direction of the surface normal with respect to the Z direction. And this works for any shape of surface.

Just some small correction/additions to my previous reply.

The method that I described above is applied not only in the Z but also in the X and Y directions. Hence the VolumeX, VolumeY, and VolumeZ returned by the class.

The Volume that is returned is a weighted average of VolumeX, VolumeY, and VolumeZ. Referring to my entry/exit point discussion above, if the line is nearly perpendicular to surface it’s possible to make a better measurement than if the line is nearly tangential to the surface. So the algorithm uses weighting factors according to how often a particular direction gives the “best” result while iterating over the triangles.