Revision 60bed292
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/objectlib/objects/TwistyMixup.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import org.distorted.library.type.Static3D; |
23 | 23 |
import org.distorted.library.type.Static4D; |
24 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
|
25 |
import org.distorted.objectlib.helpers.ObjectShape; |
|
26 |
import org.distorted.objectlib.helpers.ObjectSignature; |
|
27 |
import org.distorted.objectlib.main.ObjectType; |
|
28 | 24 |
import org.distorted.objectlib.main.ShapeHexahedron; |
29 | 25 |
import org.distorted.objectlib.scrambling.ScrambleState; |
30 | 26 |
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron; |
... | ... | |
36 | 32 |
|
37 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 34 |
|
39 |
public class TwistyMixup extends ShapeHexahedron
|
|
35 |
abstract class TwistyMixup extends ShapeHexahedron
|
|
40 | 36 |
{ |
41 | 37 |
static final Static3D[] ROT_AXIS = new Static3D[] |
42 | 38 |
{ |
... | ... | |
45 | 41 |
new Static3D(0,0,1) |
46 | 42 |
}; |
47 | 43 |
|
48 |
private ScrambleState[] mStates;
|
|
49 |
private int[][] mBasicAngle;
|
|
50 |
private float[][] mCuts;
|
|
51 |
private float[][] mPosition;
|
|
52 |
private int[] mQuatIndex;
|
|
44 |
ScrambleState[] mStates; |
|
45 |
int[][] mBasicAngle; |
|
46 |
float[][] mCuts; |
|
47 |
float[][] mPosition; |
|
48 |
int[] mQuatIndex; |
|
53 | 49 |
|
54 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
55 | 51 |
|
... | ... | |
368 | 364 |
return mStates; |
369 | 365 |
} |
370 | 366 |
|
371 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
372 |
|
|
373 |
public float[][] getCuts(int[] numLayers) |
|
374 |
{ |
|
375 |
if( mCuts==null ) |
|
376 |
{ |
|
377 |
float C = 1.5f*(SQ2-1); |
|
378 |
float[] cut = new float[] {-C,+C}; |
|
379 |
mCuts = new float[][] { cut,cut,cut }; |
|
380 |
} |
|
381 |
|
|
382 |
return mCuts; |
|
383 |
} |
|
384 |
|
|
385 | 367 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
386 | 368 |
|
387 | 369 |
public boolean[][] getLayerRotatable(int[] numLayers) |
... | ... | |
425 | 407 |
return TouchControlHexahedron.FACE_AXIS; |
426 | 408 |
} |
427 | 409 |
|
428 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
429 |
|
|
430 |
public float[][] getCubitPositions(int[] numLayers) |
|
431 |
{ |
|
432 |
if( mPosition==null ) |
|
433 |
{ |
|
434 |
float SHORT_EDGE = 1.5f-0.75f*SQ2; |
|
435 |
float LONG_EDGE = 1.5f*(SQ2-1); |
|
436 |
|
|
437 |
final float DIST_CORNER = LONG_EDGE+SHORT_EDGE; |
|
438 |
final float DIST_EDGE = LONG_EDGE+SHORT_EDGE; |
|
439 |
final float DIST_CENTER = LONG_EDGE+SHORT_EDGE; |
|
440 |
|
|
441 |
mPosition = new float[][] |
|
442 |
{ |
|
443 |
{ DIST_CORNER, DIST_CORNER, DIST_CORNER }, |
|
444 |
{ DIST_CORNER, DIST_CORNER,-DIST_CORNER }, |
|
445 |
{ DIST_CORNER,-DIST_CORNER, DIST_CORNER }, |
|
446 |
{ DIST_CORNER,-DIST_CORNER,-DIST_CORNER }, |
|
447 |
{-DIST_CORNER, DIST_CORNER, DIST_CORNER }, |
|
448 |
{-DIST_CORNER, DIST_CORNER,-DIST_CORNER }, |
|
449 |
{-DIST_CORNER,-DIST_CORNER, DIST_CORNER }, |
|
450 |
{-DIST_CORNER,-DIST_CORNER,-DIST_CORNER }, |
|
451 |
|
|
452 |
{ 0.0f, DIST_EDGE, DIST_EDGE }, |
|
453 |
{ DIST_EDGE, 0.0f, DIST_EDGE }, |
|
454 |
{ 0.0f,-DIST_EDGE, DIST_EDGE }, |
|
455 |
{-DIST_EDGE, 0.0f, DIST_EDGE }, |
|
456 |
{ DIST_EDGE, DIST_EDGE, 0.0f }, |
|
457 |
{ DIST_EDGE,-DIST_EDGE, 0.0f }, |
|
458 |
{-DIST_EDGE,-DIST_EDGE, 0.0f }, |
|
459 |
{-DIST_EDGE, DIST_EDGE, 0.0f }, |
|
460 |
{ 0.0f, DIST_EDGE,-DIST_EDGE }, |
|
461 |
{ DIST_EDGE, 0.0f,-DIST_EDGE }, |
|
462 |
{ 0.0f,-DIST_EDGE,-DIST_EDGE }, |
|
463 |
{-DIST_EDGE, 0.0f,-DIST_EDGE }, |
|
464 |
|
|
465 |
{ 0, 0, DIST_CENTER }, |
|
466 |
{ 0, 0,-DIST_CENTER }, |
|
467 |
{ 0, DIST_CENTER, 0 }, |
|
468 |
{ 0,-DIST_CENTER, 0 }, |
|
469 |
{ DIST_CENTER, 0, 0 }, |
|
470 |
{-DIST_CENTER, 0, 0 }, |
|
471 |
}; |
|
472 |
} |
|
473 |
|
|
474 |
return mPosition; |
|
475 |
} |
|
476 |
|
|
477 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
478 |
|
|
479 |
public Static4D getCubitQuats(int cubit, int[] numLayers) |
|
480 |
{ |
|
481 |
if( mQuatIndex==null ) |
|
482 |
{ |
|
483 |
mQuatIndex = new int[] { 0,10,11,3,6,2,1,8, |
|
484 |
0,4,11,5,7,12,13,6,10,20,3,18, |
|
485 |
0,3,10,11,7,6 }; |
|
486 |
} |
|
487 |
|
|
488 |
return mObjectQuats[mQuatIndex[cubit]]; |
|
489 |
} |
|
490 |
|
|
491 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
492 |
|
|
493 |
public ObjectShape getObjectShape(int variant) |
|
494 |
{ |
|
495 |
float SHORT_EDGE = 1.5f-0.75f*SQ2; |
|
496 |
float LONG_EDGE = 1.5f*(SQ2-1); |
|
497 |
float X = variant==0 ? SHORT_EDGE : LONG_EDGE; |
|
498 |
float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE; |
|
499 |
float Z = SHORT_EDGE; |
|
500 |
|
|
501 |
float[][] vertices = |
|
502 |
{ |
|
503 |
{ -X,-Y,-Z }, |
|
504 |
{ -X,-Y,+Z }, |
|
505 |
{ -X,+Y,-Z }, |
|
506 |
{ -X,+Y,+Z }, |
|
507 |
{ +X,-Y,-Z }, |
|
508 |
{ +X,-Y,+Z }, |
|
509 |
{ +X,+Y,-Z }, |
|
510 |
{ +X,+Y,+Z }, |
|
511 |
}; |
|
512 |
|
|
513 |
int[][] indices = |
|
514 |
{ |
|
515 |
{1,5,7,3}, |
|
516 |
{3,7,6,2}, |
|
517 |
{5,4,6,7}, |
|
518 |
{0,1,3,2}, |
|
519 |
{4,0,2,6}, |
|
520 |
{0,4,5,1} |
|
521 |
}; |
|
522 |
|
|
523 |
return new ObjectShape(vertices, indices); |
|
524 |
} |
|
525 |
|
|
526 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
527 |
|
|
528 |
public ObjectFaceShape getObjectFaceShape(int variant) |
|
529 |
{ |
|
530 |
float h1 = isInIconMode() ? 0.001f : 0.06f; |
|
531 |
float h2 = 0.001f; |
|
532 |
float[][] bands = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} }; |
|
533 |
float[][] centers = { { 0.0f, 0.0f, 0.0f} }; |
|
534 |
float[][] corners = { {0.04f,0.10f} }; |
|
535 |
|
|
536 |
if( variant==0 ) |
|
537 |
{ |
|
538 |
int[] bandIndices = { 0,0,0,1,1,1 }; |
|
539 |
int[] indices = { -1,0,0,0,0,0,0,0 }; |
|
540 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null); |
|
541 |
} |
|
542 |
if( variant==1 ) |
|
543 |
{ |
|
544 |
int[] bandIndices = { 0,0,1,1,1,1 }; |
|
545 |
int[] indices = { -1,0,0,0,-1,0,0,0 }; |
|
546 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null); |
|
547 |
} |
|
548 |
else |
|
549 |
{ |
|
550 |
int[] bandIndices = { 0,1,1,1,1,1 }; |
|
551 |
int[] indices = { -1,0,-1,0,-1,0,-1,0 }; |
|
552 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null); |
|
553 |
} |
|
554 |
} |
|
555 |
|
|
556 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
557 |
|
|
558 |
public int getNumCubitVariants(int[] numLayers) |
|
559 |
{ |
|
560 |
return 3; |
|
561 |
} |
|
562 |
|
|
563 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
564 |
|
|
565 |
public int getCubitVariant(int cubit, int[] numLayers) |
|
566 |
{ |
|
567 |
return cubit<8 ? 0 : (cubit<20?1:2); |
|
568 |
} |
|
569 |
|
|
570 | 410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
571 | 411 |
|
572 | 412 |
public float getStickerRadius() |
... | ... | |
608 | 448 |
|
609 | 449 |
return mBasicAngle; |
610 | 450 |
} |
611 |
|
|
612 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
613 |
|
|
614 |
public String getShortName() |
|
615 |
{ |
|
616 |
return ObjectType.MIXU_3.name(); |
|
617 |
} |
|
618 |
|
|
619 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
620 |
|
|
621 |
public ObjectSignature getSignature() |
|
622 |
{ |
|
623 |
return new ObjectSignature(ObjectType.MIXU_3); |
|
624 |
} |
|
625 |
|
|
626 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
627 |
|
|
628 |
public String getObjectName() |
|
629 |
{ |
|
630 |
return "Mixup Cube"; |
|
631 |
} |
|
632 |
|
|
633 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
634 |
|
|
635 |
public String getInventor() |
|
636 |
{ |
|
637 |
return "Sergey Makarov"; |
|
638 |
} |
|
639 |
|
|
640 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
641 |
|
|
642 |
public int getYearOfInvention() |
|
643 |
{ |
|
644 |
return 1985; |
|
645 |
} |
|
646 |
|
|
647 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
648 |
|
|
649 |
public int getComplexity() |
|
650 |
{ |
|
651 |
return 2; |
|
652 |
} |
|
653 |
|
|
654 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
655 |
|
|
656 |
public String[][] getTutorials() |
|
657 |
{ |
|
658 |
return new String[][]{ |
|
659 |
{"gb","w0DmJYwNI3Q","How to Solve the Mixup Cube","Z3"}, |
|
660 |
{"es","wHyf1imdAi4","Resolver Mixup 3x3","Cuby"}, |
|
661 |
{"ru","PN2ntFP6sfs","Как собрать Mixup","Цель+Действие=Результат"}, |
|
662 |
{"fr","QWsFaw0zUJU","Résolution du Mixup Cube","skieur cubb"}, |
|
663 |
{"de","vvDPyByyLyQ","Lösung für den 3x3x3 Mixup Cube","rofrisch"}, |
|
664 |
{"pl","TpG6MzWmwLQ","Mixup 3x3x3 Cube Tutorial","MrUK"}, |
|
665 |
{"br","_63j3i4Xa78","3x3 Mixup cube Tutorial 1/3","Cubo vicio"}, |
|
666 |
{"br","qpTnQavPLEI","3x3 Mixup cube Tutorial 2/3","Cubo vicio"}, |
|
667 |
{"br","nrFEm1ygcV4","3x3 Mixup cube Tutorial 3/3","Cubo vicio"}, |
|
668 |
{"kr","Ag4XkmC2v6c","3x3x3 믹스업 (Mix-up) 큐브 해법","듀나메스 큐브 해법연구소"}, |
|
669 |
{"vn","mWW6HYbvvh8","Mixup 3x3 Tutorial","VĂN CÔNG TÙNG"}, |
|
670 |
}; |
|
671 |
} |
|
672 | 451 |
} |
Also available in: Unified diff
Mixup Plus Cube: beginnings