Bug in Miranda code (To generate Escher "Square Limit" picture)

M.S.Parsons msp at ukc.ac.uk
Sat Jul 26 00:03:06 AEST 1986


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 at uk.ac.ukc
                MAIL: Computing Lab, University of Kent, Canterbury, Kent, UK.



More information about the Comp.sources.bugs mailing list