[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Tiling a Rotated Bitmap (along the unrotated axes)



"Aaron Maupin" <maupin@xxxxxxxxxxxxxx> wrote:

> Other angles will repeat, too, but like Brian says, they'll be
> disgustingly large.  As in many, many times the size of the original tile.

Some of the new tile sizes will be large, but they don't need to be "many,
many times" the size of the original tile.

Really, it boils down to making a right triangle and measuring the
hypotenuse to find the new tile size, and measuring one of the (non-right)
angles.

For example, a right triangle with legs of 1 and 2 yields angles of about
27 and 63 degrees and a hypotenuse of about 2.24, which might be small
enough to be of use.

Other angles you can use, with new tile sizes less than 10x the original:

new sz  X  Y  angle
-------------------
 2.236  1  2 26.565
 3.162  1  3 18.435
 3.606  2  3 33.690
 4.123  1  4 14.036
 5.000  3  4 36.870
 5.099  1  5 11.310
 5.385  2  5 21.801
 5.831  3  5 30.964
 6.083  1  6  9.462
 6.403  4  5 38.660
 7.071  1  7  8.130
 7.280  2  7 15.945
 7.616  3  7 23.199
 7.810  5  6 39.806
 8.062  1  8  7.125
 8.062  4  7 29.745
 8.544  3  8 20.556
 8.602  5  7 35.538
 9.055  1  9  6.340
 9.220  2  9 12.529
 9.220  6  7 40.601
 9.434  5  8 32.005
 9.849  4  9 23.962


If your eye caught on the 3-4-5 right triangle, that might be especially
handy because it's a rare occurrence of a right triangle with all
integer-length sizes. This might be handy if you don't want to muck around
with floating point multiples (or, hey, if you're trying to lay out Lego
pieces at an angle to a baseplate). Other integer triples like this
include 5-12-13, 8-15-17, and 7-24-25. But even I'd call 25 "much larger"
than your original tile size.

-Dave LeCompte