function [A,b] = bounding_polygon(corners)
	% [A,b] = bounding_polygon(corners)
	% determine the coefficients of an inequality Ay <= b such that
	%
	% if Ay <= b
	%	if polygon is convex:
	%		y is inside polygon
	%  else
	%		y is inside the convex hull of the polygon
	% else
	%	y is outside polygon
	%
	
	%% get convex hull
	idx		= convhull(corners(1,:)', corners(2,:)');
	corners	= corners(:,idx);
	
	%% get coefficients
	n_vert	= size(corners,2)-1;
	A			= zeros(n_vert,2);
	b			= zeros(n_vert,1);
	
	for v = 1 : n_vert
		% get normal of edge from y0 -> y1
		y0		= corners(:, v);
		y1		= corners(:, v+1);
		y01	= y1 - y0;
		n		= [y01(2); -y01(1)];
		% we are inside if (y - y0).n <= 0
		% i.e. n.y <= n.y0
		A(v,:)= n';
		b(v)	= dot(n, y0);
	end
end