Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TPAContains(sub, main:TPointArray):Boolean;
- var
- c,x,y,i,j,w,h:Int32;
- Mat: T2DIntArray;
- mB,sB:TBox;
- begin
- mB := GetTPABounds(main);
- W := mB.x2-mB.x1+1;
- H := mB.y2-mB.y1+1;
- SetLength(Mat, H,W);
- for i:=0 to High(main) do
- Mat[main[i].y-mB.y1, main[i].x-mB.x1] := 255;
- sB := GetTPABounds(sub);
- OffsetTPA(sub, Point(-sB.x1, -sB.y1));
- for y:=0 to H-1 do
- for x:=0 to W-1 do
- begin
- c := 0;
- for j:=0 to High(sub) do
- if ((y+sub[j].y < H) and (x+sub[j].x < W)) and
- (Mat[y+sub[j].y, x+sub[j].x] <> 0) then
- begin
- Inc(c);
- Continue;
- end else
- Break;
- if c = Length(sub) then
- Exit(True);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement