Function Rotation(MInput:Matriks;pil:String):Matriks;
var
i,j: integer;
MOutput: Matriks;
begin
if (pil='90C') or (pil='90UC') then
begin
SetLength(MOutput, Length(MInput[0]), Length(MInput));
for i:= 0 to Length(MOutput)-1 do
begin
for j:=0 to Length(MOutput[0])-1 do
begin
if pil='90C' then
MOutput[i,j]:=MInput[j,(Length(MOutput)-1)-i]
else
MOutput[i,j]:=MInput[(Length(MOutput[0])-1)-j,i];
end;
end;
end
else
if (pil='180C') or (pil='180UC') then
begin
MOutput:=Rotation(MInput,'90C');
MOutput:=Rotation(MOutput, '90C');
end
else
if (pil='270C') then
begin
MOutput:=Rotation(MInput,'90UC');
end
else
begin
MOutput:=Rotation(MInput,'90C');
end;
Rotation:=MOutput;
end;
No comments:
Post a Comment