A general numerical algorithm is proposed for the fast computation of the common volume function (CVF) of any polyhedral object, from which the diffraction pattern of a corresponding powder can be obtained. The theoretical description of the algorithm is supported by examples ranging from simple equilibrium shapes in cubic materials (Wulff polyhedra) to more exotic non-convex shapes, such as tripods or hollow cubes. Excellent agreement is shown between patterns simulated using the CVF and the corresponding ones calculated from the atomic positionsviathe Debye scattering equation.