You've already forked lazarus-ccr
* added overload to T2DIntVector.DistanceTo accepting x y coordinates
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1701 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -45,11 +45,15 @@ type
|
|||||||
function Length : extended;
|
function Length : extended;
|
||||||
end;
|
end;
|
||||||
{$else}
|
{$else}
|
||||||
|
|
||||||
|
{ T2DIntVector }
|
||||||
|
|
||||||
T2DIntVector = object
|
T2DIntVector = object
|
||||||
x, y : integer;
|
x, y : integer;
|
||||||
public
|
public
|
||||||
constructor Create(Ax, Ay : integer);
|
constructor Create(Ax, Ay : Integer);
|
||||||
function DistanceTo(AVector : T2DIntVector) : double;
|
function DistanceTo(AVector : T2DIntVector) : double;
|
||||||
|
function DistanceTo(Ax, Ay : Integer) : double;
|
||||||
function Length : extended;
|
function Length : extended;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -353,6 +357,11 @@ begin
|
|||||||
result:=sqrt(sqr(self.x - AVector.x) + sqr(self.y - AVector.y));
|
result:=sqrt(sqr(self.x - AVector.x) + sqr(self.y - AVector.y));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function T2DIntVector.DistanceTo(Ax, Ay: Integer): double;
|
||||||
|
begin
|
||||||
|
Result := sqrt(sqr(x - Ax) + sqr(y - Ay));
|
||||||
|
end;
|
||||||
|
|
||||||
function T2DIntVector.Length: extended;
|
function T2DIntVector.Length: extended;
|
||||||
begin
|
begin
|
||||||
result:=sqrt(sqr(Self.x)+sqr(self.y));
|
result:=sqrt(sqr(Self.x)+sqr(self.y));
|
||||||
|
Reference in New Issue
Block a user