I have N rectangles with sides parallel to the x- and y-axes. There is another rectangle, model. I need to create an algorithm that can tell whether the model is completely covered by the N rectangles.
I have some ideas. I think that first, I need to sort the rectangles by their left side (it can be done in O(n log n) time), and then...
I am looking for an algorithm as follows:
Given a set of possibly overlapping rectangles (All of which are "not rotated", can be uniformly represented as (left,top,right,bottom) tuplets, etc...), it returns a minimal set of (non-rotated) non-overlapping rectangles, that occupy the same area.
It seems simple enough at first glance, but ...
I want to divide my game grid into an array of rectangles. Each rectangle is 40x40 and there are 14 rectangles in every column, with a total of 25 columns. This covers a game area of 560x1000.
This is the code I have set up to make the first column of rectangles on the game grid:
Rectangle[] gameTiles = new Rectangle[15];
for (int i =...
It's my first time doing Java GUI stuff, and I have a few questions. I'm making a simple side-scrolling game - planning it out, specifically. The window is going to be 800x800.
There's going to be buildings drawn as the game scrolls (every 40 px or so). I'm thinking that I'll make one 900px black rectangle, and then set copies of it at...