Hi !!!
I've written this function ages ago and I need it now again.
The problem is, it crashes with lape and simba, and I have no clue why.
Simba just freezes and says memory violation.
Anyone with an idea to fix it ?
~caused
Simba Code:
// atpax is your atpa, remember to make boxes first with splittpaex or tpatoatpaex for example.
// minw,maxw -> minimum and maximun box width.
// minh, maxh -> min and max box height.
Function FilterATPASize(var ATPAx: T2DPointArray; minw,maxw,minh,maxh:Integer):T2dPointarray;
var
B: TBox;
W,H,i,lengthcounter: Integer;
temp,temp2,temptpa : T2DPointArray;
begin
SortATPASize(ATPAx,True);
setarraylength(temp,length(atpax));
lengthcounter:=0;
for i:= 0 to high(atpax) do
begin
B := GetTPABounds(ATPAx[i]);
W := B.x2 - B.x1;
H := B.y2 - B.y1;
// WriteLn('Box '+inttostr(i)+'dimensions: '+inttostr(W)+'*'+inttostr(H));
If ((W >= minw) AND (W <= maxw) AND (H >= minh) AND (H <= maxh)) then
begin
inc(lengthcounter);
temp[i] := CombineTPA(atpax[i],temp[i]);
// writeLn('Boxes Found: '+inttostr(lengthcounter));
end;
end;
//InvertAtpa(temp);
SetArrayLength(temp,lengthcounter+1);
result := temp;
end;