# Calculating the volume of a vessel¶

As we have seen, the simplest method for calculating the volume of a solid of revolution is by dividing the rotating shape into smaller pieces.

This method has however one major flaw that limits its adoption for archaeological purposes, namely it cannot be used to calculate the capacity of a vessel that has a convex interior surface.

For this reason, Kotyle uses a more advanced technique, based on Pappus’s centroid theorem.

## Pappus’s centroid theorem¶

In mathematics, Pappus’s centroid theorem is either of two related theorems dealing with the surface areas and volumes of surfaces and solids of revolution.

The second theorem states that the volume V of a solid of revolution generated by rotating a plane figure F about an external axis is equal to the product of the area A of F and the distance d traveled by its geometric centroid.

$V = A d$

For more details, see Wikipedia (which is also the source for the two paragraphs above).

## Implementing Pappus’s centroid theorem¶

According to the above definition, the required data to compute the volume are:

• the area of the plane figure
• the distance of its centroid from the rotation axis

Both geometric operations are not trivial for non-standard polygons, so we use the Shapely Python library to perform them. Shapely can be easily integrated with Matplotlib to plot both the profile and the geometric centroid.

## Making sense of different standards¶

To add more fun, profile drawings can be both right-handed or left-handed. We could force people to mirror their images before feeding them into Kotyle, but why would you do that ? Computers should be working for us, not the opposite !

It’s quite easy to manage this disparity, even taking into account that people might start drawing from the rim (top) or from the bottom of the vessel.

 x0 > xN x0 < xN y0 > yN ↙ ↘ y0 < yN ↖ ↗

x0 is the ascissa of the first point in the sequence, and xN the ascissa of the last point. Same for y0 and yN. Arrows indicate in which direction the profile was drawn. “Same sign” combinations give the same result.

The standardized view is with the 0,0 point at the bottom of the profile, where it crosses the rotation axis. But it’s easy to reverse() those profiles that follow the opposite standard, mirroring them.