home *** CD-ROM | disk | FTP | other *** search
- Program Lente;
- {$G+}
- Uses Crt;
- Const
- Ancho = 40;
- SizeLente = Ancho*Ancho;
- RadioLente = 18;
- Type
- T_Matriz = file of Byte;
- Var
- LenteTrans : Array [1..SizeLente] of Word;
- Matriz : T_Matriz;
- Procedure MakeLenteTrans;
- Const
- CtePlano = 9;
- Var
- CntDatosX : Integer;
- CntDatosY : Integer;
- Radio : Integer;
- D,Qz : Integer;
- Ix,Iy : Integer;
- Px,Py :Integer;
- Med :Integer;
- Aux :Integer;
- Begin
- Med := Ancho div 2;
- For CntDatosY := 0 to Ancho do
- Begin
- For CntDatosX := 0 to Ancho do
- Begin
- Px :=CntDatosX-Med;
- Py :=CntDatosY-Med;
- writeln('Estos son Px: ',Px,' Py: ',Py);
- readln;
- Radio:= Round (Sqrt (Sqr(Px)+Sqr(Py)));
- If Radio>RadioLente
- then Begin
- Aux := CntDatosX+((CntDatosY)*Ancho);
- LenteTrans [Aux]:=Aux;
- End
- else Begin
- write('Estos son Px: ',Px,' Py: ',Py);
- D :=Abs(Sqr(CtePlano)-Sqr(Px)-Sqr(Py)+Sqr(RadioLente));
- Qz:=Round (1+Sqrt(D));
- Ix:=(CtePlano*Px) div (Qz + CtePlano);
- Iy:=(CtePlano*Py) div (Qz + CtePlano);
- Aux :=Med +Ix+((Med +Iy)*Ancho);
- LenteTrans [ CntDatosX+((CntDatosY)*Ancho)]:=Aux;
- write(' D = ',D,' ;Qz = ',Qz,' ;Ix= ',Ix,' ;Iy= ',Iy);
- write(' El indice es : ',Aux);
- readln;
- End;
- End;
- End;
- End;
- BEGIN
- ClrScr;
- WriteLn ('Codigo LearnWare: L E N T E.');
- WriteLn ('Por Pedro Antón Alonso. aka <rom / Spanish Lords');
- WriteLn;
- WriteLn ('Generando la matriz de transformación ');
- MakeLenteTrans;
-
- END.