Alan Paeth's three-shear rotation is one of my favorite algorithms, especially because it's perfectly suited for rotating pixel art. Because shearing preserves all the original pixels, it even works with dithered images, unlike sampling-based rotation schemes.
It's also fairly simple to implement. I have implemented a version that rotates ASCII art, and that code made it to Ruby's list of sample programs:
Comments
Alan Paeth's three-shear rotation is one of my favorite algorithms, especially because it's perfectly suited for rotating pixel art. Because shearing preserves all the original pixels, it even works with dithered images, unlike sampling-based rotation schemes.
It's also fairly simple to implement. I have implemented a version that rotates ASCII art, and that code made it to Ruby's list of sample programs:
https://github.com/ruby/ruby/tree/master/sample/trick2025/01...