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/TwistyCoinHexahedron.java
52 52
  private float[][] mCuts;
53 53
  private float[][] mPosition;
54 54
  private int[] mQuatIndex;
55
  private boolean[][] mRotatable;
55 56

  
56 57
///////////////////////////////////////////////////////////////////////////////////////////////////
57 58

  
......
64 65

  
65 66
  public int[][] getScrambleEdges()
66 67
    {
67
    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
68
    if( mEdges==null )
69
      {
70
      setUpRotatable();
71
      mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable);
72
      }
73

  
68 74
    return mEdges;
69 75
    }
70 76

  
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
79
  @Override
80
  public int[][] getScrambleAlgorithms()
81
    {
82
    setUpRotatable();
83
    return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
84
    }
85

  
71 86
///////////////////////////////////////////////////////////////////////////////////////////////////
72 87

  
73 88
  public float[][] getCuts(int[] numLayers)
......
84 99
    return mCuts;
85 100
    }
86 101

  
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

  
104
  private void setUpRotatable()
105
    {
106
    if( mRotatable==null )
107
      {
108
      boolean[] tmp = new boolean[] {true,false,true};
109
      mRotatable = new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp,tmp };
110
      }
111
    }
112

  
87 113
///////////////////////////////////////////////////////////////////////////////////////////////////
88 114

  
89 115
  public boolean[][] getLayerRotatable(int[] numLayers)
90 116
    {
91
    boolean[] tmp = new boolean[] {true,false,true};
92
    return new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp,tmp };
117
    setUpRotatable();
118
    return mRotatable;
93 119
    }
94 120

  
95 121
///////////////////////////////////////////////////////////////////////////////////////////////////
......
402 428
    int[][] ret = new int[1+4*N][];
403 429

  
404 430
    ret[0] = new int[4*N];
405
    for(int i=0; i<4*N; i++) ret[0][i] = i;
431
    for(int i=0; i<4*N; i++) ret[0][i] = 4*N-1-i;
406 432

  
407 433
    for(int i=0; i<N; i++)
408 434
      {
......
497 523
      }
498 524
    else if( variant==1 )
499 525
      {
500
      float h1 = isInIconMode() ? 0.0001f : 0.005f;
526
      float h1 = isInIconMode() ? 0.0001f : 0.0001f;
501 527
      float h2 = 0.0001f;
502 528
      float[][] bands = { {h1,15,0.2f,0.4f,5,0,0}, {h2,15,0.05f,0.1f,2,0,0} };
503 529
      int num = 1+4*N;

Also available in: Unified diff