Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$loadlib pumbaa.dll}
- const
- GENERATE = 50000; // Generate how many random points..?
- // Green points = Non-convex hull points from TPA
- // White points = Convex hull points from TPA
- // Red points = Connected convex hull points (based on pp_TPAConnect)
- //******* Plot a few shapes using this algorithm *******//
- var
- TPA, CTPA, HTPA: TPointArray;
- bmp, t: Integer;
- b: TBox;
- begin
- ClearDebug;
- bmp := CreateBitmap(700, 700);
- b := IntToBox(100, 100, 600, 600);
- t := GetSystemTime;
- pp_TPAFromBox(b, GENERATE, TPA);
- WriteLn('Generating random points took ' + IntToStr(GetSystemTime - t) + ' ms.');
- CTPA := CopyTPA(TPA);
- t := GetSystemTime;
- pp_TPAConvexHull(CTPA);
- WriteLn('Convex hull took ' + IntToStr(GetSystemTime - t) + ' ms.');
- HTPA := CopyTPA(CTPA);
- t := GetSystemTime;
- pp_TPAConnect(CTPA);
- WriteLn('Connecting took ' + IntToStr(GetSystemTime - t) + ' ms.');
- DrawTPABitmap(bmp, TPA, 357435);
- DrawTPABitmap(bmp, CTPA, 255);
- DrawTPABitmap(bmp, HTPA, 16777215);
- DisplayDebugImgWindow(700,700);
- DrawBitmapDebugImg(bmp);
- FreeBitmap(bmp);
- end.
Advertisement
Add Comment
Please, Sign In to add comment