Largest incircle inside a quadrilateral radius calculation

1.8k Views Asked by At

How can I calculate the radius of the biggest possible inscribed circle that is inside any quadrilateral? Every quadrilateral can have an incircle that is adjacent to at least 3 sides right? I want to know the radius with respect to the 4 sides of the quadrilateral.

P.S. Not in a trapezoid, not in a tangential quadrilateral.

P.S.2 We know the coordinates of the vertices, the angles also.

2

There are 2 best solutions below

3
On

We know that one of the largest circles to fit into a quadrilateral always touches at least three sides, otherwise you could easily scale it up or translate it until it does.

Let $a, b, c, d$ denote the four sides of the quadrilateral. Construct the four incircles (or excircles if appropriate) of the triangles $abc, abd, acd, bcd$, and remove all those who intersect the fourth side. The largest remaining circle is the largest circle that can possibly fit into the quadrilateral. Calculate its radius as you would calculate the radius of the incircle of a triangle.

1
On

The so-called "skeleton" (a concept of mathematical morphology ; see (https://en.wikipedia.org/wiki/Straight_skeleton)) provides a direct understanding of the cases that can occur.

Let us recall what is generally understood under the name of "skeleton": it is the locus of points $M$ that are centers of maximal circles $C(M,R)$ that cannot have a larger radius, i.e., $C(M,R+\varepsilon)$ for $\varepsilon>0$ is no longer included in the quadrilateral or any shape under study.

Let us recall the "roof model" (explained in the reference I gave above). Imagine you have a four-walls house with this quadrilateral shape. You are the roofmaker in charge of the construction of the roof for this house with sides having 45 degrees slopes. Then the ridges of the roof seen from above will be the skeleton. The center of the largest circle will be one of the endpoints of the summital ridge, here $EF$ (see figure).

Why that ? Because the 45 degrees slopes are there in order that the distances to the border are found back as the height of the different points (in mathematical morphology, we would say that we have considered a "distance function"). Coordinate $z$ of $F$, the highest point of the roof, is exactly the common (maximal) distance to the quadrilateral.

Remark: this summital ridge is not horizontal in general.

In a more mathematical setting, the "summital ridge" could be obtained through the equations $$z=f_k(x,y)=a_kx+b_ky+c_k \ \ (k=1\cdots 4)$$ of the corresponding 45-degrees-slope planes directed towards the interior of the quadrilateral, the "equation of the roof" being $$\tag{1}z=f(x,y)=min(f_1,f_2,f_3,f_4).$$

In fact, it is simpler than that. It suffices to work in 2D. For example, the "summital ridge" is projected onto the bissecting line either of the pair of lines $AB$ and $CD$, or of the pair of lines $BC$ and $DA$.

In order to decide which one is part of the skeleton, it suffices to consider the following points of intersection of angle bissectors $E = biss(DC,DA) \cap biss(AD,AB)$ and $F=biss(DC,DA) \cap biss(AD,AB)$. Two cases can occur:

  • If the direction of $\vec{EF}$ has a same general direction of $\vec{AB}$ and $\vec{DC}$ (as is the case in figure below) either $E$ or $F$ is the desired point (center of the largest circle). Remark: by "same general direction" for 2 vectors, we mean a positive dot product.

  • Otherwise, let $G = biss(DC,DA) \cap biss(CD,CB)$ and $H=biss(BC,BA) \cap biss(AD,AB)$. In this case, either $G$ or $H$ is the center of the largest circle.

Here is a Matlab program that implements this method:

function maxcirc;

clear all;close all;hold on;axis equal

%x=[1,5,4,2];
y=[0,1,3,2];% vertices coord., direct orientation compulsory
x=10*[0,1,1,0]+6*rand(1,4);
y=10*[0,0,1,1]+6*rand(1,4);%test

xn=[x(4),x];
yn=[y(4),y];

plot(xn,yn);

X1=diff(xn);
X1=[X1,X1(1)];

Y1=diff(yn);
Y1=[Y1,Y1(1)];

for k=1:5;

   N(k)=norm([X1(k),Y1(k)]);

end;

X=X1./N;
Y=Y1./N;

%quiver(xn,yn,X,Y,0)

for k=1:4;

    Xb(k)=X(k+1)-X(k);

    Yb(k)=Y(k+1)-Y(k);
    Nb(k)=norm([Xb(k),Yb(k)]);
end;

Xb=Xb./Nb;
Yb=Yb./Nb;

%quiver(x,y,Xb,Yb,0)

[x14,y14,s14,t14]=inbiss(1,4,x,y,Xb,Yb);

[x23,y23,s23,t23]=inbiss(2,3,x,y,Xb,Yb);

dp=(x23-x14)*(x(2)-x(1))+(y23-y14)*(y(2)-y(1));%dot product

if dp>0

  r1=rad(N(5),s14,t14);
  circ(x14,y14,r1);

  r2=rad(N(3),s23,t23);
  circ(x23,y23,r2);

else

  [x12,y12,s12,t12]=inbiss(1,2,x,y,Xb,Yb);

  [x34,y34,s34,t34]=inbiss(3,4,x,y,Xb,Yb);

  r3=rad(N(2),s12,t12);
  circ(x12,y12,r3);

  r4=rad(N(4),s34,t34);
  circ(x34,y34,r4);

end;

function [xi,yi,s,t]=inbiss(p,q,x,y,Xb,Yb);% inters. of angle biss.

M=[Xb(p),Xb(q);
Yb(p),Yb(q)];

V=M\[x(q)-x(p);
y(q)-y(p)];

s=V(1);
t=-V(2);

xi=x(p)+s * Xb(p);
yi=y(p)+s * Yb(p);

function r=rad(a,b,c);% radius

p=(a+b+c)/2;
are=sqrt(p * (p-a) * (p-b) * (p-c));%Heron formula

r=2*are/a;

function circ(x,y,r);

tt=0:0.01:2*pi;

plot(x+r*cos(tt),y+r*sin(tt));

plot(x,y,'ok');

enter image description here

Figure 1: the "skeleton" of the quadrilateral (bold lines). $F$ will be in this case the center of the largest circle.