Implement koch curve generation in d3.js