C++ Port of Mike Bostock Javascript