Project

General

Profile

« Previous | Next » 

Revision acf2a9e1

Added by Leszek Koltunski 12 months ago

Support for automatic creation of Scramble Algorithms and Edges which ignore the 'non-rotatable' layers.
Implement this to the Coin Tetrahedron, Ancient Coin Cube & Tins Cube.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyTins.java
44 44
  private float[][] mCuts;
45 45
  private float[][] mPosition;
46 46
  private int[] mQuatIndex;
47
  private boolean[][] mRotatable;
47 48

  
48 49
///////////////////////////////////////////////////////////////////////////////////////////////////
49 50

  
......
56 57

  
57 58
  public int[][] getScrambleEdges()
58 59
    {
59
    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
60
    if( mEdges==null )
61
      {
62
      setUpRotatable();
63
      mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable);
64
      }
65

  
60 66
    return mEdges;
61 67
    }
62 68

  
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

  
71
  @Override
72
  public int[][] getScrambleAlgorithms()
73
    {
74
    setUpRotatable();
75
    return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
76
    }
77

  
63 78
///////////////////////////////////////////////////////////////////////////////////////////////////
64 79

  
65 80
  public float[][] getCuts(int[] numLayers)
......
80 95
    return mCuts;
81 96
    }
82 97

  
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99

  
100
  private void setUpRotatable()
101
    {
102
    if( mRotatable==null )
103
      {
104
      boolean[] tmp = new boolean[] {true,true,false,true,true};
105
      mRotatable = new boolean[][] { tmp,tmp,tmp,tmp };
106
      }
107
    }
108

  
83 109
///////////////////////////////////////////////////////////////////////////////////////////////////
84 110

  
85 111
  public boolean[][] getLayerRotatable(int[] numLayers)
86 112
    {
87
    boolean[] tmp = new boolean[] {true,true,false,true,true};
88
    return new boolean[][] { tmp,tmp,tmp,tmp };
113
    setUpRotatable();
114
    return mRotatable;
89 115
    }
90 116

  
91 117
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff