[net.sources.bugs] Bug in Miranda code

msp@ukc.ac.uk (M.S.Parsons) (07/25/86)

Whoops! The Miranda code I recently sent to draw the M.C.Escher "squarelimit"
picture had a bug. A classic case: a "+" instead of a "-".

This is the correct version of the rot function (I hope):

|| rot rotates an image by th radians anti-clockwise, about the image centre.
rot :: num -> image -> image
rot th i = tr middle (imap rotp (tr (negpoint middle) i))
           where
           rotp p = Pt (coord cos) (coord sin)
                    where
                    coord f = l * (f (a - th))
                              where
                              (Po a l) = ctop p

(Note for those running out of heap space: The only rotations involved in the 
drawing are multiples of 90 degrees, so this general rotate could be replaced 
by a much more efficient specific routine.)


------------------------------------------------------------------------------
Mike Parsons    UUCP: ..!seismo!mcvax!ukc!msp             JANET: msp@uk.ac.ukc
                MAIL: Computing Lab, University of Kent, Canterbury, Kent, UK.