uses crt,graph;
type matrix=array [1..4,1..4] of integer;
vector=array [1..4] of integer;
Point=array [1..2] of integer;
var i,j,c:integer;
matr,matr_1,matrixX:matrix;
vect_1,vect_2,vect_3,vect_4,vect_5:vector;
p1,p2,p3,p4:point;
procedure vect_matr(vect:vector;matr:matrix);
begin
for i:=1 to 4 do
begin
for j:=1 to 4 do
begin
vect_5[i]:=vect_5[i]+vect[j]*matr[i,j];
end;
end;
end;
procedure Risunok;
Var Gd,Gm:Integer;
Begin
Gd:=Detect;
InitGraph(Gd,Gm,'C:\BP\BGI');
If GraphResult <> grOk Then Halt(1);
p1[1]:=100;
p1[2]:=100;
p2[1]:=300;
p2[2]:=100;
p3[1]:=300;
p3[2]:=300;
p4[1]:=100;
p4[2]:=300;
line(p1[1],p1[2],p2[1],p2[2]);
line(p2[1],p2[2],p3[1],p3[2]);
line(p3[1],p3[2],p4[1],p4[2]);
line(p4[1],p4[2],p1[1],p1[2]);
readln;
vect_1[1]:=p1[1];
vect_1[2]:=p1[2];
vect_1[3]:=1;
vect_1[4]:=1;
vect_2[1]:=p2[1];
vect_2[2]:=p2[2];
vect_2[3]:=1;
vect_2[4]:=1;
vect_3[1]:=p3[1];
vect_3[2]:=p3[2];
vect_3[3]:=1;
vect_3[4]:=1;
vect_4[1]:=p4[1];
vect_4[2]:=p4[2];
vect_4[3]:=1;
vect_4[4]:=1;
matrixX[1,1]:=1;
matrixX[1,2]:=0;
matrixX[1,3]:=0;
matrixX[1,4]:=0;
matrixX[2,1]:=0;
matrixX[2,2]:=round(cos(90));
matrixX[2,3]:=round(sin(90));
matrixX[2,4]:=0;
matrixX[3,1]:=0;
matrixX[3,2]:=round(-sin(90));
matrixX[3,3]:=round(cos(90));
matrixX[3,4]:=0;
matrixX[4,1]:=0;
matrixX[4,2]:=0;
matrixX[4,3]:=0;
matrixX[4,4]:=1;
vect_matr(vect_1,matrixX);
p1[1]:=vect_5[1];
p1[2]:=vect_5[2];
vect_matr(vect_2,matrixX);
p2[1]:=vect_5[1];
p2[2]:=vect_5[2];
vect_matr(vect_3,matrixX);
p3[1]:=vect_5[1];
p3[2]:=vect_5[2];
vect_matr(vect_4,matrixX);
p4[1]:=vect_5[1];
p4[2]:=vect_5[2];
line(p1[1],p1[2],p2[1],p2[2]);
line(p2[1],p2[2],p3[1],p3[2]);
line(p3[1],p3[2],p4[1],p4[2]);
line(p4[1],p4[2],p1[1],p1[2]);
ReadLn;
CloseGraph;
End;
begin
risunok;
end.
Вращение обьекта |