Autor Beitrag
thorstenf01
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

Win XP
D5 enterprise
BeitragVerfasst: Mo 04.08.03 13:09 
Hy,
ich soll folgenden Pascel code in Delphi übersetzen, wobei ich die Berechnungen wohl
größtenteils übernehmen kann, ich komme aber mit den "Graphischen Elementen" nicht weiter!
Diese Prozedur soll die Größe und Farbe einer Ellipse wiedergeben und dann in einer Paintbox
ausgegeben werden.
Wer kann helfen? :?

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
Procedure Schattenwurf;
var   j,x0,y0                                                   :integer;
      xs0, ys0, zs0, h0, alfa0, azi0, dteta, zs00               :real;
begin {Berechnung des Anfangspunktes teta=0}
      teta:=0;  dteta:=0.5;
      xs0:=xik; Ys0:=yik;
      zs0:=zik+Hk+Ra;
      h0:=arctan(zs0/sqrt(xs0*xs0+ys0*ys0))*180/Pi;
      alfa0:=arctan(abs(ys0/xs0))*180/Pi;
      If xs0 > 0 then begin if ys0> 0 then
                      azi0:=90-alfa0 else
                      azi0:=90+alfa0 end else
                      begin if ys0 > 0 then

                      azi0:=270+alfa0 else
                      azi0:=270-alfa0 end;
      xy(h0,azi0);
      for j:=1 to 720 do begin
      x0:=x1; y0:=y1;
      teta:=j*dteta;
      xsik:=xik+Ra*ccos(fi)*ssin(teta);
      ysik:=yik+Ra*ssin(fi)*ssin(teta);
      zsik:=zik+Hk+Ra*ccos(teta);
      hh:=arctan(zsik/sqrt(xsik*xsik+ysik*ysik))*180/Pi;
      alfa:=arctan(abs(ysik/xsik))*180/Pi;
      if xsik > 0 then begin if ysik > 0 then
                       azi:= 90-alfa else
                       azi:= 90+alfa end else
                       begin if ysik > 0 then
                       azi:= 270+alfa else
                       azi:= 270-alfa end;
      xy(hh,azi);
      SetColor(yellow);
      line(Bmittex+x0,Bmittey+y0,Bmittex+x1,Bmittey+y1); end;

      {Mittelpunkt der Ellipse}
      zs00:=zs0-Ra;
      hh:=arctan(zs00/sqrt(xs0*xs0+ys0*ys0))*180/Pi;
      xy(hh,azi0);

      SetFillStyle(1,yellow);
      FloodFill(Bmittex+x1,Bmittey+y1,yellow);
end;


Gruß
Thorsten