dyoo / whalesong

Whalesong: Racket to JavaScript compiler
http://hashcollision.org/whalesong
250 stars 30 forks source link

Equality Testing on Images #64

Open schanzer opened 13 years ago

schanzer commented 13 years ago

Reduced Test http://www.wescheme.org/openEditor?publicId=hoard-doubt-grope-knoll-boost Returns "true" on DrRacket, "false" on WeScheme.

Bug Location https://github.com/dyoo/whalesong/blob/master/image/private/kernel.js, line 641, and 766

Explanation It's totally my fault -- I was stupidly naive about equality testing for transformed images (scale, flip, rotate). During equality comparison, I check to see if both images are flipped/rotated/scaled by the same amount, which ignores that fact that an image can be transformed to be equivalent to another, nontransformed image.

Robby does a normalization pass over image trees, which removes these transformation from the tree before doing an equality test. ("Rotated Circles" become "Circles", and "stretched rectangles" become "rectangles"). I'll have to do the same thing to make this right.