mardi 30 août 2016

random points inside a custom shape

Given the shape points:

var s_points = [ [ 50, 50 ], [100,50], [100, 75], [150, 75], [150, 125], [ 100, 125 ], [ 100, 100 ], [50, 100] ];

enter image description here

what's the easiest way to generate points inside the shape?

Should I just create a temporary bounding-box and generate points within the box and then see if the point is intersecting any s_points ( as in point-in-polygon alg.) ? Or is there simplest way to do it?




Aucun commentaire:

Enregistrer un commentaire