Revision b778cfe7
Added by Leszek Koltunski about 2 years ago
src/main/java/org/distorted/objectlib/bandaged/FactoryBandaged.java | ||
---|---|---|
62 | 62 |
abstract float[][] getCuts(int[] numLayers); |
63 | 63 |
abstract float[][] getRotAxis(); |
64 | 64 |
abstract float[] elementVertices(int ax, boolean left, int element); |
65 |
abstract int getElementVariant(int index);
|
|
65 |
abstract int getElementVariant(float x, float y, float z);
|
|
66 | 66 |
|
67 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
68 | 68 |
|
... | ... | |
527 | 527 |
float[][] newSection = new float[elementsInSection][]; |
528 | 528 |
|
529 | 529 |
for(int i=0; i<elementsInSection; i++) |
530 |
newSection[i] = elementVertices(ax,left,tmp[i]);
|
|
530 |
newSection[i]=elementVertices(ax, left, tmp[i]);
|
|
531 | 531 |
|
532 | 532 |
list.add(newSection); |
533 | 533 |
|
... | ... | |
661 | 661 |
mElements = new BandagedElement[mNumElements]; |
662 | 662 |
for(int i=0; i<mNumElements; i++) |
663 | 663 |
{ |
664 |
int elementVariant = getElementVariant(i);
|
|
664 |
int elementVariant = getElementVariant(pos[3*i],pos[3*i+1],pos[3*i+2]);
|
|
665 | 665 |
mElements[i] = new BandagedElement(pos, 3*i, mRotAxis, mCuts,elementVariant); |
666 | 666 |
} |
667 | 667 |
|
src/main/java/org/distorted/objectlib/bandaged/FactoryBandagedCuboid.java | ||
---|---|---|
142 | 142 |
|
143 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 144 |
|
145 |
public int getElementVariant(int index)
|
|
145 |
public int getElementVariant(float x, float y, float z)
|
|
146 | 146 |
{ |
147 | 147 |
return 0; |
148 | 148 |
} |
src/main/java/org/distorted/objectlib/bandaged/FactoryBandagedPyraminx.java | ||
---|---|---|
129 | 129 |
} |
130 | 130 |
|
131 | 131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
132 |
// see BandagedObjectPyraminx |
|
132 |
// see BandagedObjectPyraminx.addTetrahedralLattice() |
|
133 |
// from there, 'y' is always of the form -DY*(size-1)/2 + K*DY, where DY = SQ2/2, K integer |
|
134 |
// and 'size' is mNumLayers[0]-1 in case of Octahedrons and mNumLayers[0] in case of Tetrahedrons. |
|
135 |
// From the above, the below quickly follows: |
|
133 | 136 |
|
134 |
public int getElementVariant(int index)
|
|
137 |
public int getElementVariant(float x, float y, float z)
|
|
135 | 138 |
{ |
136 |
int num = mNumLayers[0]; |
|
137 |
int numOcta= (num-1)*num*(num+1)/6;
|
|
139 |
int num1 = mNumLayers[0];
|
|
140 |
int num2 = (int)(2*SQ2*y+0.1f);
|
|
138 | 141 |
|
139 |
return index<numOcta ? 0:1;
|
|
142 |
return (num1-num2)%2;
|
|
140 | 143 |
} |
141 | 144 |
|
142 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
progress with BandagedPyraminx.