Revision ef018c1b
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistySquare.java | ||
---|---|---|
47 | 47 |
}; |
48 | 48 |
|
49 | 49 |
private int[] mBasicAngle; |
50 |
private float[][] mCuts; |
|
51 |
private boolean[][] mLayerRotatable; |
|
50 | 52 |
private Movement mMovement; |
51 | 53 |
Static4D[] mQuats; |
52 | 54 |
|
... | ... | |
118 | 120 |
|
119 | 121 |
float[][] getCuts(int numLayers) |
120 | 122 |
{ |
121 |
return new float[][] { {-0.5f,+0.5f}, {0.0f}, {-0.5f,+0.5f} }; |
|
123 |
if( mCuts==null ) |
|
124 |
{ |
|
125 |
mCuts = new float[][] { {-0.5f,+0.5f}, {0.0f}, {-0.5f,+0.5f} }; |
|
126 |
} |
|
127 |
|
|
128 |
return mCuts; |
|
129 |
} |
|
130 |
|
|
131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
132 |
|
|
133 |
private void getLayerRotatable(int numLayers) |
|
134 |
{ |
|
135 |
if( mLayerRotatable==null ) |
|
136 |
{ |
|
137 |
mLayerRotatable = new boolean[][] { {true,false,true}, {true,true}, {true,false,true} }; |
|
138 |
} |
|
122 | 139 |
} |
123 | 140 |
|
124 | 141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
133 | 150 |
|
134 | 151 |
public Movement getMovement() |
135 | 152 |
{ |
136 |
if( mMovement==null ) mMovement = new MovementSquare(); |
|
153 |
if( mMovement==null ) |
|
154 |
{ |
|
155 |
int numLayers = getNumLayers(); |
|
156 |
if( mCuts==null ) getCuts(numLayers); |
|
157 |
getLayerRotatable(numLayers); |
|
158 |
|
|
159 |
mMovement = new MovementSquare(mCuts,mLayerRotatable,numLayers); |
|
160 |
} |
|
137 | 161 |
return mMovement; |
138 | 162 |
} |
139 | 163 |
|
Also available in: Unified diff
Abstract the next function, computeRowFromOffset(), out of the individual Movement classes.
Still two issues:
1) mysterious 1.5 multiplier in Movement12
2) in Movement8, moving the offset works only if the rotAxis are face-turning, i.e. they connect the centers of the opposing faces of the octahedron.