Revision 516451c4
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/objects/TwistyRedi.java | ||
|---|---|---|
| 40 | 40 |
|
| 41 | 41 |
public class TwistyRedi extends TwistyObject |
| 42 | 42 |
{
|
| 43 |
private static final int FACES_PER_CUBIT =6;
|
|
| 43 |
private static final int FACES_PER_CUBIT =9;
|
|
| 44 | 44 |
|
| 45 | 45 |
// the four rotation axis of a RubikRedi. Must be normalized. |
| 46 | 46 |
static final Static3D[] ROT_AXIS = new Static3D[] |
| ... | ... | |
| 112 | 112 |
// YELLOW 6 WHITE 7 BLUE 8 GREEN 9 RED 10 ORANGE 11 |
| 113 | 113 |
private static final int[][] mFaceMap = new int[][] |
| 114 | 114 |
{
|
| 115 |
{ 4, 2, 0,12,12,12 },
|
|
| 116 |
{ 2, 5, 0,12,12,12 },
|
|
| 117 |
{ 3, 4, 0,12,12,12 },
|
|
| 118 |
{ 5, 3, 0,12,12,12 },
|
|
| 119 |
{ 1, 2, 4,12,12,12 },
|
|
| 120 |
{ 5, 2, 1,12,12,12 },
|
|
| 121 |
{ 4, 3, 1,12,12,12 },
|
|
| 122 |
{ 1, 3, 5,12,12,12 },
|
|
| 123 |
|
|
| 124 |
{ 10, 8,12,12,12,12 },
|
|
| 125 |
{ 6,10,12,12,12,12 },
|
|
| 126 |
{ 10, 9,12,12,12,12 },
|
|
| 127 |
{ 7,10,12,12,12,12 },
|
|
| 128 |
{ 8, 6,12,12,12,12 },
|
|
| 129 |
{ 9, 6,12,12,12,12 },
|
|
| 130 |
{ 9, 7,12,12,12,12 },
|
|
| 131 |
{ 8, 7,12,12,12,12 },
|
|
| 132 |
{ 11, 8,12,12,12,12 },
|
|
| 133 |
{ 6,11,12,12,12,12 },
|
|
| 134 |
{ 11, 9,12,12,12,12 },
|
|
| 135 |
{ 7,11,12,12,12,12 },
|
|
| 115 |
{ 4, 2, 0 },
|
|
| 116 |
{ 2, 5, 0 },
|
|
| 117 |
{ 3, 4, 0 },
|
|
| 118 |
{ 5, 3, 0 },
|
|
| 119 |
{ 1, 2, 4 },
|
|
| 120 |
{ 5, 2, 1 },
|
|
| 121 |
{ 4, 3, 1 },
|
|
| 122 |
{ 1, 3, 5 },
|
|
| 123 |
|
|
| 124 |
{ 10, 8,12 },
|
|
| 125 |
{ 6,10,12 },
|
|
| 126 |
{ 10, 9,12 },
|
|
| 127 |
{ 7,10,12 },
|
|
| 128 |
{ 8, 6,12 },
|
|
| 129 |
{ 9, 6,12 },
|
|
| 130 |
{ 9, 7,12 },
|
|
| 131 |
{ 8, 7,12 },
|
|
| 132 |
{ 11, 8,12 },
|
|
| 133 |
{ 6,11,12 },
|
|
| 134 |
{ 11, 9,12 },
|
|
| 135 |
{ 7,11,12 },
|
|
| 136 | 136 |
}; |
| 137 | 137 |
|
| 138 |
private static final float G = 0.72f; |
|
| 139 |
|
|
| 140 | 138 |
private static final double[][] VERTICES_CORNER = new double[][] |
| 141 | 139 |
{
|
| 142 | 140 |
{ 0.0f, 0.0f, 0.0f },
|
| ... | ... | |
| 147 | 145 |
{ 0.5f, 0.5f,-0.5f },
|
| 148 | 146 |
{ 0.5f,-0.5f,-0.5f },
|
| 149 | 147 |
{-0.5f, 0.5f,-0.5f },
|
| 150 |
|
|
| 151 |
{-0.5f, 0.5f*G, 0.5f },
|
|
| 152 |
{-0.5f,-0.5f*G, 0.5f },
|
|
| 153 |
{-0.5f*G,-0.5f, 0.5f },
|
|
| 154 |
{ 0.5f*G,-0.5f, 0.5f },
|
|
| 155 |
{ 0.5f,-0.5f, 0.5f*G },
|
|
| 156 |
{ 0.5f,-0.5f,-0.5f*G },
|
|
| 157 |
{ 0.5f,-0.5f*G,-0.5f },
|
|
| 158 |
{ 0.5f, 0.5f*G,-0.5f },
|
|
| 159 |
{ 0.5f*G, 0.5f,-0.5f },
|
|
| 160 |
{-0.5f*G, 0.5f,-0.5f },
|
|
| 161 |
{-0.5f, 0.5f,-0.5f*G },
|
|
| 162 |
{-0.5f, 0.5f, 0.5f*G },
|
|
| 163 | 148 |
}; |
| 164 | 149 |
|
| 165 | 150 |
private static final int[][] VERT_INDEXES_CORNER = new int[][] |
| ... | ... | |
| 168 | 153 |
{ 1,3,5,7 },
|
| 169 | 154 |
{ 4,6,5,3 },
|
| 170 | 155 |
|
| 171 |
{ 2,10,11,4,0,5,16,17,7,0},
|
|
| 172 |
{ 4,12,13,6,0,7,18,19,1,0},
|
|
| 173 |
{ 1, 8, 9,2,0,6,14,15,5,0}
|
|
| 156 |
{ 2,4,0 },
|
|
| 157 |
{ 5,7,0 },
|
|
| 158 |
{ 4,6,0 },
|
|
| 159 |
{ 7,1,0 },
|
|
| 160 |
{ 1,2,0 },
|
|
| 161 |
{ 6,5,0 }
|
|
| 174 | 162 |
}; |
| 175 | 163 |
|
| 176 | 164 |
private static final double[][] VERTICES_EDGE = new double[][] |
| ... | ... | |
| 247 | 235 |
|
| 248 | 236 |
int getNumStickerTypes(int numLayers) |
| 249 | 237 |
{
|
| 250 |
return 2;
|
|
| 238 |
return STICKERS.length;
|
|
| 251 | 239 |
} |
| 252 | 240 |
|
| 253 | 241 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 323 | 311 |
{
|
| 324 | 312 |
float[][] bands= new float[][] |
| 325 | 313 |
{
|
| 326 |
{0.06f,35,0.5f,0.7f,6,2,2},
|
|
| 327 |
{0.00f, 0,1.0f,0.0f,2,0,0}
|
|
| 314 |
{0.06f,35,0.5f,0.7f,5,2,2},
|
|
| 315 |
{0.01f,35,0.2f,0.4f,5,2,2}
|
|
| 328 | 316 |
}; |
| 329 |
int[] bandIndexes = new int[] { 0,0,0,1,1,1 };
|
|
| 317 |
int[] bandIndexes = new int[] { 0,0,0,1,1,1,1,1,1 };
|
|
| 330 | 318 |
float[][] corners = new float[][] { {0.06f,0.12f} };
|
| 331 |
int[] cornerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
|
| 319 |
int[] cornerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 };
|
|
| 332 | 320 |
float[][] centers = new float[][] { { 0.0f, 0.0f, 0.0f} };
|
| 333 |
int[] centerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 };
|
|
| 321 |
int[] centerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 };
|
|
| 334 | 322 |
|
| 335 | 323 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 336 | 324 |
factory.createNewFaceTransform(VERTICES_CORNER,VERT_INDEXES_CORNER); |
| ... | ... | |
| 379 | 367 |
|
| 380 | 368 |
int getFaceColor(int cubit, int cubitface, int size) |
| 381 | 369 |
{
|
| 382 |
return mFaceMap[cubit][cubitface];
|
|
| 370 |
return cubitface<3 ? mFaceMap[cubit][cubitface] : STICKERS.length*FACE_COLORS.length;
|
|
| 383 | 371 |
} |
| 384 | 372 |
|
| 385 | 373 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Correct the Redmi mesh to eliminate the visible seams.