Einzelnen Beitrag anzeigen

brechi

Registriert seit: 30. Jan 2004
823 Beiträge
 
#10

AW: Brauche Denkanstoß für Zeichnung mit Gauß Krügerkoordinaten

  Alt 3. Mär 2018, 14:10
Ungetestet:

Delphi-Quellcode:
procedure TForm1.ToolButton2Click(Sender: TObject);
var winkel,x,y,xc,yc :real;
Img : TImage;
i:integer;
begin

winkel:=strtofloat(edit1.Text);

// Mitte berechnen
xc := (max1+min1) / 2;
yc := (max2+min2) / 2;
for i := stringgrid1.RowCount-1 downto 1 do
begin
x:=strtofloat(stringgrid1.Cells[1, i]);
y:=strtofloat(stringgrid1.Cells[2, i]);


winkel := -winkel; // da Y Achse von unten nach oben
// Winkelfunktionen benoetigen Rad anstatt Grad
winkel := DegToRad(winkel);

// in den Ursprung verschieben
x := xc - x;
y := yc - y;

// drehen

xn := x * cos (Winkel) - y * Sin(Winkel);
yn := x * sin (Winkel) + y * Cos(Winkel);

// zurueck verschieben
x := xc + x;
y := yc + y;

stringgrid1.Cells[3,i]:=floattostr(x);
stringgrid1.Cells[4,i]:=floattostr(y);

end;
zeichnen;
end;

Bitte gewoehn dir frueh genug an, den Programmcode einzuruecken.
  Mit Zitat antworten Zitat