Advertisement
mixster

mixster

Jul 4th, 2009
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.56 KB | None | 0 0
  1.  
  2. function TPFromOval(cx, cy, mx, my: Integer): TPoint;
  3. var
  4.   m: Integer;
  5. begin
  6.   m := Random(my + 1);
  7.   if (RBool) then
  8.     m := -m;
  9.   Result.y := cy + m;
  10.   m := Random(Round(Sqrt(Sqr(my) - Sqr(m)) * (mx / my)) + 1);
  11.   if (RBool) then
  12.     m := -m;
  13.   Result.x := cx + m;
  14. end;
  15.  
  16.  
  17. var
  18.   t: TPoint;
  19. begin
  20.   Writeln('Oh hey!');
  21.   DisplayDebugImgWindow(200, 200);
  22.   Wait(50);
  23.   GetDebugCanvas.Rectangle(50, 50, 150, 150);
  24.   repeat
  25.     t := TPFromOval(100, 100, 50, 50);
  26.     GetDebugCanvas.Pixels[t.x, t.y] := clRed;
  27.     Wait(1);
  28.   until false;
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement