astronomia con pascal

esci turboastro.htm

giorno solare e sidereo

program tempo1;
(* MOTO della terra diurno e attorno al sole *)
(* su disco 65 dispensa 49 \TU55\tempo1.mar *)
(* girno solare giorno sidereo *)

uses crt,graph;
type vet=array[1..800] of byte;
var disco2,d1,d2,d3,d4,d5:vet;
TEMPO,anni:INTEGER;



procedure grafica(f:integer); (* attiva pagina grafica*)
(* coordinate finestra,colore sfondo e disegno *)
var sc,tp:integer;
stringa:string;

begin
sc:=0; (* valore risoluzione 0,1,2,3,4,5,8,9 *)
tp:=0; (* valore valido 1 - 0 palette *)
stringa:='c:\scheda'; (* indica ove cercare GRAPH *)
initgraph(sc,tp,stringa); (* attiva scheda grafica *)
setbkcolor(f); (* colore sfondo *)
end;

procedure pausa; (* premere return per proseguire *)
var ch:char;
begin
setcolor(14);
outtextxy(400,440,'premi return,prego');
ch:=readkey;
setcolor(1);
outtextxy(400,440,'premi return,prego');
end;

procedure testo(x,y:integer;nome:string); (* stampa legenda testo *)
begin
outtextxy(x,y,nome);
end;

procedure costante(disco2:vet); (* sole stella orbita fissa *)
var r,s,c,ang,x,y:integer;
rad:real;

begin
r:=150;
x:=300;
y:=200;
setlinestyle(0,0,1);
line(1,y,600,y);
line(1,y+70,160,y+70);
setcolor(10);
testo(10,y,'*') ;
testo(10,y+70,'*');
putimage(x-15,y-15,disco2,1); (* sole *)
setcolor(14);
for ang:=0 to 360 do
begin
rad:=ang*3.14/180;
s:=trunc(r*sin(rad));
c:=trunc(r*cos(rad));
putpixel(x+s,y+c,2);
end;
end;

procedure terra(d1,d2,d3,d4,d5:vet;fase:integer); (* moto terra *)
var r,s,c,ang,x,y,x1,y1:integer;
rad:real;

begin
r:=150;
x:=300;
y:=200;
x1:=x-r-15;
y1:=y-15;
s:=trunc(r*sin(fase*3.14/180));
c:=trunc(r*cos(fase*3.14/180));
x1:=x-15+s;
y1:=y-15+c;
testo(10,50,'inizio giorno sidereo e solare');
putimage(x1,y1,d1,1);
delay(1000);
putimage(x1,y1,d1,1);
putimage(x1,y1,d2,1);
delay(1000);
setcolor(1);
testo(10,50,'inizio giorno sidereo e solare');
putimage(x1,y1,d2,1);
putimage(x1,y1,d3,1);
delay(1000);
putimage(x1,y1,d3,1);
putimage(x1,y1,d4,1);
delay(1000);
putimage(x1,y1,d4,1);
putimage(x1,y1,d1,1);
setcolor(2);
if (fase=270) then testo(10,60,'fine giorno solare');
testo(10,50,'fine giorno sidereo');
pausa;
setcolor(1);
testo(10,50,'fine giorno sidereo');
if (fase=270) then testo(10,60,'fine giorno solare');
putimage(x1,y1,d1,1);
setcolor(14);
if (fase=300) then line (x,y,x1,y1+17);
if (fase=300) then putimage(x1,y1,d5,1);
if (fase=300) then testo(10,60,'fine giorno solare');
pausa;
setcolor(1);
testo(10,60,'fine giorno solare');
end;



begin (* programma principale *)
clrscr;
grafica(1); (* attiva pagina grafica *)
testo(10,40,'sole');
testo(500,40,'terra');
testo(500,50,'stella fissa *');
setfillstyle(1,14);
fillellipse(20,20,10,10);
getimage(8,8,34,34,disco2);(* disco sole *)
setfillstyle(1,2);
fillellipse(500,20,10,10); (* disco terra 1*)
setlinestyle(0,0,3);
line(490,20,510,20);
line(500,10,500,20);
getimage(488,8,514,34,d1);
fillellipse(500,20,10,10); (* disco terra 2*)
setlinestyle(0,0,3);
line(490,20,500,20);
line(500,10,500,30);
getimage(488,8,514,34,d2);
fillellipse(500,20,10,10); (* disco terra 3 *)
setlinestyle(0,0,3);
line(490,20,510,20);
line(500,20,500,30);
getimage(488,8,514,34,d3);
fillellipse(500,20,10,10); (* disco terra 4 *)
setlinestyle(0,0,3);
line(500,10,500,30);
line(500,20,510,20);
getimage(488,8,514,34,d4);
fillellipse(500,20,10,10); (* disco terra 5 *)
setlinestyle(0,0,3);
line(490,25,510,15);
line(495,10,500,20);
getimage(488,8,514,34,d5);
costante(disco2);
testo(350,400,'giorno solare=giorno sidereo');
testo(350,410,'se la ruotasse senza rivoluzione');
terra(d1,d2,d3,d4,d5,270);
setcolor(1);
testo(350,400,'giorno solare=giorno sidereo');
testo(350,410,'se la ruotasse senza rivoluzione');
setcolor(2);
testo(10,370,'giorno solare > giorno sidereo:4 minuti');
testo(10,380,'per rivoluzione di 1 grado attorno al sole');
terra(d1,d2,d3,d4,d5,300);
setcolor(14);
testo(10,400,'il giorno solare varia durante il corso annuale');
testo(10,410,'infatti la terra descrive archi variabili per');
testo(10,420,'effetto della diversa velocita nella orbita ellittica');
pausa;
end.