This block experiments weighted Voronoï diagram, and is a continuation of a previous block. Weighted Voronoï diagram comes in severall flavours (additive/multiplicative, powered/not-powered, 2D/3D and highier dimensions, …), but this block focuses on the 2D additive weighted power diagram, which provides a tessellation made of concave polygons/cells with straight borders, as the default Voronoï diagram does.
Code essentially comes from mkedwards‘s block: Treemap, which is an implementation of the technique describe in Computing Voronoi Treemaps : Faster, Simpler, and Resolution-independent. I extracted the code which produces the power diagram, and updated it for D3v4:
Furthermore, as d3 v4 no longer provides polygon clipping, code for polygon clipping comes from mbostock‘s block: Polygon Clipping III, which he introduces as ‘a trivial port of Sutherland–Hodgman clipping from v3’.
For a more up-to-date version of the code, please refer to the [Weighted Voronoi Treemap in D3v4] (https://bl.ocks.org/kcnarf/15d54f4ccae6a3710cd3029546664eec) block.