Forum: Multimedia
Delphi
by shmia,
21. Dez 2005
Du meinst so eine Art "Snap-In" Einrast Funktion ?
Also erst mal schauen, in welchem Quadranten wir sind:
function Quadrant(p:TPoint):integer;
begin
if (p.x=0) or (p.y=0) then
result := 0
else if p.x > 0 then
begin
if p.y > 0 then
result := 1
Forum: Multimedia
Delphi
by shmia,
21. Dez 2005
Winkelberechnungen sind hier fehl am Platz.
Du brauchst doch nur prüfen, ob der Abstand in X-Richtung = dem Abstand in Y-Richtung ist.
Dann hast du einen 45, 135, 225 oder 315 Grad-Winkel.
if Abs(X-SP.X)= Abs(Y-SP.Y) then