Нужно описать программу по коду.
Мне нужно описать данную программу.
procedure readNum(var x : double; const s : string);
begin
writeln('vvedite ', s);
readln(x);
end;
function distance(const x1 : double; const y1 : double; const x2 : double; const y2 : double) : double;
begin
distance := sqrt(sqr(x1 - x2) + sqr(y1 - y2));
end;
function CommonPoints(const x1 : double; const y1 : double; const x2 : double; const y2 : double; const r : double) : byte;
var
p : double;
begin
p := abs((y1 * x2) - (x1 * y2)) / sqrt(sqr(y2 - y1) + sqr(x2 - x1));
if (p < r) then
begin
if (sqr(x1) + sqr(y1) < r) or (sqr(x2) + sqr(y2) < r) then
begin
CommonPoints := 1;
exit;
end;
CommonPoints := 2;
exit;
end
else if (p = r) then
begin
CommonPoints := 1;
exit;
end;
CommonPoints := 0;
end;
function S(const x1, y1, x2, y2, x3, y3 : double) : double;
var
a, b, c, p : double;
begin
a := distance(x1, y1, x2, y2);
b := distance(x1, y1, x3, y3);
c := distance(x3, y3, x2, y2);
p := (a + b + c) / 2;
S := sqrt(p * (p - a) * (p - b) * (p - c));
end;
function IsPointInQuadro(const x1, y1, x2, y2, x3, y3, x4, y4 : double) : boolean;
var
side : double;
begin
side := distance(x1, y1, x2, y2);
IsPointInQuadro := (S(x1, y1, x2, y2, 0, 0) + S(x2, y2, x3, y3, 0, 0) + S(x3, y3, x4, y4, 0, 0) + S(x1, y1, x4, y4, 0, 0)) <= sqr(side);
end;
var
x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, r, points, side : double;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
readNum(x1, 'x1');
readNum(y1, 'y1');
readNum(x2, 'x2');
readNum(y2, 'y2');
readNum(x3, 'x3');
readNum(y3, 'y3');
readNum(x4, 'x4');
readNum(y4, 'y4');
readNum(x5, 'x5');
x1 := x1 - x5;
x2 := x2 - x5;
x3 := x3 - x5;
x4 := x4 - x5;
readNum(y5, 'y5');
y1 := y1 - y5;
y2 := y2 - y5;
y3 := y3 - y5;
y4 := y4 - y5;
readNum(r, 'r');
points := CommonPoints(x1, y1, x2, y2, r) + CommonPoints(x2, y2, x3, y3, r) + CommonPoints(x3, y3, x4, y4, r) + CommonPoints(x4, y4, x1, y1, r);
side := distance(x1, y1, x2, y2);
if (points = 0) and (r < (side / 2)) and IsPointInQuadro(x1, y1, x2, y2, x3, y3, x4, y4) then
writeln('v predelah kvadrata')
else
writeln('vne predelov');
readln;
end.
Если актуально, пишии! Распишу полность код, где и что происходит ICQ#: 410-691-984