Autor Beitrag
Uni
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 18.03.10 14:12 
Hallo,
ich habe für die Schule eine Berechnung eines Rechtwinkligen Dreiecks programmiert.
es funktioniert soweit auch, allerdings ist die Berechnung falsch.

Wenn ich z.B. die Seitenlängen 4 Eingebe, dann müsste der Winkel Alpha als 45° angezeigt werden, stattdessen berechnet mir Delphi aber einen Winkel von 40,5°

Ich habe die Winkelberechnung folgendermaßen programmiert, liegt da vielleicht der Fehler?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
w1:=(a/c);
w1:= radToDeg(w1);
t:= 'Der Winkel Alpha beträgt ' + FloatToStr(w1)+'°';
Label5.Caption:=t;
w2 :=(b/c);
w2:= RadToDeg(w2);
t:= 'Der Winkel Beta beträgt ' + FloatToStrF(w2,ffFixed,6,2)+'°';
Label6.Caption:=t;


Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Do 18.03.2010 um 13:23
jfheins
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 918
Erhaltene Danke: 158

Win 10
VS 2013, VS2015
BeitragVerfasst: Do 18.03.10 14:34 
Du benutzt nirgends die Sinusfunktion.

Zudem bekommst du den Winkel mit dem arcussinus - also:

w1 = radtodeg(Math.ArcSin(a/c));
Uni Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 18.03.10 14:39 
ahh vielen Dank, jetzt geht es