caused
2009-08-31 04:36:52
I'll let the image talk :'D

Basicly i'm looking for ideas to improve the performance/efficiency.

Basicly i'm looking for ideas to improve the performance/efficiency.
// 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;