Optimized Voronoi calculation.

Fixes #818.