IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   Delphi (https://www.ircforumlari.net/delphi/)
-   -   İki nokta arasındaki açı kaç derece (https://www.ircforumlari.net/delphi/688203-iki-nokta-arasindaki-aci-kac-derece.html)

Kaf_Dağı 11 Mart 2015 11:03

İki nokta arasındaki açı kaç derece
 
İki nokta arasındaki açı kaç derece


Kod:

function RelativeAngle(X1,Y1, X2,Y2 : Integer) : Integer;
 
var
 
  Theta : Extended;
 
  XDist,
 
  YDist : Integer;
 
begin
 
  Result := 0;
 
 
 
  //arctan((y2-y1)/(x2-x1))
 
  XDist := X2 - X1;
 
  YDist := Y1 - Y2;
 
  if (XDist = 0) and (YDist=0) then exit;
 
 
 
  if YDist=0 then
 
    Theta := arctan((X2-X1))
 
  else
 
    Theta := arctan((X2-X1)/(Y1-Y2));
 
 
 
  Result := Round(RadToDeg(Theta));
 
  if (X2 >= X1) and (Y2 >= Y1) then //Quadrant = 2
 
    Result := 90+(90-Abs(Result))
 
  else
 
  if (X2 <= X1) and (Y2 >= Y1) then //Quadrant = 3
 
    Result := 180 + Result
 
  else
 
  if (X2 <= X1) and (Y2 <= Y1) then //Quadrant = 4
 
    Result := 270+90-Abs(Result);
 
end;



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 15:40.

Powered by vBulletin® Version 3.8.8 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2024 IRCForumlari.Net