| Think of addressing the vertices of the triangles in
"homogenous indices" (i,j,k) such that i+j+k = constant.
The indices each select a line from each of 3 families
of parallel ones that make up the sides of the
triangles. Rotation is by 120 degrees is then
just cyclic permutation of the indices.
This is as if you imbedded a plane in a 3 dimensinal
cubic lattice in the manner of an "isometric view" from
drafting. The constraint i+j+k = constant is the
equation of your plane, x+y+z = const.
A triangle bounded by sides (i,j,k) will be even
or odd depending on whether i+j+k = n-1 or n+1 and this
is independant of whether you permute the indices,
so you could address your triangles by any two of these
indices along with this flag and it would then be trivial
to "rotate".
- Jim
|
| I finished the derivation and then realized I had been using row numbers that
increased going up the page, as it were, rather than down. Oh well, I'll give
the results anyway.
If you superimpose an x,y coordinate system with its origin at the center of the
(r=0,c=0) triangle, then x is a linear function of c, and if we consider only
those triangles with x+y even, y is a linear function of r.
Therefore rotation around (0,0) transforms (r,m) linearly with no messy
constants, i.e. (r',m') = (ar+bm, cr+dm), where I've used m for column in order
to avoid a variable name clash.
We know the rotation moves (1,1)->(0,-2) and (-1,1)->(1,1); adding and
subtracting gives (2,0)->(-1,-3) [so (2a,2c) = (-1,-3)] and (0,2)->(1,-1) [so
(2b,2d) = (1,-1)].
Thus (r',m') = (-r+m, -3r-m)/2 if r+m is even.
To get what happens when r+m is odd it is easiest to move up and to the left,
adding (0,-1) to (r,m), then rotate, then move up, adding (1,0). This gives
(r',m') = (-r+m-1,-3r-m+1)/2
or, combining cases, (r',m') = ((-r+m+b)/2, r'-r-m) where b = 1 if r+m is odd
and 0 otherwise.
Clearly b is the least significant bit of -r+m, so we can rewrite this as
r' = ash(m-r+1,-1), m' = r'-r-m
where ash is an arithmetic shift.
Does this agree with your result?
|