function Obter_ProdutoEscalar (V1, V2: TPonto2D): TReal;
begin
Result:= V1.X*V2.X + V1.Y*V2.Y;
end;
function Obter_Modulo (Valor: TPonto2D): TReal;
begin
with Valor do
Result:= SqRt (X*X + Y*Y);
end;
function Obter_Determinante (V1, V2: TPonto2D): TReal;
begin
Result:= V1.X*V2.Y - V1.Y*V2.X;
end;
function Obter_Angulo (V1, V2: TPonto2D): TInteiro;
begin
Result:= Trunc (RadToDeg (ArcCos (Obter_ProdutoEscalar (V1, V2) / (Obter_Modulo (V1)*Obter_Modulo (V2)))));
if Obter_Determinante (V1, V2) < 0 then
Result:= 360-Result;
end;
|