Revision 6c07919c
Added by Leszek Koltunski 10 months ago
| src/main/java/org/distorted/objectlib/solvers/implemented/PhasedSolverMegaminx.java | ||
|---|---|---|
| 46 | 46 |
int[][] edgeMap = TwistyDodecahedron.initializeEdgeMap(); |
| 47 | 47 |
int[][] centerMap = TwistyDodecahedron.initializeCenterMap(); |
| 48 | 48 |
|
| 49 |
float[][] centerCoords = new float[NUM_CENTERS][3];
|
|
| 49 |
float[][] centers = new float[NUM_CENTERS][3]; |
|
| 50 | 50 |
|
| 51 |
for(int center=0; center<NUM_CENTERS; center++)
|
|
| 51 |
for(int c=0; c<NUM_CENTERS; c++)
|
|
| 52 | 52 |
{
|
| 53 |
int[] map = centerMap[center];
|
|
| 53 |
int[] map = centerMap[c]; |
|
| 54 | 54 |
float[] c1 = corners[map[0]]; |
| 55 | 55 |
float[] c2 = corners[map[1]]; |
| 56 | 56 |
float[] c3 = corners[map[2]]; |
| 57 | 57 |
float[] c4 = corners[map[3]]; |
| 58 | 58 |
float[] c5 = corners[map[4]]; |
| 59 |
centerCoords[center][0] = (c1[0]+c2[0]+c3[0]+c4[0]+c5[0]) / 5;
|
|
| 60 |
centerCoords[center][1] = (c1[1]+c2[1]+c3[1]+c4[1]+c5[1]) / 5;
|
|
| 61 |
centerCoords[center][2] = (c1[2]+c2[2]+c3[2]+c4[2]+c5[2]) / 5;
|
|
| 59 |
centers[c][0] = (c1[0]+c2[0]+c3[0]+c4[0]+c5[0]) / 5;
|
|
| 60 |
centers[c][1] = (c1[1]+c2[1]+c3[1]+c4[1]+c5[1]) / 5;
|
|
| 61 |
centers[c][2] = (c1[2]+c2[2]+c3[2]+c4[2]+c5[2]) / 5;
|
|
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
float[][] edgeCoords = new float[NUM_EDGES][3];
|
|
| 64 |
float[][] edges = new float[NUM_EDGES][3]; |
|
| 65 | 65 |
|
| 66 |
for(int edge=0; edge<NUM_EDGES; edge++)
|
|
| 66 |
for(int e=0; e<NUM_EDGES; e++)
|
|
| 67 | 67 |
{
|
| 68 |
int[] map = edgeMap[edge];
|
|
| 68 |
int[] map = edgeMap[e]; |
|
| 69 | 69 |
float[] c1 = corners[map[0]]; |
| 70 | 70 |
float[] c2 = corners[map[1]]; |
| 71 |
edgeCoords[edge][0] = (c1[0]+c2[0]) / 2;
|
|
| 72 |
edgeCoords[edge][1] = (c1[1]+c2[1]) / 2;
|
|
| 73 |
edgeCoords[edge][2] = (c1[2]+c2[2]) / 2;
|
|
| 71 |
edges[e][0] = (c1[0]+c2[0]) / 2;
|
|
| 72 |
edges[e][1] = (c1[1]+c2[1]) / 2;
|
|
| 73 |
edges[e][2] = (c1[2]+c2[2]) / 2;
|
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
int index=0; |
| 77 | 77 |
final float[][] positions = new float[NUM_CORNERS + NUM_EDGES + NUM_CENTERS][]; |
| 78 | 78 |
|
| 79 | 79 |
for(int c=0; c<NUM_CORNERS; c++) positions[index++] = corners[c]; |
| 80 |
for(int e=0; e<NUM_EDGES ; e++) positions[index++] = edgeCoords[e];
|
|
| 81 |
for(int c=0; c<NUM_CENTERS; c++) positions[index++] = centerCoords[c];
|
|
| 80 |
for(int e=0; e<NUM_EDGES ; e++) positions[index++] = edges[e]; |
|
| 81 |
for(int c=0; c<NUM_CENTERS; c++) positions[index++] = centers[c]; |
|
| 82 | 82 |
|
| 83 | 83 |
return positions; |
| 84 | 84 |
} |
Also available in: Unified diff
minor