[comp.sys.cbm] Rotation in Two Dimensions, Dude!

CMWOLF@MTUS5.BITNET (12/11/90)

Does anyone have a routine that would take a pixel block (e.g. a
sprite) and rotate it?  I'd settle for something as simple as
90 degrees, but would like to be at least able to do it in
45 degree jumps, and would love to be able to do it in 1 degree
jumps.  I have no idea how to start such an undertaking.
I'll settle for any tips or ideas anyone might have.
I'd also like to be able to rotate a block of pixels of different
sizes, e.g. a user blocked (defined) area.


Second: Does anyone have a program that would help me with schematic
drawings, as in draw them and print them.  I need something a bit
more specific than CAD for the 64.  I'd like something that already
has the resistors, etc, defined.

Thanks for any help

(C)
CMWOLF @ MTUS5

nrossi@jarthur.Claremont.EDU (Nick Rossi) (12/12/90)

In article <90344.192136CMWOLF@MTUS5.BITNET> CMWOLF@MTUS5.BITNET writes:
>Does anyone have a routine that would take a pixel block (e.g. a
>sprite) and rotate it?  I'd settle for something as simple as
>90 degrees, but would like to be at least able to do it in
>45 degree jumps, and would love to be able to do it in 1 degree
>jumps.  I have no idea how to start such an undertaking.
>I'll settle for any tips or ideas anyone might have.
>I'd also like to be able to rotate a block of pixels of different
>sizes, e.g. a user blocked (defined) area.

One brute-force way to do this would be to define coordinates for every
pixel in the block using an origin at the very center of the block.  Then
calculate new coordinates for each pixel by multiplying the x-coordinate
by the cosine of the rotation angle and the y-coordinate by the sine of the
angle.  This would be rather slow for larger blocks, but you might be able
to use this general approach to find a faster way of doing it.


-----------------------------------------------
Nick Rossi, '93     | "That's nasty, Wyatt..."
Harvey Mudd College | "That's Chet, Gary!"
-----------------------------------------------