Forum: Multimedia
Delphi
by DGL-luke,
30. Jun 2007
Hm. Ich verpack das mal in eine Prozedur, damit wir da nicht eventuell irgendwelche Variablen verwechseln:
function degtorad(angle : Double) : Double;
begin
result := pi * angle / 180;
end;
function radtodeg(angle : Double) : Double;
begin
Forum: Multimedia
Delphi
by DGL-luke,
29. Jun 2007
Die Koordinaten sind natürlich Offsets!
if (x1 - x2)<>0 then a:=arctan((y1 - y2) / (x1 - x2));
//FBitmap.Canvas.MoveTo(x2,y2); //Der Zeichenstift sollte ja noch am Ende des Pfeils stehen.
FBitmap.Canvas.LineTo(x2-Round(cos(a-30)*3), Round(y2-sin(a-30)*3));
FBitmap.Canvas.LineTo(x2-Round(cos(a+30)*3), Round(y2-sin(a+30)*3));
FBitmap.Canvas.LineTo(x2,y2);
Forum: Multimedia
Delphi
by DGL-luke,
29. Jun 2007
Die entsprechende Mathematik:
tan alpha = m
m = (y2-y1) / (x2-x1)
<-> alpha = arctan((y2-y1) / (x2-x1));
dann addierst du zu alpha 30° für eine seite der pfeilspitze, ziehst von alpha 30° ab für die andere seite.
wir setzen l = länge der pfeilspitze.