Здесь блок схема схема!!!!!!!!
http://alglib.sources.ru/convex/convexshell.php
Третий день парюсь а до конца въехать не могу!!!!!!!!!!! Может есть какая-то альтернатива?????????
Код
begin
i:=1;
min:=x[0];
max:=x[0];
m1:=0;
m3:=0;
repeat
if x[i]<min
then
begin
min:=x[i];
m1:=i;
end
else
begin
if x[i]>max
then
begin
max:=x[i];
m3:=i;
end;
end;
i:=i+1;
until not(i<=n);
R :=-MaxReal;
i:=0;
repeat
if x[i]<>x[m1]
then
begin
t:=(y[i]-y[m1])/(x[i]-x[m1]);
if t>r
then
begin
m2:=i;
r:=t;
end;
end;
i:=i+1
until not(i<=n);
x[n+1]:=x[m1]+x[m2]-x[m3];
y[n+1]:=y[m1]+y[m2]-y[m3];
nt:=-1;
Top:=1;
Stack[1,Top]:=m1;
Stack[2,Top]:=m2;
Stack[3,Top]:=n+1;
while Top<>0 do
begin
p1:=Stack[1,Top];
p2:=Stack[2,Top];
p3:=Stack[3,Top];
Top:=Top-1;
m:=-1;
r1:=MaxReal;
i:=0;
repeat
c:=not(IOS(x[p3],y[p3],x[i],y[i],x[p1],y[p1],x[p2],y[p2]));
if (i<>p1)and(i<>p2)
and C
then
begin
roi1:=Sqrt(Sqr(x[i]-x[p1])+Sqr(y[i]-y[p1]));
roi2:=Sqrt(Sqr(x[i]-x[p2])+Sqr(y[i]-y[p2]));
r:=((x[p1]-x[i])*(x[p2]-x[i])+(y[p1]-y[i])*(y[p2]-y[i]))/roi1/roi2;
if r<r1
then
begin
r1:=r;
m:=i;
end;
end;
i:=i+1
until not(i<=n);
if (M>=0)and(p3<>M)
then
begin
i:=0;
et:=False;
while (i<=nt) and not(et) do
begin
ET:=((p1=tr[1,i])and(p2=tr[2,i])and(m=tr[3,i]))
or((p1=tr[1,i])and(p2=tr[3,i])and(m=tr[2,i]))
or((p1=tr[2,i])and(p2=tr[1,i])and(m=tr[3,i]))
or((p1=tr[2,i])and(p2=tr[3,i])and(m=tr[1,i]))
or((p1=tr[3,i])and(p2=tr[1,i])and(m=tr[2,i]))
or((p1=tr[3,i])and(p2=tr[2,i])and(m=tr[1,i]));
i:=i+1;
end;
if not(et)
then
begin
nt:=nt+1;
tr[1,nt]:=p1;
tr[2,nt]:=p2;
tr[3,nt]:=m;
Top:=Top+1;
Stack[1,Top]:=p1;
Stack[2,Top]:=m;
Stack[3,Top]:=p2;
Top:=Top+1;
Stack[1,Top]:=p2;
Stack[2,Top]:=m;
Stack[3,Top]:=p1;
end;
end;
end;
end;