1.0.3 • Published 4 years ago

nado.voronoi v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

nado.voronoi

Caution this version have performance issue of many data case nado.voronoi produces a weighted Voronoi diagram. It tessellates/partitions the polygon with given value array.

API

#find_weighted_voronoi(polygon,data) polygon is divided by data array. each returned polygon's area size is related proportion of data.

const voronoi = require('nado.voronoi');
var area = [[-3,5],[4,-2],[10,4],[3,11]];
var data = [25,10,40,5,10,10];
var polygons = voronoi.find_weighted_voronoi(area, data);

returned polygons

[ [[1.21,9.21],[-2.16,5.84],[0.46,3.03],[4.04,5.66],[3.93,7.06]]
,[[3.93,7.06],[5.47,8.53],[3.00,11.00],[1.21,9.21]]
,[[0.06,1.94],[4.00,-2.00],[7.86,1.86],[6.34,4.83],[4.04,5.66],[0.46,3.03]]
,[[-2.16,5.84],[-3.00,5.00],[0.06,1.94],[0.46,3.03]]
,[[6.34,4.83],[7.86,1.86],[10.00,4.00],[7.74,6.26]]
,[[6.34,4.83],[7.74,6.26],[5.47,8.53],[3.93,7.06],[4.04,5.66]] ]