Pure1993
2009-04-26 21:15:03
While designing a fishing spot locating function, I am accross this idea…
It works similar to AMax and Max, but instead of returning the length, it is returning the entire TPA with the biggest length… Might be helpfull to some… Using this in my fisher… :)
I haven't tested it yet, but it should work…
Didn't know where to put this, so I just followed RM's example and posted this in the suggestion part… :D
PS. Sorry if something like this already exists… but I didn't find anything like this while searching for it…
It works similar to AMax and Max, but instead of returning the length, it is returning the entire TPA with the biggest length… Might be helpfull to some… Using this in my fisher… :)
I haven't tested it yet, but it should work…
{*******************************************************************************
function ReturnHighestTPArray(TPAs : T2DPointArray): TPointArray;
By: Pure1993
Description: Returns the TPA with the highest length.
*******************************************************************************}
function ReturnHighestTPArray(TPAs : T2DPointArray): TPointArray;
var
carry, i : integer;
begin
carry := Max( length(TPAs[0]), length(TPAs[1]));
if (High(TPAs) > 1) then
begin
for i := 2 to high(TPAs) do
begin
carry := Max(carry, length(TPAs[i]));
end;
end;
for i := 0 to high(TPAs) do
begin
if carry = Length(TPAs[i]) then
Result := TPAs[i];
end;
end;
I know the name is "clumsy"… I just couldn't think of a better one… :oDidn't know where to put this, so I just followed RM's example and posted this in the suggestion part… :D
PS. Sorry if something like this already exists… but I didn't find anything like this while searching for it…