128 |
128 |
|
129 |
129 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
130 |
130 |
|
131 |
|
private int getNumCorners(int layers)
|
|
131 |
private int getNumCorners()
|
132 |
132 |
{
|
133 |
133 |
return 8;
|
134 |
134 |
}
|
... | ... | |
142 |
142 |
|
143 |
143 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
144 |
144 |
|
145 |
|
private int getNumCenters(int layers)
|
|
145 |
private int getNumCentersPerFace(int layers)
|
146 |
146 |
{
|
147 |
|
return ((layers-2)*(layers-2) + (layers-1)*(layers-1))*6;
|
|
147 |
return ((layers-2)*(layers-2) + (layers-1)*(layers-1));
|
148 |
148 |
}
|
149 |
149 |
|
150 |
150 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
218 |
218 |
final float DIST_EDGE = (numLayers-1)*0.50f;
|
219 |
219 |
final float DIST_CENTER = (numLayers-1)*0.50f;
|
220 |
220 |
|
221 |
|
final int numCorners = getNumCorners(numLayers);
|
|
221 |
final int numCorners = getNumCorners();
|
222 |
222 |
final int numEdges = getNumEdges(numLayers);
|
223 |
|
final int numCenters = getNumCenters(numLayers);
|
|
223 |
final int numCenters = 6*getNumCentersPerFace(numLayers);
|
224 |
224 |
|
225 |
225 |
final Static3D[] CENTERS = new Static3D[numCorners+numEdges+numCenters];
|
226 |
226 |
|
... | ... | |
340 |
340 |
|
341 |
341 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
342 |
342 |
|
343 |
|
private Static4D getQuat(int cubit, int size)
|
|
343 |
private Static4D getQuat(int cubit, int numLayers)
|
344 |
344 |
{
|
345 |
|
int numCorners = getNumCorners(size);
|
346 |
|
int numEdges = getNumEdges(size);
|
|
345 |
int numCorners = getNumCorners();
|
|
346 |
int numEdges = getNumEdges(numLayers);
|
347 |
347 |
|
348 |
348 |
if( cubit<numCorners )
|
349 |
349 |
{
|
... | ... | |
361 |
361 |
}
|
362 |
362 |
else if( cubit<numCorners+numEdges )
|
363 |
363 |
{
|
364 |
|
int edge = (cubit-numCorners)/(size-2);
|
|
364 |
int edge = (cubit-numCorners)/(numLayers-2);
|
365 |
365 |
|
366 |
366 |
switch(edge)
|
367 |
367 |
{
|
... | ... | |
381 |
381 |
}
|
382 |
382 |
else
|
383 |
383 |
{
|
384 |
|
int center = (cubit-numCorners-numEdges)/((size-2)*(size-2)+(size-1)*(size-1));
|
|
384 |
int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numLayers);
|
385 |
385 |
|
386 |
386 |
switch(center)
|
387 |
387 |
{
|
... | ... | |
403 |
403 |
{
|
404 |
404 |
MeshBase mesh;
|
405 |
405 |
|
406 |
|
int numLayers = getNumLayers();
|
407 |
|
int numCorners = getNumCorners(numLayers);
|
|
406 |
int numLayers = getNumLayers();
|
|
407 |
int numCorners = getNumCorners();
|
408 |
408 |
int numEdges = getNumEdges(numLayers);
|
409 |
409 |
|
410 |
410 |
if( cubit<numCorners )
|
... | ... | |
438 |
438 |
|
439 |
439 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
440 |
440 |
|
441 |
|
int getFaceColor(int cubit, int cubitface, int size)
|
|
441 |
int getFaceColor(int cubit, int cubitface, int numLayers)
|
442 |
442 |
{
|
443 |
|
int numCorners = getNumCorners(size);
|
444 |
|
int numEdges = getNumEdges(size);
|
|
443 |
int numCorners = getNumCorners();
|
|
444 |
int numEdges = getNumEdges(numLayers);
|
445 |
445 |
|
446 |
446 |
if( cubit<numCorners )
|
447 |
447 |
{
|
... | ... | |
449 |
449 |
}
|
450 |
450 |
else if( cubit<numCorners+numEdges )
|
451 |
451 |
{
|
452 |
|
int edge = (cubit-numCorners)/(size-2);
|
|
452 |
int edge = (cubit-numCorners)/(numLayers-2);
|
453 |
453 |
return mEdgeMap[edge][cubitface];
|
454 |
454 |
}
|
455 |
455 |
else
|
456 |
456 |
{
|
457 |
|
int center = (cubit-numCorners-numEdges)/((size-2)*(size-2)+(size-1)*(size-1));
|
|
457 |
int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numLayers);
|
458 |
458 |
return mCenterMap[center][cubitface];
|
459 |
459 |
}
|
460 |
460 |
}
|
... | ... | |
618 |
618 |
{
|
619 |
619 |
int q = CUBITS[0].mQuatIndex;
|
620 |
620 |
|
621 |
|
int numLayers = getNumLayers();
|
622 |
|
int numCorners = getNumCorners(numLayers);
|
623 |
|
int numEdges = getNumEdges(numLayers);
|
624 |
|
int cornersAndEdges = numCorners + numEdges;
|
625 |
|
int cubitsPerFace = (numLayers-2)*(numLayers-2) + (numLayers-1)*(numLayers-1);
|
|
621 |
int numLayers = getNumLayers();
|
|
622 |
int numCorners = getNumCorners();
|
|
623 |
int numEdges = getNumEdges(numLayers);
|
|
624 |
int cornersAndEdges= numCorners + numEdges;
|
|
625 |
int centersPerFace = getNumCentersPerFace(numLayers);
|
626 |
626 |
int cubit, q1=q;
|
627 |
627 |
|
628 |
628 |
for(cubit=0; cubit<cornersAndEdges; cubit++)
|
... | ... | |
634 |
634 |
{
|
635 |
635 |
if( face%2==0 ) q1 = mulQuat(q, (face/2)+1);
|
636 |
636 |
|
637 |
|
for(int center=0; center<cubitsPerFace; center++)
|
|
637 |
for(int center=0; center<centersPerFace; center++)
|
638 |
638 |
{
|
639 |
639 |
if( CUBITS[cubit].mQuatIndex != q && CUBITS[cubit].mQuatIndex != q1 ) return false;
|
640 |
640 |
cubit++;
|
Improve the Skewb; set max components to 110 in MeshBase so that all of Professor Skewb's components fit.