Path: utzoo!attcan!uunet!bu.edu!purdue!haven!mimsy!midway!daisy!francis From: francis@daisy.uchicago.edu (Francis Stracke) Newsgroups: comp.sys.mac.programmer Subject: Re: Rotating PICTs or BitMaps by arbitrary angle Message-ID: <1990Nov5.165037.25327@midway.uchicago.edu> Date: 5 Nov 90 16:50:37 GMT References: <1990Nov3.122649.12277@cs.uoregon.edu> Sender: news@midway.uchicago.edu (News Administrator) Organization: Mathematics Department, University of Chicago Lines: 24 In article <1990Nov3.122649.12277@cs.uoregon.edu> mkelly@cs.uoregon.edu (Michael A. Kelly) writes: >Hello peoples. Has anyone figured out a fast way to rotate a PICT or >BitMap by an arbitrary angle? I can figure out how to do it slowly, but >I need to rotate a small (e.g. 40x40) PICT (or BitMap) at least one revolution >per second. Fastest way to rotate a PICT will probably (depending on how complex) be to read the actual coordinates it stores & rotate those. Remember to rotate around the center of the picture, in its own local coords (i.e., within the rectangle specified in the header). Formula for rotating ( (x,y) is the old loc., (x0,y0) is the center, (h,k) is the new loc, th is the angle ): h=x0+(x-x0)*cos(th)-(y-y0)*sin(th) k=y0+(x-x0)*sin(th)+(y-y0)*cos(th) (you get this from the sin/cos addition formulae) I tell you three times: fastest way is to do it beforehand & store the results! | Francis Stracke | My opinions are my own. I don't steal them.| | Department of Mathematics |=============================================| | University of Chicago | Non sequiturs make me eat lampshades | | francis@zaphod.uchicago.edu | |