Project

General

Profile

« Previous | Next » 

Revision 59c20632

Added by Leszek Koltunski over 2 years ago

Reorg for writing the JSON

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyMinx.java
19 19

  
20 20
package org.distorted.objectlib.objects;
21 21

  
22
import static org.distorted.objectlib.main.Movement.MOVEMENT_DODECAHEDRON;
22 23
import static org.distorted.objectlib.main.Movement.TYPE_SPLIT_EDGE;
23 24
import static org.distorted.objectlib.main.Movement12.C2;
24 25
import static org.distorted.objectlib.main.Movement12.LEN;
......
31 32
import org.distorted.library.mesh.MeshSquare;
32 33
import org.distorted.library.type.Static3D;
33 34
import org.distorted.library.type.Static4D;
34
import org.distorted.objectlib.main.Movement;
35 35
import org.distorted.objectlib.main.Movement12;
36 36
import org.distorted.objectlib.helpers.ObjectSticker;
37 37
import org.distorted.objectlib.helpers.ScrambleState;
......
61 61
           new Static3D( SIN54/LEN,    0     ,   -C2/LEN )
62 62
         };
63 63

  
64
  private static final int[][][] ENABLED = new int[][][]
65
      {
66
          {{2,3},{3,5},{1,5},{1,4},{2,4}},
67
          {{0,5},{2,5},{2,3},{3,4},{0,4}},
68
          {{2,3},{2,5},{0,5},{0,4},{3,4}},
69
          {{1,5},{3,5},{2,3},{2,4},{1,4}},
70
          {{0,3},{0,4},{4,5},{1,5},{1,3}},
71
          {{1,2},{1,4},{4,5},{0,5},{0,2}},
72
          {{4,5},{1,4},{1,2},{0,2},{0,5}},
73
          {{4,5},{0,4},{0,3},{1,3},{1,5}},
74
          {{0,2},{0,1},{1,3},{3,5},{2,5}},
75
          {{3,4},{2,4},{1,2},{0,1},{0,3}},
76
          {{2,4},{3,4},{0,3},{0,1},{1,2}},
77
          {{1,3},{0,1},{0,2},{2,5},{3,5}},
78
      };
79

  
80 64
  private ScrambleState[] mStates;
81 65
  private int[] mBasicAngle;
82 66
  private int[] mFaceMap;
83 67
  private float[][] mCuts;
84
  private boolean[][] mLayerRotatable;
85
  private Movement mMovement;
86 68
  Static4D[] mQuats;
87 69
  float[][] mCenterCoords;
88 70
  float[][] mCorners;
......
566 548

  
567 549
///////////////////////////////////////////////////////////////////////////////////////////////////
568 550

  
569
  private void getLayerRotatable(int[] numLayers)
551
  public boolean[][] getLayerRotatable(int[] numLayers)
570 552
    {
571
    if( mLayerRotatable==null )
572
      {
573
      int numAxis = ROT_AXIS.length;
574
      mLayerRotatable = new boolean[numAxis][];
553
    int numAxis = ROT_AXIS.length;
554
    boolean[][] layerRotatable = new boolean[numAxis][];
575 555

  
576
      for(int i=0; i<numAxis; i++)
577
        {
578
        mLayerRotatable[i] = new boolean[numLayers[i]];
579
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
580
        mLayerRotatable[i][numLayers[i]/2] = false;
581
        }
556
    for(int i=0; i<numAxis; i++)
557
      {
558
      layerRotatable[i] = new boolean[numLayers[i]];
559
      for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
560
      layerRotatable[i][numLayers[i]/2] = false;
582 561
      }
562

  
563
    return layerRotatable;
583 564
    }
584 565

  
585 566
///////////////////////////////////////////////////////////////////////////////////////////////////
586 567

  
587
  protected int getSolvedFunctionIndex()
568
  public int getMovementType()
588 569
    {
589
    return 0;
570
    return MOVEMENT_DODECAHEDRON;
590 571
    }
591 572

  
592 573
///////////////////////////////////////////////////////////////////////////////////////////////////
593 574

  
594
  protected int getNumCubitFaces()
575
  public int getMovementSplit()
595 576
    {
596
    return 6;
577
    return TYPE_SPLIT_EDGE;
597 578
    }
598 579

  
599 580
///////////////////////////////////////////////////////////////////////////////////////////////////
600
// PUBLIC API
601 581

  
602
  public Static3D[] getRotationAxis()
582
  public int[][][] getEnabled()
603 583
    {
604
    return ROT_AXIS;
584
    return new int[][][]
585
      {
586
          {{2,3},{3,5},{1,5},{1,4},{2,4}},
587
          {{0,5},{2,5},{2,3},{3,4},{0,4}},
588
          {{2,3},{2,5},{0,5},{0,4},{3,4}},
589
          {{1,5},{3,5},{2,3},{2,4},{1,4}},
590
          {{0,3},{0,4},{4,5},{1,5},{1,3}},
591
          {{1,2},{1,4},{4,5},{0,5},{0,2}},
592
          {{4,5},{1,4},{1,2},{0,2},{0,5}},
593
          {{4,5},{0,4},{0,3},{1,3},{1,5}},
594
          {{0,2},{0,1},{1,3},{3,5},{2,5}},
595
          {{3,4},{2,4},{1,2},{0,1},{0,3}},
596
          {{2,4},{3,4},{0,3},{0,1},{1,2}},
597
          {{1,3},{0,1},{0,2},{2,5},{3,5}},
598
      };
605 599
    }
606 600

  
607 601
///////////////////////////////////////////////////////////////////////////////////////////////////
608 602

  
609
  public Movement getMovement()
603
  public float[] getDist3D(int[] numLayers)
610 604
    {
611
    if( mMovement==null )
612
      {
613
      int[] numLayers = getNumLayers();
614
      if( mCuts==null ) getCuts(numLayers);
615
      getLayerRotatable(numLayers);
616
      mMovement = new Movement12(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_SPLIT_EDGE,ENABLED);
617
      }
605
    return null;
606
    }
618 607

  
619
    return mMovement;
608
///////////////////////////////////////////////////////////////////////////////////////////////////
609

  
610
  public int getSolvedFunctionIndex()
611
    {
612
    return 0;
613
    }
614

  
615
///////////////////////////////////////////////////////////////////////////////////////////////////
616

  
617
  protected int getNumCubitFaces()
618
    {
619
    return 6;
620
    }
621

  
622
///////////////////////////////////////////////////////////////////////////////////////////////////
623
// PUBLIC API
624

  
625
  public Static3D[] getRotationAxis()
626
    {
627
    return ROT_AXIS;
620 628
    }
621 629

  
622 630
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff