Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program new;
- procedure SetupDisplay(w, h: Integer);
- begin
- DisplayDebugImgWindow(w, h);
- end;
- procedure DisplayTPA(w, h, colour: Integer; tpa: TPointArray);
- var
- bmp, i, hi: Integer;
- begin
- hi := High(tpa);
- ClearDebugImg();
- bmp := GetDebugBitmap();
- for i := 0 to hi do
- FastSetPixel(bmp, tpa[i].X, tpa[i].y, colour);
- DrawBitmapDebugImg(bmp);
- FreeBitmap(bmp);
- end;
- procedure DisplayATPA(w, h: Integer; atpa: Array of TPointArray);
- var
- i, hi: Integer;
- begin
- hi := High(atpa);
- for i := 0 to hi do
- begin
- DisplayTPA(w, h, $FF00FF, atpa[i]);
- writeln('displaying nr ' + IntToStr(i));
- wait(1000);
- end;
- end;
- function CreateRandomTPA(w, h:Integer; change: Extended): TPointArray;
- var
- x, y, l: Integer;
- tpa: TPointArray;
- begin
- setLength(tpa, w * h);
- l := 0;
- for x := 0 to w-1 do
- for y := 0 to h-1 do
- if(RandomE < change) then
- begin
- tpa[l] := Point(x, y);
- Inc(l);
- end;
- setLength(tpa, l);
- result := tpa;
- end;
- var
- pts: TPointArray;
- atpa: Array of TPointArray;
- begin
- SetupDisplay(1000, 1000);
- pts := CreateRandomTPA(1000, 1000, 0.001);
- DisplayTPA(1000, 1000, $FF00FF, pts);
- writeln('drawn tpa');
- wait(1000);
- atpa := SplitTPA(pts, 30);
- SortATPASize(atpa, true);
- DisplayATPA(1000, 1000, atpa);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement