Revision ef018c1b
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistyMegaminx.java | ||
---|---|---|
77 | 77 |
|
78 | 78 |
float[][] getCuts(int numLayers) |
79 | 79 |
{ |
80 |
float[][] cuts = new float[6][numLayers-1]; |
|
81 |
float D = numLayers*MovementMinx.DIST3D; |
|
82 |
float E = 2*SIN54; |
|
83 |
float X = 2*D*E/(1+2*E); // height of the 'upper' part of a dodecahedron, i.e. put it on a table, |
|
84 |
// its height is then D*2*DIST3D, it has one 'lower' part of height X, one |
|
85 |
// 'middle' part of height Y and one upper part of height X again. |
|
86 |
// It's edge length = numLayers/3.0f. |
|
87 |
int num = (numLayers-1)/2; |
|
88 |
float G = X*(0.5f-MEGA_D)/num; // height of one Layer |
|
89 |
|
|
90 |
for(int i=0; i<num; i++) |
|
91 |
{ |
|
92 |
float cut = -D + (i+0.5f)*G; |
|
93 |
int j = 2*num-1-i; |
|
94 |
cuts[0][i] = +cut; |
|
95 |
cuts[0][j] = -cut; |
|
96 |
cuts[1][i] = +cut; |
|
97 |
cuts[1][j] = -cut; |
|
98 |
cuts[2][i] = +cut; |
|
99 |
cuts[2][j] = -cut; |
|
100 |
cuts[3][i] = +cut; |
|
101 |
cuts[3][j] = -cut; |
|
102 |
cuts[4][i] = +cut; |
|
103 |
cuts[4][j] = -cut; |
|
104 |
cuts[5][i] = +cut; |
|
105 |
cuts[5][j] = -cut; |
|
106 |
} |
|
107 |
|
|
108 |
return cuts; |
|
80 |
return genericGetCuts(numLayers,0.5f-MEGA_D); |
|
109 | 81 |
} |
110 | 82 |
|
111 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Abstract the next function, computeRowFromOffset(), out of the individual Movement classes.
Still two issues:
1) mysterious 1.5 multiplier in Movement12
2) in Movement8, moving the offset works only if the rotAxis are face-turning, i.e. they connect the centers of the opposing faces of the octahedron.