DESIRED RESULT
My code is super beefy so i'll talk about the problem first.
So the goal is to create a matrix of squares that resemble continents, these squares fill up 800 X 800 pixels.
What I did was 800 divided by (number of squares across) = size of each rect. The picture above it what I want, in that example I used 40 nodes across, which divides evenly with 800.
However since I was reducing that calculation to an int, there was a margin on the bottom left. (If you divide 800 by say 33, it becomes a floating point and if that floating point gets rounded down, all that extra space adds up to a margin). Check out this previous iteration of the project, which has this problem, note the gray margine (the background).
BAD RESULT #1
SO! to remedy this I made the size a float instead, and that margin went away, YAY, the squares were now extending all the way to the bottom right of the screen.
But then this happened. The picture below shows how the stroke isn't lined up with the squares. I know there is probably a fancy term for this.
BAD RESULT #2
I GUARANTEE that I have not been toying with stroke weight, no-stroke, or translate. I am using the default renderer Everything is simply drawing rectangles
here is a section which deals with drawing the actual squares
for(float i=smeditistart;i<smeditiend;i+=1.0) {
for(float j=smeditjstart;j<smeditjend;j+=1.0) {
fill(
displaymap[int(i)] [int(j)] [0],
displaymap[int(i)] [int(j)] [1],
displaymap[int(i)] [int(j)] [2],
nodealpha);
rect(j*nodesize+maplocx,i*nodesize+maplocy,nodesize,nodesize);
}
}
maplocx is a float
maplocy is a float
nodesize is a float
I want 33 nodes to be able to fill in 800px by 800px without stroke offset.
I tried checking out stroke problems and rect problems, but those where based around the renderer and other things. Sorry if this has already been solved elsewhere, I'm crippled on the lingo.
The code is huge, inelegant, and it exceeds the character limit for a post, so I hope that what I have above sheds enough light on this. My friend told me my code is spectacular, but not spectacular in the way fireworks are, more like spectacular how a 3 legged elephant could still manage to balance on a large circus ball.
I'm under the impression this is something processing is doing, and that I need to manipulate the stroke to fix this.
Thanks a bunch!
1