Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!jarthur!nrossi From: nrossi@jarthur.Claremont.EDU (Nick Rossi) Newsgroups: comp.sys.cbm Subject: Re: Rotation in Two Dimensions, Dude! Message-ID: <10097@jarthur.Claremont.EDU> Date: 12 Dec 90 09:09:58 GMT References: <90344.192136CMWOLF@MTUS5.BITNET> Organization: Harvey Mudd College, Claremont, CA 91711 Lines: 22 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!" -----------------------------------------------