Coding > FPC Valkyrie

math.pas

**volos314**:

It's not a bug, but likely thing that makes people think you are not a math addict ))

function RealDistance(x1,y1,x2,y2 : Double): Double;

begin

RealDistance := Sqrt(Sqr(Abs(x2-x1)) + Sqr(Abs(y2-y1)));

end;

function TriDistance(x1,y1,x2,y2 : Integer): Byte;

begin

TriDistance := Round(Sqrt(Sqr(Abs(x2-x1)) + Sqr(Abs(y2-y1))));

end;

Abs is not necessary here.

**Kornel Kisielewicz**:

This is one of the oldest if not *the* oldest Valkyrie unit :P. Anyway, next valkyrie release will have a proper math unit :P

**Igor Savin**:

And when is that?

**Kornel Kisielewicz**:

Probably with the next Berserk! version :)

**Igor Savin**:

Will it be updated for 2.2.0, since Valk. seems to be incompatible already?

Navigation

[0] Message Index

[#] Next page

Go to full version