Revision d0e6cf7f
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/objects/TwistyMirror.java | ||
---|---|---|
181 | 181 |
return (int)(mPositions[cubit][dim] + 0.5f*(numLayers-1)); |
182 | 182 |
} |
183 | 183 |
|
184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
185 |
|
|
186 |
public float[][] getCubitPositions(int[] numLayers) |
|
187 |
{ |
|
188 |
if( mPositions==null ) |
|
189 |
{ |
|
190 |
int numL = numLayers[0]; |
|
191 |
int numCubits = numL>1 ? 6*numL*numL - 12*numL + 8 : 1; |
|
192 |
mPositions = new float[numCubits][]; |
|
193 |
|
|
194 |
float diff = 0.5f*(numL-1); |
|
195 |
int currentPosition = 0; |
|
196 |
|
|
197 |
for(int x = 0; x<numL; x++) |
|
198 |
for(int y = 0; y<numL; y++) |
|
199 |
for(int z = 0; z<numL; z++) |
|
200 |
if( x==0 || x==numL-1 || y==0 || y==numL-1 || z==0 || z==numL-1 ) |
|
201 |
{ |
|
202 |
mPositions[currentPosition++] = new float[] {x-diff,y-diff,z-diff}; |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
206 |
return mPositions; |
|
207 |
} |
|
208 |
|
|
209 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
210 |
|
|
211 |
public Static4D getCubitQuats(int cubit, int[] numLayers) |
|
212 |
{ |
|
213 |
if( mQuats ==null ) initializeQuats(); |
|
214 |
return mQuats[0]; |
|
215 |
} |
|
216 |
|
|
184 | 217 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
185 | 218 |
|
186 | 219 |
public ObjectShape getObjectShape(int variant) |
... | ... | |
247 | 280 |
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null); |
248 | 281 |
} |
249 | 282 |
|
250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
251 |
|
|
252 |
public Static4D getQuat(int cubit, int[] numLayers) |
|
253 |
{ |
|
254 |
if( mQuats ==null ) initializeQuats(); |
|
255 |
return mQuats[0]; |
|
256 |
} |
|
257 |
|
|
258 | 283 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
259 | 284 |
|
260 | 285 |
public int getNumCubitVariants(int[] numLayers) |
... | ... | |
277 | 302 |
return FACE_COLORS[face]; |
278 | 303 |
} |
279 | 304 |
|
280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
281 |
|
|
282 |
public float[][] getCubitPositions(int[] numLayers) |
|
283 |
{ |
|
284 |
if( mPositions==null ) |
|
285 |
{ |
|
286 |
int numL = numLayers[0]; |
|
287 |
int numCubits = numL>1 ? 6*numL*numL - 12*numL + 8 : 1; |
|
288 |
mPositions = new float[numCubits][]; |
|
289 |
|
|
290 |
float diff = 0.5f*(numL-1); |
|
291 |
int currentPosition = 0; |
|
292 |
|
|
293 |
for(int x = 0; x<numL; x++) |
|
294 |
for(int y = 0; y<numL; y++) |
|
295 |
for(int z = 0; z<numL; z++) |
|
296 |
if( x==0 || x==numL-1 || y==0 || y==numL-1 || z==0 || z==numL-1 ) |
|
297 |
{ |
|
298 |
mPositions[currentPosition++] = new float[] {x-diff,y-diff,z-diff}; |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
302 |
return mPositions; |
|
303 |
} |
|
304 |
|
|
305 | 305 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
306 | 306 |
|
307 | 307 |
public Static4D[] getQuats() |
Also available in: Unified diff
Simplification.