Project

General

Profile

« Previous | Next » 

Revision 10a2e360

Added by Leszek Koltunski about 4 years ago

Progress towards generalizing belongsToRotation()

View differences:

src/main/java/org/distorted/object/RubikCube.java
82 82

  
83 83
///////////////////////////////////////////////////////////////////////////////////////////////////
84 84

  
85
  int[][] getCubitPositions(int size)
85
  Static3D[] getCubitPositions(int size)
86 86
    {
87
    int[][] tmp = new int[getNumCubits(size)][3];
87
    int numCubits = size>1 ? 6*size*size - 12*size + 8 : 1;
88
    Static3D[] tmp = new Static3D[numCubits];
88 89

  
89 90
    int currentPosition = 0;
90 91

  
91 92
    for(int x = 0; x<size; x++)
92 93
      for(int y = 0; y<size; y++)
93 94
        for(int z = 0; z<size; z++)
94
          {
95 95
          if( x==0 || x==size-1 || y==0 || y==size-1 || z==0 || z==size-1 )
96 96
            {
97
            tmp[currentPosition][0] = x;
98
            tmp[currentPosition][1] = y;
99
            tmp[currentPosition][2] = z;
100

  
101
            currentPosition++;
97
            tmp[currentPosition++] = new Static3D(x,y,z);
102 98
            }
103
          }
104 99

  
105 100
    return tmp;
106 101
    }
107 102

  
108
///////////////////////////////////////////////////////////////////////////////////////////////////
109
// i.e. size^3 - (size-2)^3 - number of cubits in the outside wall of the Cube (we don't create or
110
// render the inside)
111

  
112
  int getNumCubits(int size)
113
    {
114
    return size>1 ? 6*size*size - 12*size + 8 : 1;
115
    }
116

  
117 103
///////////////////////////////////////////////////////////////////////////////////////////////////
118 104

  
119 105
  float[] getLegalQuats()

Also available in: Unified diff