Autor Beitrag
Battery
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 20



BeitragVerfasst: Fr 19.05.06 17:43 
Hallo
Wir sollen von der Schule aus einen Kreis zeichnen, bei dem die Radien in einer Schleife eingezeichnet werden. HAb hier mal nen Ansatz, komm aber net weiter:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.Button1Click(Sender: TObject);
var

i,mitte_x,mitte_y, grad,bogen,x,y :integer;
begin
mitte_x:=clientwidth div 2;
Mitte_y:= clientheight div 2;
canvas.ellipse(clientwidth div 2 - 200,clientheight div 2-200, clientwidth div 2 +200, clientheight div 2 +200);
grad:=1;
for i:=1 to 60 do begin
bogen:=round(grad/360*2*pi);
y:=round (sin(bogen)*200);
x:=round(Exp(Ln(200*200-y*y) / 2));
canvas.MoveTo(mitte_x, mitte_y); canvas.lineto(mitte_x+x,mitte_y-y);
grad:=grad+6;
end;

end;

end.

hoffe ihr könnt helfen...
Battery
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Fr 19.05.06 18:03 
Hallo
Was soll da am Ende enstehen ne Tortengrafik ?
ich versteh nich was du mit radien einzeichnen meinst.
erklär das doch nochmal genauer. oder poste mal die Aufgabe.
gruß

_________________
[b]Ich weiß nicht immer, wovon ich rede. Aber ich weiß, dass ich recht habe.[b]
Battery Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 20



BeitragVerfasst: Sa 20.05.06 17:58 
ja genau im endeffekt eine torten grafik
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Sa 20.05.06 18:02 
Naja ..Wo kommst du denn jetzt nicht weiter?
Wenn mann das Prog startet hat man doch ne Tortengrafik. Also was Funktioniert denn nicht?
gruß

_________________
[b]Ich weiß nicht immer, wovon ich rede. Aber ich weiß, dass ich recht habe.[b]
Battery Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 20



BeitragVerfasst: So 21.05.06 22:51 
naja also bei mir is die torten grafik net so schön gleichmäßig.....
die sollte schon so sein das alle stücker dasselbe bogenmaß haben
aim65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: So 21.05.06 23:35 
Du hast mit Integern an den falschen Stellen gerechnet. Da kriegst du nie die richtigen Werte.
Ändere mal das hier:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
..
i,mitte_x,mitte_y,x,y :integer;
grad,bogen: Real;
begin
mitte_x:=clientwidth div 2;
Mitte_y:= clientheight div 2;
canvas.ellipse(clientwidth div 2 - 200,clientheight div 2-200, clientwidth div 2 +200, clientheight div 2 +200);
grad:=0;
for i:=1 to 60 do begin
bogen:=2*pi*grad/360;
y:=round(sin(bogen)*200);
x:=round(cos(bogen)*200); 
//x:=round(Exp(Ln(200*200-y*y) / 2)); <---Warum so kompliziert?
canvas.MoveTo(mitte_x, mitte_y); canvas.lineto(mitte_x+x,mitte_y-y);
grad:=grad+6;
end;
Battery Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 20



BeitragVerfasst: Di 23.05.06 17:40 
genau so funktioniert es :roll:
danke für die hilfe