Revision c85a4378
Added by Leszek Koltunski 10 months ago
src/main/java/org/distorted/objectlib/bandaged/FactoryBandagedMegaminx.java | ||
---|---|---|
76 | 76 |
|
77 | 77 |
private float[][] retCornerKilominx(int numL) |
78 | 78 |
{ |
79 |
float width = (1+0.5f*(numL-3)*SIN18)*numL/(numL-1); |
|
79 |
float width = 1;//(1+0.5f*(numL-3)*SIN18)*numL/(numL-1);
|
|
80 | 80 |
float X = width*COS18*SIN_HALFD; |
81 | 81 |
float Y = width*SIN18; |
82 | 82 |
float Z = width*COS18*COS_HALFD; |
... | ... | |
266 | 266 |
{ |
267 | 267 |
switch(variant) |
268 | 268 |
{ |
269 |
case 0: if( mVertices[4]==null ) mVertices[4] = retCornerKilominx(5);
|
|
269 |
case 0: if( mVertices[4]==null ) mVertices[4] = retCornerMegaminx(5);
|
|
270 | 270 |
break; |
271 | 271 |
case 1: if( mVertices[5]==null ) mVertices[5] = retEdgeKilominx(5,variant); |
272 | 272 |
break; |
... | ... | |
509 | 509 |
if( d4c<MAXERR && d4c>-MAXERR ) return 0; |
510 | 510 |
if( d4h<MAXERR && d4h>-MAXERR ) |
511 | 511 |
{ |
512 |
float xCorr = 9*x/25; // mCorners has the coords assuming edge length is 3
|
|
513 |
float yCorr = 9*y/25; // here we have edge length = 5 - so correct for that
|
|
514 |
float zCorr = 9*z/25;
|
|
512 |
float xCorr = 3*x/5; // mCorners has the coords assuming edge length is 3
|
|
513 |
float yCorr = 3*y/5; // here we have edge length = 5 - so correct for that
|
|
514 |
float zCorr = 3*z/5;
|
|
515 | 515 |
|
516 | 516 |
for(int[] edge : mEdgeMap) |
517 | 517 |
{ |
... | ... | |
571 | 571 |
0, 29, 59, 48, 18, 53, 22, 49, 11, 54, |
572 | 572 |
10, 52, 17, 27, 19, 26, 9, 28, 23, 45 |
573 | 573 |
}; |
574 |
} |
|
575 |
|
|
576 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
577 |
|
|
578 |
private void initializeCenterIndices() |
|
579 |
{ |
|
580 |
mQuatCenterIndices = new int[] { 0, 35, 55, 38, 48, 41, 42, 58, 57, 46, 29, 59 }; |
|
574 |
mQuatCenterIndices = new int[] |
|
575 |
{ |
|
576 |
0, 35, 55, 38, 48, 41, 42, 58, 57, 46, 29, 59 |
|
577 |
}; |
|
581 | 578 |
} |
582 | 579 |
|
583 | 580 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
606 | 603 |
|
607 | 604 |
private int getQuatMega(int element, int numCubitsPerCorner, int numCubitsPerEdge) |
608 | 605 |
{ |
609 |
if( mQuatCornerIndices==null || mQuatEdgeIndices==null ) initializeQuatIndices();
|
|
610 |
if( mQuatCenterIndices==null ) initializeCenterIndices();
|
|
606 |
if( mQuatCornerIndices==null || mQuatEdgeIndices==null || mQuatCenterIndices==null)
|
|
607 |
initializeQuatIndices();
|
|
611 | 608 |
|
612 | 609 |
if( element < NUM_CORNERS*numCubitsPerCorner ) |
613 | 610 |
{ |
... | ... | |
617 | 614 |
|
618 | 615 |
if( element < NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge ) |
619 | 616 |
{ |
620 |
int edge = (element-NUM_CORNERS*numCubitsPerCorner)/numCubitsPerEdge;
|
|
617 |
int edge = (element-NUM_CORNERS*numCubitsPerCorner)%NUM_EDGES;
|
|
621 | 618 |
return mQuatEdgeIndices[edge]; |
622 | 619 |
} |
623 | 620 |
|
... | ... | |
640 | 637 |
|
641 | 638 |
if( element < NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge ) |
642 | 639 |
{ |
643 |
int edge = (element-NUM_CORNERS*numCubitsPerCorner)/numCubitsPerEdge;
|
|
640 |
int edge = (element-NUM_CORNERS*numCubitsPerCorner)%NUM_EDGES;
|
|
644 | 641 |
return mQuatEdgeIndices[edge]; |
645 | 642 |
} |
646 | 643 |
|
... | ... | |
838 | 835 |
float D = numLayers/3.0f; |
839 | 836 |
float F = 1.0f - (2.0f*numLayers-6.0f)/(numLayers-1)*COS54*COS54; |
840 | 837 |
|
841 |
return new float[] { |
|
842 |
D * ( cent[0] + (corn[0]-cent[0])*F), |
|
843 |
D * ( cent[1] + (corn[1]-cent[1])*F), |
|
844 |
D * ( cent[2] + (corn[2]-cent[2])*F) |
|
845 |
}; |
|
838 |
return new float[] |
|
839 |
{ |
|
840 |
D * ( cent[0] + (corn[0]-cent[0])*F), |
|
841 |
D * ( cent[1] + (corn[1]-cent[1])*F), |
|
842 |
D * ( cent[2] + (corn[2]-cent[2])*F) |
|
843 |
}; |
|
846 | 844 |
} |
847 | 845 |
|
848 | 846 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
907 | 905 |
int multP = (block % layers) + 1; |
908 | 906 |
int multS = (block / layers); |
909 | 907 |
|
910 |
return new float[] { |
|
911 |
corn[0]*D + (pri.get0()*multP + sec.get0()*multS)*E, |
|
912 |
corn[1]*D + (pri.get1()*multP + sec.get1()*multS)*E, |
|
913 |
corn[2]*D + (pri.get2()*multP + sec.get2()*multS)*E |
|
914 |
}; |
|
908 |
return new float[] |
|
909 |
{ |
|
910 |
corn[0]*D + (pri.get0()*multP + sec.get0()*multS)*E, |
|
911 |
corn[1]*D + (pri.get1()*multP + sec.get1()*multS)*E, |
|
912 |
corn[2]*D + (pri.get2()*multP + sec.get2()*multS)*E |
|
913 |
}; |
|
915 | 914 |
} |
916 | 915 |
} |
917 | 916 |
|
... | ... | |
1064 | 1063 |
|
1065 | 1064 |
if( mCorners==null ) initializeCorners(); |
1066 | 1065 |
|
1067 |
if( size==3 ) return new float[][][] { mCorners }; |
|
1066 |
if( size==3 ) |
|
1067 |
{ |
|
1068 |
final float[][][] positions = new float[1][NUM_CORNERS][]; |
|
1069 |
|
|
1070 |
for(int corner=0; corner<NUM_CORNERS; corner++) |
|
1071 |
{ |
|
1072 |
float[] c = mCorners[corner]; |
|
1073 |
positions[0][corner] = new float[] { 2*c[0]/3, 2*c[1]/3, 2*c[2]/3 }; |
|
1074 |
} |
|
1075 |
|
|
1076 |
return positions; |
|
1077 |
} |
|
1068 | 1078 |
|
1069 | 1079 |
int numCubitsPerCorner = BandagedObjectMegaminx.numCubitsPerCornerKilo(size); |
1070 | 1080 |
int numCubitsPerCenter = 5; |
Also available in: Unified diff
progress with FactoryBandagedMegaminx.