Naja, ich dacht, wenn du irgendwas dazu schreibst, hilft mir das Puzzelteil schon weiter ^^
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| procedure Gleichseitiges_Dreieck; var a, b, c: TPoint; SeitenLaenge: Integer; begin a.x := 1; a.y := PaintBox1.Height - 1; b.x := PaintBox1.Width - 1; b.y := a.y; Seitenlaenge := b.x - a.x; c.x := a.x + Seitenlaenge div 2; c.y := a.y - Trunc(Sqrt(3 / 4 * Sqr(Seitenlaenge))); PaintBox1.Vanvas.MoveTo(a.x, a.y); PaintBox1.Canvas.LineTo(b.x, b.y); PaintBox1.Canvas.LineTo(c.x, c.y); PaintBox1.Canvas.LineTo(a.x, a.y); end; |
Also, z.B. Punkt A / B:
Unsere PaintBox ist 200 x 200 - dann wäre A(1|199) und B(199|199).
Führt man den Code aber aus, so ist die Spitze des Dreiecks oben und die Seite C ganz unten bei der Paintbox ... also müssten die Punkte A und B ja bei y = 1 oder so sein ... und nicht so weit oben, verstehste?
Roux