MATLAB: Draw a circle inside a convex hull with its centre at the origin.

MATLAB

I am trying to draw a circle inside a convex hull with its centre at the origin. I have attached the code generating the points and the convex hull. In what way can i generate the incircle with its centre at the origin.
clc;
clear all;
A=[0 0;0 -5; 5 -5; 5 5;0 5;-2 2;-5 -5;5 8;-5 -8;-8 0;8 0]
x_axis=A(:,1)
y_axis=A(:,2)
k=convhull(x_axis,y_axis);
figure;
plot(x_axis(k),y_axis(k),'r-',x_axis,y_axis,'b*');

Best Answer

Use vert2lcon (Download) to find the inequality constraint matrices representing the polygon
[Aineq,bineq]=vert2lcon(A);
The bineq are actually distances of each of the sides of the polygon from the origin, so the radius of the largest inscribed circle should be
maxRadius = min(bineq);