I suspect this simple question may be difficult to answer, but how do I calculate the volume of a closed 3-d shape? Obviously simple geometric primitives like cubes, rectangles, spheres, cones etc. all have known formulae.

Even shapes bounded by known equations describing planes can have volumes found via 3d integration methods.

But what if I need the volume of a more complex mesh/object representing a simple house for example?

My only thought is that 2d areas can be calculated by iterative methods - literally filling a space with tiny units and counting them - something like how the fill or paint bucket tools work in drawing programmes. Perhaps this could be extended to a 3d solution?

Any comments most appreciated.