Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. try (destroydialog X ) catch ()
  2. rollout X "" (
  3.  
  4. button holegen "hole gen"
  5.  
  6. fn hoole =
  7. (
  8. gc();t1=timestamp();hf = heapfree
  9.  
  10. with redraw off
  11. with undo off (
  12. gc()
  13. delete objects
  14.  
  15. Rectangle width:100 length:100 isSelected:true
  16.  
  17. R = (distance $.max $.min) / 20.0
  18.  
  19. circles = #()
  20. todelete = #()
  21.  
  22.  
  23.  
  24. format "0 Time: %sec. Mem: %\n" ((timestamp()-t1)/1000 as float) (hf-heapfree)
  25.  
  26.  
  27. for i=1 to 3333 do
  28. (
  29. pt = random ($.min + [R,R,0]) ($.max - [R,R,0])
  30. rR = random (R*0.1) R
  31.  
  32. intersecting = false
  33. for n in circles while not intersecting where distance pt n.pos < (n.radius + rR) do
  34. (
  35. intersecting = true
  36. )
  37.  
  38. if not intersecting then
  39. (
  40. append circles (Circle pos:pt radius:rR)
  41.  
  42. )
  43. )
  44.  
  45. format "1 Time: %sec. Mem: %\n" ((timestamp()-t1)/1000 as float) (hf-heapfree)
  46.  
  47. rect = copy $
  48. convertToSplineShape rect
  49.  
  50. for c in circles do addAndWeld rect (convertToSplineShape c) -1
  51. updateshape rect
  52.  
  53. format "2 Time: %sec. Mem: %\n" ((timestamp()-t1)/1000 as float) (hf-heapfree)
  54.  
  55. select rect
  56.  
  57. -- addModifier $ (Edit_Poly())
  58. )
  59.  
  60.  
  61. format "Time: %sec. Mem: %\n" ((timestamp()-t1)/1000 as float) (hf-heapfree)
  62.  
  63.  
  64. )
  65.  
  66. on holegen pressed do hoole()
  67.  
  68. )
  69. createDialog X pos:[100,100]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement