Revision 7403cdfa
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/objects/RubikCube.java | ||
---|---|---|
165 | 165 |
return FACE_COLORS.length; |
166 | 166 |
} |
167 | 167 |
|
168 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
169 |
|
|
170 |
float getBasicStep() |
|
171 |
{ |
|
172 |
return 1.0f; |
|
173 |
} |
|
174 |
|
|
168 | 175 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
169 | 176 |
|
170 | 177 |
int getNumStickerTypes() |
src/main/java/org/distorted/objects/RubikDino.java | ||
---|---|---|
271 | 271 |
return FACE_COLORS.length; |
272 | 272 |
} |
273 | 273 |
|
274 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
275 |
|
|
276 |
float getBasicStep() |
|
277 |
{ |
|
278 |
return SQ3; |
|
279 |
} |
|
280 |
|
|
274 | 281 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
275 | 282 |
|
276 | 283 |
int getNumStickerTypes() |
src/main/java/org/distorted/objects/RubikHelicopter.java | ||
---|---|---|
474 | 474 |
|
475 | 475 |
float getScreenRatio() |
476 | 476 |
{ |
477 |
return 2.0f;
|
|
477 |
return 1.5f;
|
|
478 | 478 |
} |
479 | 479 |
|
480 | 480 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
498 | 498 |
return 1; |
499 | 499 |
} |
500 | 500 |
|
501 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
502 |
|
|
503 |
float getBasicStep() |
|
504 |
{ |
|
505 |
return SQ2/2; |
|
506 |
} |
|
507 |
|
|
501 | 508 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
502 | 509 |
|
503 | 510 |
int getNumCubitFaces() |
... | ... | |
620 | 627 |
|
621 | 628 |
public int computeRowFromOffset(float offset) |
622 | 629 |
{ |
623 |
return offset<0.125f ? 0:3;
|
|
630 |
return offset<0.166f ? 0:2;
|
|
624 | 631 |
} |
625 | 632 |
|
626 | 633 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/RubikMovementHelicopter.java | ||
---|---|---|
25 | 25 |
{ |
26 | 26 |
RubikMovementHelicopter() |
27 | 27 |
{ |
28 |
super(RubikHelicopter.ROT_AXIS, RubikHelicopter.FACE_AXIS, 0.125f, 0.125f);
|
|
28 |
super(RubikHelicopter.ROT_AXIS, RubikHelicopter.FACE_AXIS, 0.166f, 0.166f);
|
|
29 | 29 |
} |
30 | 30 |
|
31 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
50 | 50 |
|
51 | 51 |
boolean isInsideFace(float[] p) |
52 | 52 |
{ |
53 |
return ( p[0]<=0.125f && p[0]>=-0.125f && p[1]<=0.125f && p[1]>=-0.125f );
|
|
53 |
return ( p[0]<=0.166f && p[0]>=-0.166f && p[1]<=0.166f && p[1]>=-0.166f );
|
|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
61 | 61 |
|
62 | 62 |
int quarter = getQuarter(touchPoint); |
63 | 63 |
|
64 |
|
|
65 |
android.util.Log.e("heli", "point= "+touchPoint[0]+" "+touchPoint[1]+" face="+face+" q:"+quarter); |
|
66 |
|
|
67 | 64 |
switch(face) |
68 | 65 |
{ |
69 | 66 |
case 0: switch(quarter) |
src/main/java/org/distorted/objects/RubikObject.java | ||
---|---|---|
59 | 59 |
private static final float MAX_SIZE_CHANGE = 1.3f; |
60 | 60 |
private static final float MIN_SIZE_CHANGE = 0.8f; |
61 | 61 |
|
62 |
private static boolean mCreateFromDMesh = true;
|
|
62 |
private static boolean mCreateFromDMesh = false;
|
|
63 | 63 |
|
64 | 64 |
private static final Static3D CENTER = new Static3D(0,0,0); |
65 | 65 |
static final int INTERIOR_COLOR = 0xff000000; |
... | ... | |
74 | 74 |
final int NUM_CUBIT_FACES; |
75 | 75 |
final int NUM_AXIS; |
76 | 76 |
final int NUM_CUBITS; |
77 |
final float BASIC_STEP; |
|
77 | 78 |
|
78 | 79 |
private static float mInitScreenRatio,mObjectScreenRatio; |
79 | 80 |
|
... | ... | |
124 | 125 |
NUM_FACES = getNumFaces(); |
125 | 126 |
NUM_CUBIT_FACES = getNumCubitFaces(); |
126 | 127 |
NUM_TEXTURES = getNumStickerTypes()*NUM_FACES; |
128 |
BASIC_STEP = getBasicStep(); |
|
127 | 129 |
|
128 | 130 |
mSize = size; |
129 | 131 |
computeStartAndStep(mOrigPos); |
... | ... | |
274 | 276 |
} |
275 | 277 |
|
276 | 278 |
mStart = min; |
277 |
mStep = (max-min+1.0f)/mSize;
|
|
279 |
mStep = (max-min+BASIC_STEP)/mSize;
|
|
278 | 280 |
} |
279 | 281 |
|
280 | 282 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
695 | 697 |
abstract int getFaceColor(int cubit, int cubitface, int size); |
696 | 698 |
abstract float returnMultiplier(); |
697 | 699 |
abstract float[] getRowChances(); |
700 |
abstract float getBasicStep(); |
|
698 | 701 |
|
699 | 702 |
public abstract boolean isSolved(); |
700 | 703 |
public abstract Static3D[] getRotationAxis(); |
src/main/java/org/distorted/objects/RubikObjectList.java | ||
---|---|---|
77 | 77 |
|
78 | 78 |
HELI ( |
79 | 79 |
new int[][] { |
80 |
{4 , 18, R.raw.skewb, R.drawable.ui_small_skewb, R.drawable.ui_medium_skewb, R.drawable.ui_big_skewb, R.drawable.ui_huge_skewb} ,
|
|
80 |
{3 , 18, R.raw.skewb, R.drawable.ui_small_skewb, R.drawable.ui_medium_skewb, R.drawable.ui_big_skewb, R.drawable.ui_huge_skewb} ,
|
|
81 | 81 |
}, |
82 | 82 |
RubikHelicopter.class, |
83 | 83 |
new RubikMovementHelicopter(), |
src/main/java/org/distorted/objects/RubikPyraminx.java | ||
---|---|---|
228 | 228 |
return 1; |
229 | 229 |
} |
230 | 230 |
|
231 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
232 |
|
|
233 |
float getBasicStep() |
|
234 |
{ |
|
235 |
return SQ6/3; |
|
236 |
} |
|
237 |
|
|
231 | 238 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
232 | 239 |
|
233 | 240 |
int getNumCubitFaces() |
... | ... | |
446 | 453 |
} |
447 | 454 |
|
448 | 455 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
449 |
// I don't quite understand it, but 0.82 works better than the theoretically correct SQ3/2 ( 0.866 )
|
|
456 |
// SQ6/3 = height of the tetrahedron
|
|
450 | 457 |
|
451 | 458 |
float returnMultiplier() |
452 | 459 |
{ |
453 |
return getSize()/0.82f;//(SQ3/2);
|
|
460 |
return getSize()/(SQ6/3);
|
|
454 | 461 |
} |
455 | 462 |
|
456 | 463 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
487 | 494 |
} |
488 | 495 |
|
489 | 496 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
490 |
// 0.82?? see returnMultiplier() |
|
491 | 497 |
|
492 | 498 |
public int computeRowFromOffset(float offset) |
493 | 499 |
{ |
494 |
return (int)(getSize()*offset/0.82f);
|
|
500 |
return (int)(getSize()*offset/(SQ6/3));
|
|
495 | 501 |
} |
496 | 502 |
|
497 | 503 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/RubikSkewb.java | ||
---|---|---|
405 | 405 |
return 2; |
406 | 406 |
} |
407 | 407 |
|
408 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
409 |
|
|
410 |
float getBasicStep() |
|
411 |
{ |
|
412 |
return SQ3; |
|
413 |
} |
|
414 |
|
|
408 | 415 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
409 | 416 |
|
410 | 417 |
int getNumCubitFaces() |
Also available in: Unified diff
Fix rotations of the Helicopter.