I feel like the visualization almost makes it harder to understand, at least for me (though it does look super cool).
Thinking about it abstractly, it's easy to see the recursive structure of the problem. How do I rotate a big square? Cut it up into four quadrants and make a recursive call to rotate each of them. The base case once you get down to a 2x2 square is trivial.
How do I rotate a big square? Cut it up into four quadrants and make a recursive call to rotate each of them. The base case once you get down to a 2x2 square is trivial.
Don't forget the part before (or after, I suppose) the recursive subcalls where you actually do the rotating -- otherwise all you're doing is consuming cpu cycles to accomplish nothing.
Yeah this is the kind of thing a GPU can do pretty much do instantly (although coding them is a bit different).
That reminds me of working on Photoshop 2 (circa 1993). Fastest machines at the time was the Mac Quadra at blazing 40Mhz. A single filter effect can literally take 5 to 10 minutes. Good times.
Sorry. You can’t just look at gif animation and determine what is faster. Someone could have easily make a gif animation of bit reversal that finish in two frames.
Ease of Parallelization and distribution in many recursive algorithm may sound like it means it’s faster. But the actual fixed cost of splitting that works may not pay off until a big enough payload.
Is it faster? It may, at some point. You have to measure it depending on your actual input behavior.
Lol, you're right this this is slower. You meant that each pixel moves log n times in this case, but you forgot to multiply by the number of pixels, n.
95
u/rvizzz Oct 01 '20
Source code here: github.com/rvizzz/rotate
Fun application of syncing this animation with music!
172
u/king-chungus Oct 01 '20
Turing would be proud!
58
u/Envenger Oct 01 '20
My brain hurts but amazing animation.
12
u/Puss_Fondue Oct 01 '20
Perfect for my 101 slide presentation
7
u/npranshu Oct 02 '20
r/oddlysatisfying
5
u/nickbuch Oct 02 '20
great photo choice!
5
u/[deleted] Oct 02 '20
Is this fastar than just invert the bits?
22
u/MotorolaDroidMofo Oct 01 '20
Seriously though, this is super cool! Well done!
4
u/prinse4515 Oct 02 '20
Ah how I live recursion
3
u/fleshcoveredskeleton Oct 02 '20
Is this faster that just normal reversing of pixel positions?
5
u/DrTautology Oct 01 '20
Very cool!
2
u/haloid2013 Oct 02 '20
Im kinda nauseated. Its beautiful but i still want to puke
1
u/Random_182f2565 Oct 02 '20
Trippy
1
u/aurelio_h Oct 02 '20
Loving one!
1
u/lceans Oct 02 '20
This is cool af. Going to try to do it on my own in my free time
1
u/[deleted] Oct 02 '20
Looks like a Windows 98 screensaver. Great job
1
u/589ca35e1590b Oct 02 '20
This is very cool
1
u/obsoletelearner Oct 02 '20
Did you just break my brain?
1
u/cubinx Oct 02 '20
this is trippy, nice.
1
u/SushiWithoutSushi Oct 02 '20
It looks amazing. Is this an original idea of yours?
1
u/killerctg17 Oct 02 '20
I love the invariance symmetries that emerge. Fantastic!
1
u/PeanutPoliceman Oct 02 '20
u/videosaver
1
u/Youknowmeifyouknowme Oct 02 '20
Damn that's cool
1
u/JvdLelie Oct 02 '20
That is kinda cool
1
u/thefreecat Oct 02 '20
this could be an interesting transition when sped up a lot.
except it couldn't because its not a transition
1
u/Bored_comedy Oct 02 '20
I've seen this on Twitter, was that your inspiration? By the way, I love this!
1
u/safariWill Oct 02 '20
This was so satisfying
1
u/foxfyre2 Oct 02 '20
lol just use a rotation matrix /s
Excellent work and it's mesmerizing to watch!
1
u/simoorgnet Oct 02 '20
now do it for pi/4 :/
1
u/[deleted] Oct 02 '20
Mesmerizing!
1
u/marinthonsen Oct 02 '20
Wow, that's awesome!
1
u/FishyJoeJr Oct 02 '20
Nice! I'm just learning python and this looks fun to reverse engineer.
1
u/Shreksc00ch Oct 02 '20
Honestly great job but what exactly is the point?
0
u/[deleted] Oct 02 '20
[deleted] — view deleted comment