RANDOMPOINTINBOX Generate random point within a box.
PTS = randomPointInBox(BOX)
Generate a random point within the box BOX. The result is a 1-by-2 row
vector.
PTS = randomPointInBox(BOX, N)
Generates N points within the box. The result is a N-by-2 array.
BOX has the format:
BOX = [xmin xmax ymin ymax].
Example
% draw points within a box
box = [10 80 20 60];
pts = randomPointInBox(box, 500);
figure(1); clf; hold on;
drawBox(box);
drawPoint(pts, '.');
axis('equal');
axis([0 100 0 100]);
See also
geom2d, points2d, boxes2d, randomPointInBox3d, randomPointInPolygon
Package: matgeom