Randomly spawning bitmaps on cnvas
- by Toystoj
I need some ideas in order to finish algorithm. I'm randomly placing objects (bitmaps) on canvas without overlapping. Time needed to finish it is my problem. When I need to spawn for example 80% of canvas it takes to long. So i was thinking : I should make some change when the bitmaps take off 50 % of canvas. I want to tell algorithm that it should generate new locations (x,y) where it is free space.
My question is : How to render new location (x,y) in place where is free space.
In summary:
Things I know :
object location (x,y)
4 corners (x,y) of object
object width, height
canvas width, height
Any suggestions?