  Voronoi grids have been successfully used to represent density structures of
gas in astronomical hydrodynamics simulations. While some codes are explicitly
built around using a Voronoi grid, others, such as Smoothed Particle
Hydrodynamics (SPH), use particle-based representations and can benefit from
constructing a Voronoi grid for post-processing their output. So far,
calculating the density of each Voronoi cell from SPH data has been done
numerically, which is both slow and potentially inaccurate. This paper proposes
an alternative analytic method, which is fast and accurate. We derive an
expression for the integral of a cubic spline kernel over the volume of a
Voronoi cell and link it to the density of the cell. Mass conservation is
ensured rigorously by the procedure. The method can be applied more broadly to
integrate a spherically symmetric polynomial function over the volume of a
random polyhedron.
