Hallo,
ich hab mir hier schon ne Menge Beiträge zu dem Thema durchgelesen, aber bei mir funktioniert das einfach nicht richtig.
Bei mir kommen Y-Positionen ála -20000539 raus. Gut, so wird das natürlich nicht richtig angezeigt

Delphi-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:
| procedure TForm1.Button1Click(Sender: TObject); var t, x, y, x0, y0: integer; g, vx_0, vy_0, a, v: Real; begin With image1.Canvas do begin Pen.color:=clblack; brush.color:=clgreen; pen.mode:=pmCopy; MoveTo(0,0); ListBox1.Clear; ListBox2.Clear; refresh; x0 := StrToInt(txtX.Text); y0 := StrToInt(txtY.Text); vx_0 := StrToFloat(txtA.Text); vy_0 := StrToFloat(txtV.Text); g := StrToFloat(txtG.Text); MoveTo(x0,y0); For t := 0 to 640 do begin x := round(vx_0) * t + x0; y := round(vy_0) * t + round((-1/2)*g)*(t*t) + y0; Listbox1.Items.Add(IntToStr(x)); Listbox2.Items.add(IntToStr(y)); LineTo(x,y); end; end; end; |
ja, das ist jetzt kein wirklich schöner Code, war ja nur ne Demo.
Ich zeichne hier auf ein TImage.