Hex boards make my head hurt. Besides, this is a momentary effect that will only last an instant. However, I will be doubling my blocks so that there's more of a square effect.
To complete you example, I want it to go like this:
112233
445566
778899
33
2266
115599
4488
77
336699
225588
114477
Which requires some sort of half steps. One of the problems is that a diagonal is longer than a ordinal.
Since I posted that first post I've become an expert on rotation. Let me share what I've learned:
A rotation matrix looks like:
[
which you then multiply with a [x,y] matrix. Fortunately we can cut the whole matrix thing and just say that:
(x,y) rotated D degrees = (x*cos D - y*sin D, x*sin D + y*cos D)
So basically change D for the degree of rotation and you have a rotated x,y around a center point (0,0). Complications with shifting aside there is a simplification we can make because we're dealing with a 45
0 rotation and cos 45
o = sin 45
o = 0.707. So our rotation above becomes:
(x*0.707 - y*0.707, x*0.707 + y*0.707)
(0.707*(x - y), 0.707*(x + y))
Similarly for a 90
o rotation we get sin(90)=1, cos(90)=0 so we can simplify our rotation matrix:
(x*0 - y*1, x*1 + y*0)
(-y, x)
Which is pretty simple.
But it's that 45o transformation that we should be buggered about. What does that look like when you do a rotation? With rounding we get:
112233
445566
778899
223366
115599
447788
What thu? I guess that works, it's not what I expect tho. What happens when we go bigger than a 3x3 block? How will it look? Will we get overlaps?
And here's another caveat. In reality what I want to use an inverse operation so I don't have to worry about clipping.
I know I can do this, but it's going to be a pain in the neck.