Janilabo

Untitled

Sep 13th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.10 KB | None | 0 0
  1. {$loadlib pumbaa.dll}
  2.  
  3. const
  4.   GENERATE = 50000; // Generate how many random points..?
  5.   // Green points = Non-convex hull points from TPA
  6.   // White points = Convex hull points from TPA
  7.   // Red points = Connected convex hull points (based on pp_TPAConnect)
  8.  
  9. //******* Plot a few shapes using this algorithm *******//
  10. var
  11.   TPA, CTPA, HTPA: TPointArray;
  12.   bmp, t: Integer;
  13.   b: TBox;
  14.  
  15. begin
  16.   ClearDebug;
  17.   bmp := CreateBitmap(700, 700);
  18.   b := IntToBox(100, 100, 600, 600);
  19.   t := GetSystemTime;
  20.   pp_TPAFromBox(b, GENERATE, TPA);
  21.   WriteLn('Generating random points took ' + IntToStr(GetSystemTime - t) + ' ms.');
  22.   CTPA := CopyTPA(TPA);
  23.   t := GetSystemTime;
  24.   pp_TPAConvexHull(CTPA);
  25.   WriteLn('Convex hull took ' + IntToStr(GetSystemTime - t) + ' ms.');
  26.   HTPA := CopyTPA(CTPA);
  27.   t := GetSystemTime;
  28.   pp_TPAConnect(CTPA);
  29.   WriteLn('Connecting took ' + IntToStr(GetSystemTime - t) + ' ms.');
  30.  
  31.   DrawTPABitmap(bmp, TPA, 357435);
  32.   DrawTPABitmap(bmp, CTPA, 255);
  33.   DrawTPABitmap(bmp, HTPA, 16777215);
  34.  
  35.   DisplayDebugImgWindow(700,700);
  36.   DrawBitmapDebugImg(bmp);
  37.   FreeBitmap(bmp);
  38. end.
Advertisement
Add Comment
Please, Sign In to add comment