Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Winkelfunktionen im Gradmaß (https://www.delphipraxis.net/95490-winkelfunktionen-im-gradmass.html)

qb-tim 7. Jul 2007 12:48


Winkelfunktionen im Gradmaß
 
Diese Funktionen berechnen Winkelfunktionen im Gradmaß (statt im Bogenmaß)

Delphi-Quellcode:
function DegCos(i: Real): Real;
begin
  Result := Cos(i * (Pi / 180));
end;

function DegSin(i: Real): Real;
begin
  Result := Sin(i * (Pi / 180));
end;

function DegTan(i: Real): Real;
begin
  Result := Tan(i * (Pi / 180));
end;
Die Methode ist ganz einfach und kann auf jede Winkelfunktion, die normalerweise im Bogenmaß operiert, angewendet werden

Delphi-Quellcode:
// ersetze ??? mit einer Winkelfunktion

function Deg???(i: Real): Real;
begin
  Result := ???(i * (Pi / 180));
end;
Manchmal muss man im uses noch Math hinzufügen!

Dax 7. Jul 2007 12:57

Re: Winkelfunktionen im Gradmaß
 
Das ist sinnlos. Siehe DegToRad, RadToDeg etc..

Kroko1999 7. Jul 2007 13:04

Re: Winkelfunktionen im Gradmaß
 
Zitat:

Zitat von Dax
Das ist sinnlos. Siehe DegToRad, RadToDeg etc..

in der Unit Math, also
Delphi-Quellcode:
uses Math;
hinzufügen, :wink:


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:08 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz