Revision 582617c1
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/objects/Cubit.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 41 |
|
42 |
Cubit(TwistyObject parent, float[] position) |
|
42 |
Cubit(TwistyObject parent, float[] position, int numAxis)
|
|
43 | 43 |
{ |
44 | 44 |
mQuatIndex= 0; |
45 | 45 |
mParent = parent; |
... | ... | |
54 | 54 |
mCurrentPosition[i] = position[i]; |
55 | 55 |
} |
56 | 56 |
|
57 |
mNumAxis = mParent.ROTATION_AXIS.length;
|
|
57 |
mNumAxis = numAxis;
|
|
58 | 58 |
mRotationRow = new int[mNumAxis]; |
59 | 59 |
computeRotationRow(); |
60 | 60 |
} |
src/main/java/org/distorted/objects/TwistyBandagedFused.java | ||
---|---|---|
94 | 94 |
{ |
95 | 95 |
if( num==0 ) |
96 | 96 |
{ |
97 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
97 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
98 | 98 |
} |
99 | 99 |
else |
100 | 100 |
{ |
101 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
101 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
102 | 102 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
103 | 103 |
} |
104 | 104 |
|
src/main/java/org/distorted/objects/TwistyCube.java | ||
---|---|---|
298 | 298 |
{ |
299 | 299 |
if( num==0 ) |
300 | 300 |
{ |
301 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
301 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
302 | 302 |
} |
303 | 303 |
else |
304 | 304 |
{ |
305 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
305 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
306 | 306 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
307 | 307 |
} |
308 | 308 |
|
src/main/java/org/distorted/objects/TwistyDiamond.java | ||
---|---|---|
521 | 521 |
{ |
522 | 522 |
if( num==0 ) |
523 | 523 |
{ |
524 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
524 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
525 | 525 |
} |
526 | 526 |
else |
527 | 527 |
{ |
528 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
528 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
529 | 529 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
530 | 530 |
} |
531 | 531 |
|
src/main/java/org/distorted/objects/TwistyDino4.java | ||
---|---|---|
108 | 108 |
{ |
109 | 109 |
if( num==0 ) |
110 | 110 |
{ |
111 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
111 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
112 | 112 |
scramble[num][1] = (scramble[num][0]==1 || scramble[num][0]==2) ? 0:2; |
113 | 113 |
} |
114 | 114 |
else |
115 | 115 |
{ |
116 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
116 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
117 | 117 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
118 | 118 |
scramble[num][1] = scramble[num-1][0]+scramble[num][0]==3 ? 2-scramble[num-1][1] : scramble[num-1][1]; |
119 | 119 |
} |
src/main/java/org/distorted/objects/TwistyDino6.java | ||
---|---|---|
70 | 70 |
{ |
71 | 71 |
if( num==0 ) |
72 | 72 |
{ |
73 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
73 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
74 | 74 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0:2; |
75 | 75 |
} |
76 | 76 |
else |
77 | 77 |
{ |
78 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
78 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
79 | 79 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
80 | 80 |
scramble[num][1] = scramble[num-1][0]+scramble[num][0]==3 ? 2-scramble[num-1][1] : scramble[num-1][1]; |
81 | 81 |
} |
src/main/java/org/distorted/objects/TwistyHelicopter.java | ||
---|---|---|
414 | 414 |
{ |
415 | 415 |
if( num==0 ) |
416 | 416 |
{ |
417 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
417 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
418 | 418 |
} |
419 | 419 |
else |
420 | 420 |
{ |
421 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-2);
|
|
421 |
int newVector = rnd.nextInt(NUM_AXIS -2);
|
|
422 | 422 |
|
423 | 423 |
switch(scramble[num-1][0]) |
424 | 424 |
{ |
src/main/java/org/distorted/objects/TwistyIvy.java | ||
---|---|---|
437 | 437 |
{ |
438 | 438 |
if( num==0 ) |
439 | 439 |
{ |
440 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
440 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
441 | 441 |
} |
442 | 442 |
else |
443 | 443 |
{ |
444 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
444 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
445 | 445 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
446 | 446 |
} |
447 | 447 |
|
src/main/java/org/distorted/objects/TwistyMinx.java | ||
---|---|---|
465 | 465 |
|
466 | 466 |
if( num==0 ) |
467 | 467 |
{ |
468 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
468 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
469 | 469 |
} |
470 | 470 |
else |
471 | 471 |
{ |
472 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
472 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
473 | 473 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
474 | 474 |
} |
475 | 475 |
|
src/main/java/org/distorted/objects/TwistyObject.java | ||
---|---|---|
84 | 84 |
private static final Static3D CENTER = new Static3D(0,0,0); |
85 | 85 |
private static final int POST_ROTATION_MILLISEC = 500; |
86 | 86 |
|
87 |
final Static3D[] ROTATION_AXIS; |
|
88 | 87 |
final Static4D[] QUATS; |
89 | 88 |
final Cubit[] CUBITS; |
90 | 89 |
final int NUM_FACES; |
91 | 90 |
final int NUM_TEXTURES; |
92 |
final int NUM_CUBIT_FACES; |
|
93 |
final int NUM_AXIS; |
|
94 | 91 |
final int NUM_CUBITS; |
95 |
final float[] CUTS; |
|
96 |
final int NUM_CUTS; |
|
92 |
final int NUM_AXIS; |
|
97 | 93 |
|
98 | 94 |
private static float mInitScreenRatio; |
99 | 95 |
private static float mObjectScreenRatio = 1.0f; |
100 | 96 |
private static final float[] mTmp1 = new float[4]; |
101 | 97 |
private static final float[] mTmp2 = new float[4]; |
102 | 98 |
|
99 |
private final int mNumCubitFaces; |
|
100 |
private final Static3D[] mAxis; |
|
101 |
private final float[] mCuts; |
|
102 |
private final int mNumCuts; |
|
103 | 103 |
private final int mNodeSize; |
104 | 104 |
private final float[][] mOrigPos; |
105 | 105 |
private final Static3D mNodeScale; |
... | ... | |
113 | 113 |
private final Static3D mObjectScale; |
114 | 114 |
private final int[] mQuatDebug; |
115 | 115 |
private final float mCameraDist; |
116 |
private final Static1D mRotationAngleStatic, mRotationAngleMiddle, mRotationAngleFinal; |
|
117 |
private final DistortedTexture mTexture; |
|
116 | 118 |
private int mNumTexRows, mNumTexCols; |
117 | 119 |
private int mRotRowBitmap; |
118 | 120 |
private int mRotAxis; |
119 | 121 |
private MeshBase mMesh; |
120 | 122 |
|
121 |
Static1D mRotationAngleStatic, mRotationAngleMiddle, mRotationAngleFinal; |
|
122 |
DistortedTexture mTexture; |
|
123 |
MatrixEffectScale mScaleEffect; |
|
124 |
MatrixEffectQuaternion mQuatEffect; |
|
125 |
|
|
126 | 123 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
127 | 124 |
|
128 | 125 |
TwistyObject(int numLayers, int realSize, Static4D quat, DistortedTexture nodeTexture, MeshSquare nodeMesh, |
... | ... | |
138 | 135 |
mRealSize = realSize; |
139 | 136 |
mList = list; |
140 | 137 |
mOrigPos = getCubitPositions(mNumLayers); |
138 |
mAxis = getRotationAxis(); |
|
139 |
mInitScreenRatio = getScreenRatio(); |
|
140 |
mNumCubitFaces = getNumCubitFaces(); |
|
141 |
mCuts = getCuts(mNumLayers); |
|
142 |
mNumCuts = mCuts== null ? 0: mCuts.length; |
|
141 | 143 |
|
142 | 144 |
QUATS = getQuats(); |
143 | 145 |
NUM_CUBITS = mOrigPos.length; |
144 |
ROTATION_AXIS = getRotationAxis(); |
|
145 |
NUM_AXIS = ROTATION_AXIS.length; |
|
146 |
mInitScreenRatio = getScreenRatio(); |
|
147 | 146 |
NUM_FACES = getNumFaces(); |
148 |
NUM_CUBIT_FACES = getNumCubitFaces(); |
|
149 | 147 |
NUM_TEXTURES = getNumStickerTypes(mNumLayers)*NUM_FACES; |
150 |
CUTS = getCuts(mNumLayers); |
|
151 |
NUM_CUTS = CUTS== null ? 0: CUTS.length; |
|
148 |
NUM_AXIS = mAxis.length; |
|
152 | 149 |
|
153 | 150 |
mQuatDebug = new int[NUM_CUBITS]; |
154 | 151 |
|
... | ... | |
168 | 165 |
|
169 | 166 |
float scale = mObjectScreenRatio*mInitScreenRatio*mNodeSize/mRealSize; |
170 | 167 |
mObjectScale = new Static3D(scale,scale,scale); |
171 |
mScaleEffect = new MatrixEffectScale(mObjectScale);
|
|
172 |
mQuatEffect = new MatrixEffectQuaternion(quat, CENTER);
|
|
168 |
MatrixEffectScale scaleEffect = new MatrixEffectScale(mObjectScale);
|
|
169 |
MatrixEffectQuaternion quatEffect = new MatrixEffectQuaternion(quat, CENTER);
|
|
173 | 170 |
|
174 | 171 |
MatrixEffectScale nodeScaleEffect = new MatrixEffectScale(mNodeScale); |
175 | 172 |
nodeEffects.apply(nodeScaleEffect); |
... | ... | |
194 | 191 |
} |
195 | 192 |
|
196 | 193 |
mEffects.apply(mRotateEffect); |
197 |
mEffects.apply(mQuatEffect);
|
|
198 |
mEffects.apply(mScaleEffect);
|
|
194 |
mEffects.apply(quatEffect);
|
|
195 |
mEffects.apply(scaleEffect);
|
|
199 | 196 |
|
200 | 197 |
// Now postprocessed effects (the glow when you solve an object) require component centers. In |
201 | 198 |
// order for the effect to be in front of the object, we need to set the center to be behind it. |
... | ... | |
259 | 256 |
|
260 | 257 |
for(int i=0; i<NUM_CUBITS; i++) |
261 | 258 |
{ |
262 |
CUBITS[i] = new Cubit(this,mOrigPos[i]); |
|
259 |
CUBITS[i] = new Cubit(this,mOrigPos[i], NUM_AXIS);
|
|
263 | 260 |
mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(), 0); |
264 | 261 |
} |
265 | 262 |
|
... | ... | |
271 | 268 |
|
272 | 269 |
for(int i=0; i<NUM_CUBITS; i++) |
273 | 270 |
{ |
274 |
CUBITS[i] = new Cubit(this,mOrigPos[i]); |
|
271 |
CUBITS[i] = new Cubit(this,mOrigPos[i], NUM_AXIS);
|
|
275 | 272 |
cubitMesh[i] = createCubitMesh(i,mNumLayers); |
276 | 273 |
Static3D pos = getPos(mOrigPos[i]); |
277 | 274 |
cubitMesh[i].apply(new MatrixEffectMove(pos),1,0); |
... | ... | |
309 | 306 |
{ |
310 | 307 |
int ret=0; |
311 | 308 |
int len = pos.length / 3; |
312 |
Static3D axis = ROTATION_AXIS[rotIndex];
|
|
309 |
Static3D axis = mAxis[rotIndex];
|
|
313 | 310 |
float axisX = axis.get0(); |
314 | 311 |
float axisY = axis.get1(); |
315 | 312 |
float axisZ = axis.get2(); |
... | ... | |
326 | 323 |
|
327 | 324 |
private int computeRow(float casted) |
328 | 325 |
{ |
329 |
for(int i=0; i<NUM_CUTS; i++)
|
|
326 |
for(int i=0; i<mNumCuts; i++)
|
|
330 | 327 |
{ |
331 |
if( casted<CUTS[i] ) return (1<<i);
|
|
328 |
if( casted<mCuts[i] ) return (1<<i);
|
|
332 | 329 |
} |
333 | 330 |
|
334 |
return (1<<NUM_CUTS);
|
|
331 |
return (1<<mNumCuts);
|
|
335 | 332 |
} |
336 | 333 |
|
337 | 334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
354 | 351 |
|
355 | 352 |
private Static4D makeQuaternion(int axisIndex, int angleInDegrees) |
356 | 353 |
{ |
357 |
Static3D axis = ROTATION_AXIS[axisIndex];
|
|
354 |
Static3D axis = mAxis[axisIndex];
|
|
358 | 355 |
|
359 | 356 |
while( angleInDegrees<0 ) angleInDegrees += 360; |
360 | 357 |
angleInDegrees %= 360; |
... | ... | |
511 | 508 |
int belongsToHowManyFaces = 0; |
512 | 509 |
int bitmap = (1<<(getNumLayers()-1)) + 1; |
513 | 510 |
|
514 |
for(int i=0; i<NUM_AXIS; i++)
|
|
511 |
for(int i = 0; i< NUM_AXIS; i++)
|
|
515 | 512 |
{ |
516 | 513 |
if( (cubit.mRotationRow[i] & bitmap) != 0 ) belongsToHowManyFaces++; |
517 | 514 |
} |
... | ... | |
531 | 528 |
rotated1.get(mTmp1, 0, 0, 0); |
532 | 529 |
rotated2.get(mTmp2, 0, 0, 0); |
533 | 530 |
|
534 |
for(int i=0; i<NUM_AXIS; i++)
|
|
531 |
for(int i = 0; i< NUM_AXIS; i++)
|
|
535 | 532 |
{ |
536 | 533 |
if( (computeRow(mTmp1,i) & computeRow(mTmp2,i) & bitmap) != 0 ) return false; |
537 | 534 |
} |
... | ... | |
740 | 737 |
|
741 | 738 |
for(int cubit=0; cubit<NUM_CUBITS; cubit++) |
742 | 739 |
{ |
743 |
final Static4D[] maps = new Static4D[NUM_CUBIT_FACES];
|
|
740 |
final Static4D[] maps = new Static4D[mNumCubitFaces];
|
|
744 | 741 |
|
745 |
for(int cubitface=0; cubitface<NUM_CUBIT_FACES; cubitface++)
|
|
742 |
for(int cubitface=0; cubitface<mNumCubitFaces; cubitface++)
|
|
746 | 743 |
{ |
747 | 744 |
color = getFaceColor(cubit,cubitface,mNumLayers); |
748 | 745 |
row = (mNumTexRows-1) - color/mNumTexCols; |
... | ... | |
750 | 747 |
maps[cubitface] = new Static4D( col*ratioW, row*ratioH, ratioW, ratioH); |
751 | 748 |
} |
752 | 749 |
|
753 |
mMesh.setTextureMap(maps,NUM_CUBIT_FACES*cubit);
|
|
750 |
mMesh.setTextureMap(maps,mNumCubitFaces*cubit);
|
|
754 | 751 |
} |
755 | 752 |
} |
756 | 753 |
|
... | ... | |
760 | 757 |
{ |
761 | 758 |
final float ratioW = 1.0f/mNumTexCols; |
762 | 759 |
final float ratioH = 1.0f/mNumTexRows; |
763 |
final Static4D[] maps = new Static4D[NUM_CUBIT_FACES];
|
|
760 |
final Static4D[] maps = new Static4D[mNumCubitFaces];
|
|
764 | 761 |
int row = (mNumTexRows-1) - newColor/mNumTexCols; |
765 | 762 |
int col = newColor%mNumTexCols; |
766 | 763 |
|
767 | 764 |
maps[face] = new Static4D( col*ratioW, row*ratioH, ratioW, ratioH); |
768 |
mMesh.setTextureMap(maps,NUM_CUBIT_FACES*cubit);
|
|
765 |
mMesh.setTextureMap(maps,mNumCubitFaces*cubit);
|
|
769 | 766 |
} |
770 | 767 |
|
771 | 768 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
772 | 769 |
|
773 | 770 |
public synchronized void beginNewRotation(int axis, int row ) |
774 | 771 |
{ |
775 |
if( axis<0 || axis>=ROTATION_AXIS.length )
|
|
772 |
if( axis<0 || axis>=NUM_AXIS )
|
|
776 | 773 |
{ |
777 | 774 |
android.util.Log.e("object", "invalid rotation axis: "+axis); |
778 | 775 |
return; |
... | ... | |
786 | 783 |
mRotAxis = axis; |
787 | 784 |
mRotRowBitmap= computeBitmapFromRow( (1<<row),axis ); |
788 | 785 |
mRotationAngleStatic.set0(0.0f); |
789 |
mRotationAxis.set( ROTATION_AXIS[axis] );
|
|
786 |
mRotationAxis.set( mAxis[axis] );
|
|
790 | 787 |
mRotationAngle.add(mRotationAngleStatic); |
791 | 788 |
mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis* ObjectList.MAX_OBJECT_SIZE) , -1); |
792 | 789 |
} |
... | ... | |
801 | 798 |
mRotRowBitmap= computeBitmapFromRow( rowBitmap,axis ); |
802 | 799 |
|
803 | 800 |
mRotationAngleStatic.set0(0.0f); |
804 |
mRotationAxis.set( ROTATION_AXIS[axis] );
|
|
801 |
mRotationAxis.set( mAxis[axis] );
|
|
805 | 802 |
mRotationAngle.setDuration(durationMillis); |
806 | 803 |
mRotationAngle.resetToBeginning(); |
807 | 804 |
mRotationAngle.add(new Static1D(0)); |
... | ... | |
866 | 863 |
double nearestAngleInRadians = angle*Math.PI/180; |
867 | 864 |
float sinA =-(float)Math.sin(nearestAngleInRadians*0.5); |
868 | 865 |
float cosA = (float)Math.cos(nearestAngleInRadians*0.5); |
869 |
float axisX = ROTATION_AXIS[mRotAxis].get0();
|
|
870 |
float axisY = ROTATION_AXIS[mRotAxis].get1();
|
|
871 |
float axisZ = ROTATION_AXIS[mRotAxis].get2();
|
|
866 |
float axisX = mAxis[mRotAxis].get0();
|
|
867 |
float axisY = mAxis[mRotAxis].get1();
|
|
868 |
float axisZ = mAxis[mRotAxis].get2();
|
|
872 | 869 |
Static4D quat = new Static4D( axisX*sinA, axisY*sinA, axisZ*sinA, cosA); |
873 | 870 |
|
874 | 871 |
mRotationAngle.removeAll(); |
src/main/java/org/distorted/objects/TwistyPyraminx.java | ||
---|---|---|
392 | 392 |
|
393 | 393 |
if( num==0 ) |
394 | 394 |
{ |
395 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
395 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
396 | 396 |
} |
397 | 397 |
else |
398 | 398 |
{ |
399 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
399 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
400 | 400 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
401 | 401 |
} |
402 | 402 |
|
src/main/java/org/distorted/objects/TwistyRedi.java | ||
---|---|---|
427 | 427 |
{ |
428 | 428 |
if( num==0 ) |
429 | 429 |
{ |
430 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
430 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
431 | 431 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0:2; |
432 | 432 |
} |
433 | 433 |
else |
434 | 434 |
{ |
435 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
435 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
436 | 436 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
437 | 437 |
scramble[num][1] = (scramble[num-1][0]+scramble[num][0]==3 ? 2-scramble[num-1][1] : scramble[num-1][1]); |
438 | 438 |
} |
src/main/java/org/distorted/objects/TwistyRex.java | ||
---|---|---|
602 | 602 |
{ |
603 | 603 |
if( num==0 ) |
604 | 604 |
{ |
605 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
605 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
606 | 606 |
} |
607 | 607 |
else |
608 | 608 |
{ |
609 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
609 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
610 | 610 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
611 | 611 |
} |
612 | 612 |
|
src/main/java/org/distorted/objects/TwistySkewb.java | ||
---|---|---|
622 | 622 |
{ |
623 | 623 |
if( num==0 ) |
624 | 624 |
{ |
625 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
625 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
626 | 626 |
} |
627 | 627 |
else |
628 | 628 |
{ |
629 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
629 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
630 | 630 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
631 | 631 |
} |
632 | 632 |
|
src/main/java/org/distorted/objects/TwistySquare1.java | ||
---|---|---|
45 | 45 |
private static final float X = 3*(2-SQ3)/2; |
46 | 46 |
|
47 | 47 |
static final Static3D[] ROT_AXIS = new Static3D[] |
48 |
{
|
|
49 |
new Static3D(0,1,0),
|
|
50 |
new Static3D(COS15,0,SIN15)
|
|
51 |
};
|
|
48 |
{ |
|
49 |
new Static3D(0,1,0), |
|
50 |
new Static3D(COS15,0,SIN15) |
|
51 |
}; |
|
52 | 52 |
|
53 | 53 |
private static final int[] FACE_COLORS = new int[] |
54 |
{
|
|
55 |
COLOR_YELLOW, COLOR_WHITE,
|
|
56 |
COLOR_BLUE , COLOR_GREEN,
|
|
57 |
COLOR_RED , COLOR_ORANGE
|
|
58 |
};
|
|
54 |
{ |
|
55 |
COLOR_YELLOW, COLOR_WHITE, |
|
56 |
COLOR_BLUE , COLOR_GREEN, |
|
57 |
COLOR_RED , COLOR_ORANGE |
|
58 |
}; |
|
59 | 59 |
|
60 | 60 |
private static final Static4D[] QUATS = new Static4D[] |
61 |
{
|
|
62 |
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ),
|
|
63 |
new Static4D( 0.0f, SIN15, 0.0f, COS15 ),
|
|
64 |
new Static4D( 0.0f, 0.5f, 0.0f, SQ3/2 ),
|
|
65 |
new Static4D( 0.0f, SQ2/2, 0.0f, SQ2/2 ),
|
|
66 |
new Static4D( 0.0f, SQ3/2, 0.0f, 0.5f ),
|
|
67 |
new Static4D( 0.0f, COS15, 0.0f, SIN15 ),
|
|
68 |
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f ),
|
|
69 |
new Static4D( 0.0f, COS15, 0.0f,-SIN15 ),
|
|
70 |
new Static4D( 0.0f, SQ3/2, 0.0f, -0.5f ),
|
|
71 |
new Static4D( 0.0f, SQ2/2, 0.0f,-SQ2/2 ),
|
|
72 |
new Static4D( 0.0f, 0.5f, 0.0f,-SQ3/2 ),
|
|
73 |
new Static4D( 0.0f, SIN15, 0.0f,-COS15 ),
|
|
74 |
|
|
75 |
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f ),
|
|
76 |
new Static4D( COS15, 0.0f, SIN15, 0.0f ),
|
|
77 |
new Static4D( SQ3/2, 0.0f, 0.5f, 0.0f ),
|
|
78 |
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f ),
|
|
79 |
new Static4D( 0.5f, 0.0f, SQ3/2, 0.0f ),
|
|
80 |
new Static4D( SIN15, 0.0f, COS15, 0.0f ),
|
|
81 |
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f ),
|
|
82 |
new Static4D(-SIN15, 0.0f, COS15, 0.0f ),
|
|
83 |
new Static4D( -0.5f, 0.0f, SQ3/2, 0.0f ),
|
|
84 |
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f ),
|
|
85 |
new Static4D(-SQ3/2, 0.0f, 0.5f, 0.0f ),
|
|
86 |
new Static4D(-COS15, 0.0f, SIN15, 0.0f )
|
|
87 |
};
|
|
61 |
{ |
|
62 |
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ), |
|
63 |
new Static4D( 0.0f, SIN15, 0.0f, COS15 ), |
|
64 |
new Static4D( 0.0f, 0.5f, 0.0f, SQ3/2 ), |
|
65 |
new Static4D( 0.0f, SQ2/2, 0.0f, SQ2/2 ), |
|
66 |
new Static4D( 0.0f, SQ3/2, 0.0f, 0.5f ), |
|
67 |
new Static4D( 0.0f, COS15, 0.0f, SIN15 ), |
|
68 |
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f ), |
|
69 |
new Static4D( 0.0f, COS15, 0.0f,-SIN15 ), |
|
70 |
new Static4D( 0.0f, SQ3/2, 0.0f, -0.5f ), |
|
71 |
new Static4D( 0.0f, SQ2/2, 0.0f,-SQ2/2 ), |
|
72 |
new Static4D( 0.0f, 0.5f, 0.0f,-SQ3/2 ), |
|
73 |
new Static4D( 0.0f, SIN15, 0.0f,-COS15 ), |
|
74 |
|
|
75 |
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f ), |
|
76 |
new Static4D( COS15, 0.0f, SIN15, 0.0f ), |
|
77 |
new Static4D( SQ3/2, 0.0f, 0.5f, 0.0f ), |
|
78 |
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f ), |
|
79 |
new Static4D( 0.5f, 0.0f, SQ3/2, 0.0f ), |
|
80 |
new Static4D( SIN15, 0.0f, COS15, 0.0f ), |
|
81 |
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f ), |
|
82 |
new Static4D(-SIN15, 0.0f, COS15, 0.0f ), |
|
83 |
new Static4D( -0.5f, 0.0f, SQ3/2, 0.0f ), |
|
84 |
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f ), |
|
85 |
new Static4D(-SQ3/2, 0.0f, 0.5f, 0.0f ), |
|
86 |
new Static4D(-COS15, 0.0f, SIN15, 0.0f ) |
|
87 |
}; |
|
88 | 88 |
|
89 | 89 |
private static final int[] QUAT_NUMBER = new int[] |
90 |
{
|
|
91 |
0, 6,
|
|
92 |
0, 9, 6, 3, 18, 15, 12, 21,
|
|
93 |
0, 9, 6, 3, 15, 12, 21, 18
|
|
94 |
};
|
|
90 |
{ |
|
91 |
0, 6, |
|
92 |
0, 9, 6, 3, 18, 15, 12, 21, |
|
93 |
0, 9, 6, 3, 15, 12, 21, 18 |
|
94 |
}; |
|
95 | 95 |
|
96 | 96 |
// centers of the 2 middles + 8 edges + 8 corners |
97 | 97 |
private static final float[][] CENTERS = new float[][] |
98 |
{
|
|
99 |
{ 1.5f, 0.0f, 0.0f },
|
|
100 |
{-1.5f, 0.0f, 0.0f },
|
|
101 |
|
|
102 |
{ 0.0f, 1.0f, 1.5f },
|
|
103 |
{ 1.5f, 1.0f, 0.0f },
|
|
104 |
{ 0.0f, 1.0f,-1.5f },
|
|
105 |
{-1.5f, 1.0f, 0.0f },
|
|
106 |
{ 0.0f,-1.0f, 1.5f },
|
|
107 |
{ 1.5f,-1.0f, 0.0f },
|
|
108 |
{ 0.0f,-1.0f,-1.5f },
|
|
109 |
{-1.5f,-1.0f, 0.0f },
|
|
110 |
|
|
111 |
{ 1.5f, 1.0f, 1.5f },
|
|
112 |
{ 1.5f, 1.0f,-1.5f },
|
|
113 |
{-1.5f, 1.0f,-1.5f },
|
|
114 |
{-1.5f, 1.0f, 1.5f },
|
|
115 |
{ 1.5f,-1.0f, 1.5f },
|
|
116 |
{ 1.5f,-1.0f,-1.5f },
|
|
117 |
{-1.5f,-1.0f,-1.5f },
|
|
118 |
{-1.5f,-1.0f, 1.5f },
|
|
119 |
};
|
|
98 |
{ |
|
99 |
{ 1.5f, 0.0f, 0.0f }, |
|
100 |
{-1.5f, 0.0f, 0.0f }, |
|
101 |
|
|
102 |
{ 0.0f, 1.0f, 1.5f }, |
|
103 |
{ 1.5f, 1.0f, 0.0f }, |
|
104 |
{ 0.0f, 1.0f,-1.5f }, |
|
105 |
{-1.5f, 1.0f, 0.0f }, |
|
106 |
{ 0.0f,-1.0f, 1.5f }, |
|
107 |
{ 1.5f,-1.0f, 0.0f }, |
|
108 |
{ 0.0f,-1.0f,-1.5f }, |
|
109 |
{-1.5f,-1.0f, 0.0f }, |
|
110 |
|
|
111 |
{ 1.5f, 1.0f, 1.5f }, |
|
112 |
{ 1.5f, 1.0f,-1.5f }, |
|
113 |
{-1.5f, 1.0f,-1.5f }, |
|
114 |
{-1.5f, 1.0f, 1.5f }, |
|
115 |
{ 1.5f,-1.0f, 1.5f }, |
|
116 |
{ 1.5f,-1.0f,-1.5f }, |
|
117 |
{-1.5f,-1.0f,-1.5f }, |
|
118 |
{-1.5f,-1.0f, 1.5f }, |
|
119 |
}; |
|
120 | 120 |
|
121 | 121 |
private static final double[][] VERTICES_MIDDLE = new double[][] |
122 |
{
|
|
123 |
{ -1.5-X, 0.5, 1.5 },
|
|
124 |
{ 0.0, 0.5, 1.5 },
|
|
125 |
{ 0.0, 0.5,-1.5 },
|
|
126 |
{ -1.5+X, 0.5,-1.5 },
|
|
127 |
{ -1.5-X,-0.5, 1.5 },
|
|
128 |
{ 0.0,-0.5, 1.5 },
|
|
129 |
{ 0.0,-0.5,-1.5 },
|
|
130 |
{ -1.5+X,-0.5,-1.5 }
|
|
131 |
};
|
|
122 |
{ |
|
123 |
{ -1.5-X, 0.5, 1.5 }, |
|
124 |
{ 0.0, 0.5, 1.5 }, |
|
125 |
{ 0.0, 0.5,-1.5 }, |
|
126 |
{ -1.5+X, 0.5,-1.5 }, |
|
127 |
{ -1.5-X,-0.5, 1.5 }, |
|
128 |
{ 0.0,-0.5, 1.5 }, |
|
129 |
{ 0.0,-0.5,-1.5 }, |
|
130 |
{ -1.5+X,-0.5,-1.5 } |
|
131 |
}; |
|
132 | 132 |
|
133 | 133 |
private static final int[][] VERT_INDEXES_MIDDLE = new int[][] |
134 |
{
|
|
135 |
{0,1,2,3}, // counterclockwise!
|
|
136 |
{4,5,6,7},
|
|
137 |
{4,5,1,0},
|
|
138 |
{5,6,2,1},
|
|
139 |
{6,7,3,2},
|
|
140 |
{7,4,0,3}
|
|
141 |
};
|
|
134 |
{ |
|
135 |
{0,1,2,3}, // counterclockwise! |
|
136 |
{4,5,6,7}, |
|
137 |
{4,5,1,0}, |
|
138 |
{5,6,2,1}, |
|
139 |
{6,7,3,2}, |
|
140 |
{7,4,0,3} |
|
141 |
}; |
|
142 | 142 |
|
143 | 143 |
private static final double[][] VERTICES_EDGE = new double[][] |
144 |
{
|
|
145 |
{ -X, 0.5, 0.0 },
|
|
146 |
{ +X, 0.5, 0.0 },
|
|
147 |
{0.0, 0.5,-1.5 },
|
|
148 |
{ -X,-0.5, 0.0 },
|
|
149 |
{ +X,-0.5, 0.0 },
|
|
150 |
{0.0,-0.5,-1.5 },
|
|
151 |
};
|
|
144 |
{ |
|
145 |
{ -X, 0.5, 0.0 }, |
|
146 |
{ +X, 0.5, 0.0 }, |
|
147 |
{0.0, 0.5,-1.5 }, |
|
148 |
{ -X,-0.5, 0.0 }, |
|
149 |
{ +X,-0.5, 0.0 }, |
|
150 |
{0.0,-0.5,-1.5 }, |
|
151 |
}; |
|
152 | 152 |
|
153 | 153 |
private static final int[][] VERT_INDEXES_EDGE = new int[][] |
154 |
{
|
|
155 |
{0,1,2}, // counterclockwise!
|
|
156 |
{3,4,5},
|
|
157 |
{3,4,1,0},
|
|
158 |
{4,5,2,1},
|
|
159 |
{5,3,0,2}
|
|
160 |
};
|
|
154 |
{ |
|
155 |
{0,1,2}, // counterclockwise! |
|
156 |
{3,4,5}, |
|
157 |
{3,4,1,0}, |
|
158 |
{4,5,2,1}, |
|
159 |
{5,3,0,2} |
|
160 |
}; |
|
161 | 161 |
|
162 | 162 |
private static final double[][] VERTICES_CORNER = new double[][] |
163 |
{
|
|
164 |
{ X-1.5, 0.5, 0.0 },
|
|
165 |
{ 0.0, 0.5, 0.0 },
|
|
166 |
{ 0.0, 0.5,X-1.5 },
|
|
167 |
{ -1.5, 0.5, -1.5 },
|
|
168 |
{ X-1.5,-0.5, 0.0 },
|
|
169 |
{ 0.0,-0.5, 0.0 },
|
|
170 |
{ 0.0,-0.5,X-1.5 },
|
|
171 |
{ -1.5,-0.5, -1.5 }
|
|
172 |
};
|
|
163 |
{ |
|
164 |
{ X-1.5, 0.5, 0.0 }, |
|
165 |
{ 0.0, 0.5, 0.0 }, |
|
166 |
{ 0.0, 0.5,X-1.5 }, |
|
167 |
{ -1.5, 0.5, -1.5 }, |
|
168 |
{ X-1.5,-0.5, 0.0 }, |
|
169 |
{ 0.0,-0.5, 0.0 }, |
|
170 |
{ 0.0,-0.5,X-1.5 }, |
|
171 |
{ -1.5,-0.5, -1.5 } |
|
172 |
}; |
|
173 | 173 |
|
174 | 174 |
private static final int[][] VERT_INDEXES_CORNER = new int[][] |
175 |
{
|
|
176 |
{0,1,2,3}, // counterclockwise!
|
|
177 |
{4,5,6,7},
|
|
178 |
{4,5,1,0},
|
|
179 |
{5,6,2,1},
|
|
180 |
{7,4,0,3},
|
|
181 |
{6,7,3,2}
|
|
182 |
};
|
|
175 |
{ |
|
176 |
{0,1,2,3}, // counterclockwise! |
|
177 |
{4,5,6,7}, |
|
178 |
{4,5,1,0}, |
|
179 |
{5,6,2,1}, |
|
180 |
{7,4,0,3}, |
|
181 |
{6,7,3,2} |
|
182 |
}; |
|
183 | 183 |
|
184 | 184 |
private static final float[][] STICKERS = new float[][] |
185 |
{
|
|
186 |
{ -0.5f, -0.26289170f, 0.5f, -0.26289170f, 0.5f, 0.26289170f, -0.5f, 0.26289170f }, // middle front
|
|
187 |
{ -0.5f, -0.16666667f, 0.5f, -0.16666667f, 0.5f, 0.16666667f, -0.5f, 0.16666667f }, // middle right
|
|
188 |
{ -0.5f, -0.45534182f, 0.5f, -0.45534182f, 0.5f, 0.45534182f, -0.5f, 0.45534182f }, // middle back
|
|
189 |
{ -0.20096192f, -0.25f, 0.20096192f, -0.25f, 0.0f, 0.5f }, // edge top
|
|
190 |
{ -0.40192384f, -0.5f, 0.40192384f, -0.5f, 0.40192384f, 0.5f, -0.40192384f, 0.5f }, // edge face
|
|
191 |
{ -0.2637079f, -0.38185397f, 0.38185397f, -0.38185397f, 0.38185397f, 0.2637079f, -0.5f, 0.5f } // corner top
|
|
192 |
};
|
|
185 |
{ |
|
186 |
{ -0.5f, -0.26289170f, 0.5f, -0.26289170f, 0.5f, 0.26289170f, -0.5f, 0.26289170f }, // middle front |
|
187 |
{ -0.5f, -0.16666667f, 0.5f, -0.16666667f, 0.5f, 0.16666667f, -0.5f, 0.16666667f }, // middle right |
|
188 |
{ -0.5f, -0.45534182f, 0.5f, -0.45534182f, 0.5f, 0.45534182f, -0.5f, 0.45534182f }, // middle back |
|
189 |
{ -0.20096192f, -0.25f, 0.20096192f, -0.25f, 0.0f, 0.5f }, // edge top |
|
190 |
{ -0.40192384f, -0.5f, 0.40192384f, -0.5f, 0.40192384f, 0.5f, -0.40192384f, 0.5f }, // edge face |
|
191 |
{ -0.2637079f, -0.38185397f, 0.38185397f, -0.38185397f, 0.38185397f, 0.2637079f, -0.5f, 0.5f } // corner top |
|
192 |
}; |
|
193 | 193 |
|
194 | 194 |
private static final int NUM_ST = STICKERS.length; |
195 | 195 |
|
196 | 196 |
private static final int[][] mStickerType = new int[][] |
197 |
{
|
|
198 |
{ NUM_ST,NUM_ST,0, 1, 2,NUM_ST },
|
|
199 |
{ 3,NUM_ST,4,NUM_ST,NUM_ST,NUM_ST },
|
|
200 |
{ 5,NUM_ST,2, 2,NUM_ST,NUM_ST }
|
|
201 |
};
|
|
197 |
{ |
|
198 |
{ NUM_ST,NUM_ST,0, 1, 2,NUM_ST }, |
|
199 |
{ 3,NUM_ST,4,NUM_ST,NUM_ST,NUM_ST }, |
|
200 |
{ 5,NUM_ST,2, 2,NUM_ST,NUM_ST } |
|
201 |
}; |
|
202 | 202 |
|
203 | 203 |
// YELLOW 0 WHITE 1 BLUE 2 GREEN 3 RED 4 ORANGE 5 |
204 | 204 |
private static final int[][] mStickerColor = new int[][] |
205 |
{
|
|
206 |
{ 0, 0, 4, 0, 5, 0 },
|
|
207 |
{ 0, 0, 5, 1, 4, 0 },
|
|
208 |
|
|
209 |
{ 2, 0, 4, 0, 0, 0 },
|
|
210 |
{ 2, 0, 0, 0, 0, 0 },
|
|
211 |
{ 2, 0, 5, 0, 0, 0 },
|
|
212 |
{ 2, 0, 1, 0, 0, 0 },
|
|
213 |
{ 3, 0, 4, 0, 0, 0 },
|
|
214 |
{ 3, 0, 0, 0, 0, 0 },
|
|
215 |
{ 3, 0, 5, 0, 0, 0 },
|
|
216 |
{ 3, 0, 1, 0, 0, 0 },
|
|
217 |
|
|
218 |
{ 2, 0, 4, 0, 0, 0 },
|
|
219 |
{ 2, 0, 0, 5, 0, 0 },
|
|
220 |
{ 2, 0, 5, 1, 0, 0 },
|
|
221 |
{ 2, 0, 1, 4, 0, 0 },
|
|
222 |
{ 3, 0, 0, 4, 0, 0 },
|
|
223 |
{ 3, 0, 5, 0, 0, 0 },
|
|
224 |
{ 3, 0, 1, 5, 0, 0 },
|
|
225 |
{ 3, 0, 4, 1, 0, 0 },
|
|
226 |
};
|
|
205 |
{ |
|
206 |
{ 0, 0, 4, 0, 5, 0 }, |
|
207 |
{ 0, 0, 5, 1, 4, 0 }, |
|
208 |
|
|
209 |
{ 2, 0, 4, 0, 0, 0 }, |
|
210 |
{ 2, 0, 0, 0, 0, 0 }, |
|
211 |
{ 2, 0, 5, 0, 0, 0 }, |
|
212 |
{ 2, 0, 1, 0, 0, 0 }, |
|
213 |
{ 3, 0, 4, 0, 0, 0 }, |
|
214 |
{ 3, 0, 0, 0, 0, 0 }, |
|
215 |
{ 3, 0, 5, 0, 0, 0 }, |
|
216 |
{ 3, 0, 1, 0, 0, 0 }, |
|
217 |
|
|
218 |
{ 2, 0, 4, 0, 0, 0 }, |
|
219 |
{ 2, 0, 0, 5, 0, 0 }, |
|
220 |
{ 2, 0, 5, 1, 0, 0 }, |
|
221 |
{ 2, 0, 1, 4, 0, 0 }, |
|
222 |
{ 3, 0, 0, 4, 0, 0 }, |
|
223 |
{ 3, 0, 5, 0, 0, 0 }, |
|
224 |
{ 3, 0, 1, 5, 0, 0 }, |
|
225 |
{ 3, 0, 4, 1, 0, 0 }, |
|
226 |
}; |
|
227 | 227 |
|
228 | 228 |
private static MeshBase[] mMeshes; |
229 | 229 |
|
230 | 230 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
231 | 231 |
|
232 |
TwistySquare1(int size, Static4D quat, DistortedTexture texture, |
|
233 |
MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
|
232 |
TwistySquare1(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
|
|
233 |
DistortedEffects effects, int[][] moves, Resources res, int scrWidth) |
|
234 | 234 |
{ |
235 | 235 |
super(size, size, quat, texture, mesh, effects, moves, ObjectList.SQU1, res, scrWidth); |
236 | 236 |
} |
... | ... | |
389 | 389 |
return FACE_COLORS.length; |
390 | 390 |
} |
391 | 391 |
|
392 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
393 |
// TODO |
|
394 |
|
|
395 |
float[] getCuts(int numLayers) |
|
396 |
{ |
|
397 |
float[] cuts = new float[numLayers-1]; |
|
398 |
|
|
399 |
for(int i=0; i<numLayers-1; i++) |
|
400 |
{ |
|
401 |
cuts[i] = (2-numLayers)*0.5f + i; |
|
402 |
} |
|
403 |
|
|
404 |
return cuts; |
|
405 |
} |
|
406 |
|
|
407 | 392 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
408 | 393 |
|
409 | 394 |
int getNumStickerTypes(int numLayers) |
... | ... | |
445 | 430 |
return 1.0f; |
446 | 431 |
} |
447 | 432 |
|
433 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
434 |
// TODO |
|
435 |
|
|
436 |
float[] getCuts(int numLayers) |
|
437 |
{ |
|
438 |
float[] cuts = new float[numLayers-1]; |
|
439 |
|
|
440 |
for(int i=0; i<numLayers-1; i++) |
|
441 |
{ |
|
442 |
cuts[i] = (2-numLayers)*0.5f + i; |
|
443 |
} |
|
444 |
|
|
445 |
return cuts; |
|
446 |
} |
|
447 |
|
|
448 | 448 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
449 | 449 |
// PUBLIC API |
450 | 450 |
|
... | ... | |
468 | 468 |
{ |
469 | 469 |
if( num==0 ) |
470 | 470 |
{ |
471 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
471 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
472 | 472 |
} |
473 | 473 |
else |
474 | 474 |
{ |
475 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
475 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
476 | 476 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
477 | 477 |
} |
478 | 478 |
|
src/main/java/org/distorted/objects/TwistyUltimate.java | ||
---|---|---|
445 | 445 |
{ |
446 | 446 |
if( num==0 ) |
447 | 447 |
{ |
448 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
448 |
scramble[num][0] = rnd.nextInt(NUM_AXIS);
|
|
449 | 449 |
} |
450 | 450 |
else |
451 | 451 |
{ |
452 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
452 |
int newVector = rnd.nextInt(NUM_AXIS -1);
|
|
453 | 453 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
454 | 454 |
} |
455 | 455 |
|
Also available in: Unified diff
Hide more stuff in the TwistyObject class.