I'm trying to learn myself about bitmap rotation algorithms. I've been documenting my exploration in the attached cart. If you run it in your browser, what you're seeing is the same sprite from the spritesheet being rendered in four different ways:
1) rotating each pixel location via standard sin/cos rotation matrix
2) rotating each pixel location via the 3 shears method
3) rotating each pixel location via 3 shears + a fix for Picotron's rounding during tan() calculations
4) rotation each texture endpoint via standard sin/cos rotation matrix, then drawing with tline3d
Each method is labeled with a title and the approximate CPU usage each one uses when being drawn alone. You'll note that the tline3d implementation is the fastest, but also has the most "holes" along non-orthogonal rotations.
What I need help with is understanding how to get tline3d's performance while also making sure the gaps are filled in properly (the performance of implementation 4 with the pixel accuracy of implementation 3). Any advice / guidance greatly appreciated!
EDIT: I should note that I'm aware I could cache the results of implementation 3 at discrete intervals and then draw from the cache at runtime, but I'm here to learn about tline3d, so any responses in that direction would be great!
I worked through it and posted the solution here: https://www.lexaloffle.com/bbs/?tid=141706
[Please log in to post a comment]