А он не только вертит , но ещё и жутко искажает рисунок.
Вот собственно код :
Код
uses crt , graph;
var gd , gm : integer;
const Sokol : array[-8..8,-2..13] of byte =((00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00),
(00,00,15,15,15,15,15,00,00,00,00,00,00,00,00,00),
(00,15,15,08,08,15,15,15,15,00,00,00,00,00,00,00),
(00,00,15,08,01,08,08,08,15,15,00,00,00,00,00,00),
(00,15,15,08,01,01,01,01,08,15,15,15,00,00,00,00),
(00,00,15,08,01,01,01,01,01,08,08,15,15,00,00,00),
(00,00,15,08,01,01,01,01,01,01,01,08,15,15,00,00),
(00,00,15,08,01,01,01,01,01,01,01,01,08,15,15,00),
(00,00,15,08,01,01,01,01,01,01,01,01,08,15,15,15),
(00,00,15,08,01,01,01,01,01,01,01,01,08,15,15,00),
(00,00,15,08,01,01,01,01,01,01,01,08,15,15,00,00),
(00,00,15,08,01,01,01,01,01,08,08,15,15,00,00,00),
(00,15,15,08,01,01,01,01,08,15,15,15,00,00,00,00),
(00,00,15,08,01,08,08,08,15,15,00,00,00,00,00,00),
(00,15,15,08,08,15,15,15,15,00,00,00,00,00,00,00),
(00,00,15,15,15,15,15,00,00,00,00,00,00,00,00,00),
(00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00));
rad = PI /180;
var cx , cy : integer;
b,a : integer;
procedure DrawShip;
var i , j : integer;
x2 , y2 : real;
begin
for i := -2 to 13 do begin
for j := -8 to 8 do begin
x2 :=cx+((cx+i)-cx)*cos(b*rad)-((cy+j)-cy)*sin(b*rad);
y2 :=cy+((cx+j)-cx)*sin(b*rad)+((cy+j)-cy)*cos(b*rad);
putpixel(round(x2),round(y2),sokol[j,i]);
end;
end;
end;
begin
gd := vga;
gm := vgahi;
initgraph(gd,gm'');
cx := 300;
cy := 200;
for b := 0 to 360 do begin
drawship;
delay(4000);
end;
readln;
end.
var gd , gm : integer;
const Sokol : array[-8..8,-2..13] of byte =((00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00),
(00,00,15,15,15,15,15,00,00,00,00,00,00,00,00,00),
(00,15,15,08,08,15,15,15,15,00,00,00,00,00,00,00),
(00,00,15,08,01,08,08,08,15,15,00,00,00,00,00,00),
(00,15,15,08,01,01,01,01,08,15,15,15,00,00,00,00),
(00,00,15,08,01,01,01,01,01,08,08,15,15,00,00,00),
(00,00,15,08,01,01,01,01,01,01,01,08,15,15,00,00),
(00,00,15,08,01,01,01,01,01,01,01,01,08,15,15,00),
(00,00,15,08,01,01,01,01,01,01,01,01,08,15,15,15),
(00,00,15,08,01,01,01,01,01,01,01,01,08,15,15,00),
(00,00,15,08,01,01,01,01,01,01,01,08,15,15,00,00),
(00,00,15,08,01,01,01,01,01,08,08,15,15,00,00,00),
(00,15,15,08,01,01,01,01,08,15,15,15,00,00,00,00),
(00,00,15,08,01,08,08,08,15,15,00,00,00,00,00,00),
(00,15,15,08,08,15,15,15,15,00,00,00,00,00,00,00),
(00,00,15,15,15,15,15,00,00,00,00,00,00,00,00,00),
(00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00));
rad = PI /180;
var cx , cy : integer;
b,a : integer;
procedure DrawShip;
var i , j : integer;
x2 , y2 : real;
begin
for i := -2 to 13 do begin
for j := -8 to 8 do begin
x2 :=cx+((cx+i)-cx)*cos(b*rad)-((cy+j)-cy)*sin(b*rad);
y2 :=cy+((cx+j)-cx)*sin(b*rad)+((cy+j)-cy)*cos(b*rad);
putpixel(round(x2),round(y2),sokol[j,i]);
end;
end;
end;
begin
gd := vga;
gm := vgahi;
initgraph(gd,gm'');
cx := 300;
cy := 200;
for b := 0 to 360 do begin
drawship;
delay(4000);
end;
readln;
end.
Помогите разобраться :
Это он из за округления координат искажается ? Или я в формулах ошибся ?