The medial surface of a volumetric object is of significant interest for shape analysis. However, its numerical computation can be subtle. Methods based on Voronoi techniques preserve the object's topology, but heuristic pruning measures are introduced to remove unwanted faces. Approaches based on Euclidean distance functions can localize medial surface points accurately, but often at the cost of altering the object's topology. In this paper we introduce a new algorithm for computing medial surfaces which addresses these concerns. The method is robust and accurate, has low computational complexity, and preserves topology. The key idea is to measure the net outward flux of a vector field per unit volume, and to detect locations where a conservation of energy principle is violated. This is done in conjunction with a thinning process applied in a cubic lattice. We illustrate the approach with examples of medial surfaces of synthetic objects and complex anatomical structures obta...