C
Chubb1337
Guest
Hi there!
The goal in a nutshell
I wish to create a digital 3D Rubik's Cube program with a variable cube size (think 2x2x2, 3x3x3, 4x4x4, 5x5x5 etc.. ). In this program I wish to try out several cube sizes, maybe even 2x2x4. Implement solving algorithms ans possibly image input which will make the digital cube match the physical scrambled cube.
Current situation
Currently I have 3x3 cube, semi-hard coded (not what I want), with the possibility to rotate the camera around this cube. It is possible to rotate the Up layer, Equator layer and Bottom layer.
I'm using an array (called workingArray) with the following information:
Current situation that works (up layer, middle and down also work):
(Depending on axis, angle and radius; pitch, roll and yaw, each of the 27 cubies is drawn individually)
When pressing the 1, 2 or 3 key they rotate the different layers. However trying to implement this in the vertical direction fails (1, 2 and 3 rotate around the Z axis, trying to implement this for the X and Y axis creates unexpected behaviour).
The problem
There are actually several problems, first of all, the current situation is not adaptable in size (2x2, 3x3, 4x4, etc..etc..). I am uncertain of what would be the best way to store the needed data, which will allow for an N by N cube to rotate all layers (X, Y and Z layers) in clockwise and counter-clockwise directions, my current attempt of using arrays feels mismatched.
The second problem consists of the actual rotating of the layers. This means the information needs to move around within the (to be specified) data structure and then be drawn accordingly.
Any help with choosing a data structure capable for this task, help on how to manipulate this data structure accordingly and making an adaptable cube size would be greatly appreciated.
If more information is required to help me out, I will gladly provide.
-Chub
The goal in a nutshell
I wish to create a digital 3D Rubik's Cube program with a variable cube size (think 2x2x2, 3x3x3, 4x4x4, 5x5x5 etc.. ). In this program I wish to try out several cube sizes, maybe even 2x2x4. Implement solving algorithms ans possibly image input which will make the digital cube match the physical scrambled cube.
Current situation
Currently I have 3x3 cube, semi-hard coded (not what I want), with the possibility to rotate the camera around this cube. It is possible to rotate the Up layer, Equator layer and Bottom layer.
I'm using an array (called workingArray) with the following information:
//0 = current position index, 1 = axis (0=centroid 1=x+ 2=y+ 3=z+ 4=x- 5=y- 6=z- 7=x0 8=y0 9=z0), 2 = angle (around the axis), 3 = radius, 4 = roll (x-axis), 5 = pitch (y-axis), 6 = yaw (z-axis)
solvedArray[i, 6] = 0;
solvedArray[i, 5] = 0;
solvedArray[i, 4] = 0;
solvedArray[i, 3] = radius;
solvedArray[i, 2] = angle;
solvedArray[i, 1] = axis;
solvedArray[i, 0] = i;
solvedArray[i, 6] = 0;
solvedArray[i, 5] = 0;
solvedArray[i, 4] = 0;
solvedArray[i, 3] = radius;
solvedArray[i, 2] = angle;
solvedArray[i, 1] = axis;
solvedArray[i, 0] = i;
Current situation that works (up layer, middle and down also work):
(Depending on axis, angle and radius; pitch, roll and yaw, each of the 27 cubies is drawn individually)
When pressing the 1, 2 or 3 key they rotate the different layers. However trying to implement this in the vertical direction fails (1, 2 and 3 rotate around the Z axis, trying to implement this for the X and Y axis creates unexpected behaviour).
The problem
There are actually several problems, first of all, the current situation is not adaptable in size (2x2, 3x3, 4x4, etc..etc..). I am uncertain of what would be the best way to store the needed data, which will allow for an N by N cube to rotate all layers (X, Y and Z layers) in clockwise and counter-clockwise directions, my current attempt of using arrays feels mismatched.
The second problem consists of the actual rotating of the layers. This means the information needs to move around within the (to be specified) data structure and then be drawn accordingly.
Any help with choosing a data structure capable for this task, help on how to manipulate this data structure accordingly and making an adaptable cube size would be greatly appreciated.
If more information is required to help me out, I will gladly provide.
-Chub