http://zapodaj.net/images/846df6a47b84.png
http://zapodaj.net/images/cf40ac2d7e82.png
uses
Math;
const
Pi = 3.1415;
function Odleglosc(A, B : TPoint): Extended;
{Funkcja oblicza odległość od punktu A do B}
begin
Result := Sqrt(Sqr(B.X - A.X) + Sqr(B.Y - A.Y));
end;
function Oblicz_Kat(A, B : TPoint): Extended; overload;
{^^^^^^^^^^^^^^^^^^^^^^^^^^}
{ X }
{ | }
{ | } {X - OŚ X}
{ | B }
{ | _/ } {A - Punkt1}
{ | _/ }
{ | _/ } {B - Punkt2}
{ A/ }
{ }
{__________________________}
begin
Result := 180 - (ArcCos((B.Y - A.Y)/Odleglosc(A, B))) * 180 /Pi;
if B.X < A.X then Result := 360 - Result;
end;
function Oblicz_Kat(A, B, C : TPoint): Extended; overload;
{^^^^^^^^^^^^^^^^^^^^^^^^^^}
{ }
{ }
{ A }
{ / }
{ / } {Wynik: Kat ABC}
{ / }
{ / }
{ B--------------C }
{ }
{__________________________}
begin
Result := Oblicz_Kat(B, C) - Oblicz_Kat(B, A);
end;
Zaznaczam że jestem autorem tych funkcji i nie życzę sobie umieszczania ich gdziekolwiek bez mojej wiedzy lub bez podania autora.