(function() { window.main = function() { var colorize, height, polygon, svg, width; width = 960; height = 500; svg = d3.select('body').append('svg').attr('width', width).attr('height', height); polygon = [[300, 200], [300, 300], [370, 310], [400, 300], [360, 260], [400, 180]]; colorize = d3.scale.category10(); svg.selectAll('.delaunay').data(d3.geom.delaunay(polygon)).enter().append('path').attr('class', 'delaunay').style('fill', function(d, i) { return colorize(i); }).attr('d', function(d) { return "M" + (d.join('L')) + "Z"; }); return svg.selectAll('.polygon').data([polygon]).enter().append('path').attr('class', 'polygon').attr('d', function(d) { return "M" + (d.join('L')) + "Z"; }); }; }).call(this);