Einzelnen Beitrag anzeigen

Benutzerbild von spox
spox

Registriert seit: 23. Sep 2007
47 Beiträge
 
Delphi 7 Personal
 
#1

Windmühle, bei der die Flügelanzahl variabel ist

  Alt 28. Okt 2007, 15:09
Ich bin zurzeit an einer Windmühle, bei dem die Postition, Flügelanzahl und Höhe der Mühle variabel ist. Das "Haus" der Mühle habe ich schon fertig, nur komme ich bei den variablen Flügeln nicht weiter:
Delphi-Quellcode:
unit muehleU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

const
 pi=3.1415;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
    procedure Muehle(anzahl,hoehe,x,y:integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 Muehle (4,150,50,50);
end;

procedure TForm1.Muehle (anzahl,hoehe,x,y:integer);
var flange,nr,bm,x2,y2:integer;
begin
 with Image1.Canvas do
  begin
   moveTo (x,y);
   rectangle (x,y,x+round(hoehe/5),hoehe);
   moveTo (x+(round(hoehe/5)DIV 2),y+10);
   x2:= x+(round(hoehe/5)DIV 2);
   y2:= y+10;
   flange:= hoehe DIV 2 ;
   bm:= round((2*pi) / anzahl);
   for nr:= 1 to anzahl do
   begin
   lineTo (round(flange*cos(bm*nr)+(hoehe DIV 10)),round(-flange*sin(bm*nr)+60));
   moveTo (x2,y2);
   end;
  end;
end;

end.
Habt ihr Tipps bzw. Lösungen?
  Mit Zitat antworten Zitat