GUI Rubik's cube made in python with tkinter. Main goal of this project was to learn more about 3D rendering, especially I wanted to understand all of math behind it, and also I like Rubik's cubes. First 4 devlogs were not made in the same time as the features added, I simply forgot to do them but still decided to add them, to track progress of my learning in this field.
No followers yet
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
Added executable file, that does not open terminal, only GUI. Also added docstring to the functions in code for better understanding.
Finally sides along all 3 axis can be rotated. And also I implemented new system of knowing which direction to rotate each side. Now only the only thing is left to do, is to optimize it and remove commented code.
Now the rotation of side of cube around y-axis is finished in any orientation of the cube without breaking the whole thing.
Now I can rotate the side around x-axis in any rotation of the whole cube without it breaking.
I have made the big cube out of 27 smaller ones. Now only the rotation around x-axis works, but only if whole cube has been rotated only around x-axis. If I rotate whole cube around not x-axis, it becomes messed up, as shown in the end of video. Also in video the movement of rotation of whole cube is uneven, but it is quite smooth on screen.
After watching few 3b1b videos about linear algebra and vectors, I learned what dot and cross products in vectors are. Thanks to this I added rendering only the faces that face towards me.
As next I decided to add faces to the cube, I have read that it is done through triangles, so I added 12 triangles in total. However I had not included the functionality of drawing only the faces I see, instead drawing all of them, so some faces were drawn on the top of others, and some were drawn below all the other. At right angle this created a funny illusion of it spinning right and left, even tough it was only spinning right.
In this project I wanted to learn how to render 3D objects without using any special libraries. Only tkinter and it's canvas with 2D drawing, first I had to learn about projection of points onto the screen. Together with that I decided to add rotation to the cube, so I can see if it is projecting correctly. In the end I got this result.