Revision ef018c1b
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistyKilominx.java | ||
---|---|---|
90 | 90 |
|
91 | 91 |
float[][] getCuts(int numLayers) |
92 | 92 |
{ |
93 |
float[][] cuts = new float[6][numLayers-1]; |
|
94 |
float D = numLayers*MovementMinx.DIST3D; |
|
95 |
float E = 2*SIN54; |
|
96 |
float X = 2*D*E/(1+2*E); // height of the 'upper' part of a dodecahedron, i.e. put it on a table, |
|
97 |
// its height is then D*2*DIST3D, it has one 'lower' part of height X, one |
|
98 |
// 'middle' part of height Y and one upper part of height X again. |
|
99 |
// It's edge length = numLayers/3.0f. |
|
100 |
int num = (numLayers-1)/2; |
|
101 |
float G = X*0.5f/num; // height of one Layer |
|
102 |
|
|
103 |
for(int i=0; i<num; i++) |
|
104 |
{ |
|
105 |
float cut = -D + (i+0.5f)*G; |
|
106 |
int j = 2*num-1-i; |
|
107 |
cuts[0][i] = +cut; |
|
108 |
cuts[0][j] = -cut; |
|
109 |
cuts[1][i] = +cut; |
|
110 |
cuts[1][j] = -cut; |
|
111 |
cuts[2][i] = +cut; |
|
112 |
cuts[2][j] = -cut; |
|
113 |
cuts[3][i] = +cut; |
|
114 |
cuts[3][j] = -cut; |
|
115 |
cuts[4][i] = +cut; |
|
116 |
cuts[4][j] = -cut; |
|
117 |
cuts[5][i] = +cut; |
|
118 |
cuts[5][j] = -cut; |
|
119 |
} |
|
120 |
|
|
121 |
return cuts; |
|
93 |
return genericGetCuts(numLayers,0.5f); |
|
122 | 94 |
} |
123 | 95 |
|
124 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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.