Skip to content
jasondavies edited this page Mar 24, 2013 · 6 revisions

WikiAPI ReferenceGeometryVoronoi Geom

This implementation does not clip the returned polygons, so if you want to clip them to a particular shape you will need to do that either in SVG or by post-processing with polygon.clip, as in this example. If any vertices are coincident or have NaN positions, the behavior of this method is undefined: most likely, invalid polygons will be returned! You should filter invalid vertices, and consolidate coincident vertices, before computing the tessellation.

# d3.geom.voronoi([vertices])

Returns an array of polygons, one for each input vertex.

# d3.geom.delaunay([vertices])

Returns an array of triangles.

# voronoi.x([x])

If x is specified, sets the x-coordinate accessor. If x is not specified, returns the current x-coordinate accessor, which defaults to:

function(d) { return d[0]; }

# voronoi.y([y])

If y is specified, sets the y-coordinate accessor. If y is not specified, returns the current y-coordinate accessor, which defaults to:

function(d) { return d[0]; }
Clone this wiki locally