x			= rand(25,1);
y			= rand(25,1);
idx		= convhull(x,y);
corners	= [x(idx), y(idx)]';

[A,b]		= bounding_polygon(corners);

xx			= rand(1000,1);
yy			= rand(1000,1);
pts		= [xx,yy]';
b_inside = all(bsxfun(@minus, A*pts, b) <= 0, 1);

figure(1);
clf;
%plot(x,y,'k.');
hold on;
plot(corners(1,:), corners(2,:), 'ro-');
plot(xx(b_inside), yy(b_inside), 'r.');
plot(xx(~b_inside), yy(~b_inside), 'k.');
