# Skew Rotation!

7

SP4CEBAR 2024-06-12 20:34 (Edited)

## Rotation is achieved by applying three skews

This method preserves all pixels, take a look at Mario's buttons for example.

The current demo shows three pictures:

• New, this is the skew rotation method: each pixel is skewed and floored three times. The flooring makes sure that each pixel arrives at its destination and that no pixel gets lost or duplicated.
• Old, this is the inverted rotation matrix method: for each output pixel, it finds an input pixel. Some input pixels may be used multiple times or not used at all.
• Older, this is the first rotation matrix method I've used: it transforms each input pixel to a new output pixel location, some locations get more than one pixel, while other locations get no pixels, in which case, a hole is left.

2024-06-14 15:43
2024-06-14 15:20
2024-06-12 20:34

was8bit 2024-06-13 04:16

Wowzers, you did all the math... thanks so much :):):)

SP4CEBAR 2024-06-13 14:30 (Edited)

I copied all the math :)

was8bit 2024-06-13 16:16

Ah, well implementing the math into lowres code is abit of work ;)

nathanielbabiak 2024-06-13 17:55

Could you do a side-by-side comparison with "plain" rotation?

SP4CEBAR 2024-06-14 14:50 (Edited)

Matt Parker mentioned in this video that these skews can be analyzed as matrices, now I just realized it is more performant to process them this way. As an added benefit, it resembles the traditional method, the only difference is the matrix itself.

By the way, I like using 1D arrays for 2D matrices, they are easy to define and 1D arrays are more performant than 2D arrays, using arrays and passing them on to functions also allows a nice code structure compared to using variables

SP4CEBAR 2024-06-14 15:23 (Edited)

I forgot that the coordinates need to be floored in between each applied skew, I don't think I can put that into a matrix

was8bit 2024-06-14 15:30

Looks good :)