Created
March 5, 2021 07:51
-
-
Save TheTimgor/a8962206f89b51adb425e8a90492e3e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fast_rot(width, height, raster): | |
for j in range(0, width): | |
for k in range(0, height): | |
to = width * height - (height * j + k + 1) | |
i = (width - j - 1) + width * k | |
if i != to: | |
while i > to: | |
i = width * (height - (i % height) - 1) + ((i - (i % height)) / height) | |
buffer = raster[int(i)] | |
raster[int(i)] = raster[int(to)] | |
raster[int(to)] = buffer | |
return raster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment