Revision 69061d6e
Added by Leszek Koltunski 7 months ago
src/main/java/org/distorted/objectlib/objects/TwistyMirrorSkewb.java | ||
---|---|---|
15 | 15 |
import org.distorted.library.type.Static3D; |
16 | 16 |
import org.distorted.library.type.Static4D; |
17 | 17 |
import org.distorted.objectlib.helpers.FactoryCubit; |
18 |
import org.distorted.objectlib.helpers.FactoryMirror;
|
|
18 |
import org.distorted.objectlib.helpers.FactoryShape;
|
|
19 | 19 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
20 | 20 |
import org.distorted.objectlib.helpers.ObjectShape; |
21 | 21 |
import org.distorted.objectlib.helpers.ObjectVertexEffects; |
... | ... | |
41 | 41 |
}; |
42 | 42 |
|
43 | 43 |
private static final int[] FACE_COLORS = new int[] { COLOR_WHITE }; |
44 |
private static final float[] MIRROR_VEC = {0,0,0};//{ 0.10f, 0.25f, 0.40f };
|
|
44 |
private static final float[] MIRROR_VEC = { 0.10f, 0.15f, 0.20f };
|
|
45 | 45 |
|
46 | 46 |
private int[][] mEdges; |
47 | 47 |
private int[][] mBasicAngle; |
... | ... | |
64 | 64 |
@Override |
65 | 65 |
public int getInternalColor() |
66 | 66 |
{ |
67 |
return 0xff222222;
|
|
67 |
return 0xff333333;
|
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
185 | 185 |
|
186 | 186 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
187 | 187 |
|
188 |
public float[][] getCubitPositions(int[] numLayers)
|
|
188 |
private float[][] getPositions()
|
|
189 | 189 |
{ |
190 | 190 |
if( mPositions==null ) |
191 | 191 |
{ |
192 |
final float COR = 1; |
|
193 |
final float CEN = 1; |
|
192 |
final float COR = 1.0f;
|
|
193 |
final float CEN = 1.0f;
|
|
194 | 194 |
final float X = MIRROR_VEC[0]; |
195 | 195 |
final float Y = MIRROR_VEC[1]; |
196 | 196 |
final float Z = MIRROR_VEC[2]; |
197 | 197 |
|
198 | 198 |
mPositions = new float[8+6][]; |
199 | 199 |
|
200 |
mPositions[0] = new float[]{ COR-X, COR-Y, COR-Z };
|
|
201 |
mPositions[1] = new float[]{ COR-X, COR-Y, -COR-Z };
|
|
202 |
mPositions[2] = new float[]{ COR-X, -COR-Y, COR-Z };
|
|
203 |
mPositions[3] = new float[]{ COR-X, -COR-Y, -COR-Z };
|
|
204 |
mPositions[4] = new float[]{-COR-X, COR-Y, COR-Z };
|
|
205 |
mPositions[5] = new float[]{-COR-X, COR-Y, -COR-Z };
|
|
206 |
mPositions[6] = new float[]{-COR-X, -COR-Y, COR-Z };
|
|
207 |
mPositions[7] = new float[]{-COR-X, -COR-Y, -COR-Z };
|
|
208 |
|
|
209 |
mPositions[ 8] = new float[]{ -X, -Y, CEN-Z };
|
|
210 |
mPositions[ 9] = new float[]{ -X, -Y,-CEN-Z };
|
|
211 |
mPositions[10] = new float[]{ -X, CEN-Y, -Z };
|
|
212 |
mPositions[11] = new float[]{ -X,-CEN-Y, -Z };
|
|
213 |
mPositions[12] = new float[]{ CEN-X, -Y, -Z };
|
|
214 |
mPositions[13] = new float[]{-CEN-X, -Y, -Z };
|
|
200 |
mPositions[0] = new float[]{ COR+X, COR+Y, COR+Z };
|
|
201 |
mPositions[1] = new float[]{ COR+X, COR+Y, -COR+Z };
|
|
202 |
mPositions[2] = new float[]{ COR+X, -COR+Y, COR+Z };
|
|
203 |
mPositions[3] = new float[]{ COR+X, -COR+Y, -COR+Z };
|
|
204 |
mPositions[4] = new float[]{-COR+X, COR+Y, COR+Z };
|
|
205 |
mPositions[5] = new float[]{-COR+X, COR+Y, -COR+Z };
|
|
206 |
mPositions[6] = new float[]{-COR+X, -COR+Y, COR+Z };
|
|
207 |
mPositions[7] = new float[]{-COR+X, -COR+Y, -COR+Z };
|
|
208 |
|
|
209 |
mPositions[ 8] = new float[]{ X, Y, CEN+Z };
|
|
210 |
mPositions[ 9] = new float[]{ X, Y,-CEN+Z };
|
|
211 |
mPositions[10] = new float[]{ X, CEN+Y, Z };
|
|
212 |
mPositions[11] = new float[]{ X,-CEN+Y, Z };
|
|
213 |
mPositions[12] = new float[]{ CEN+X, Y, Z };
|
|
214 |
mPositions[13] = new float[]{-CEN+X, Y, Z };
|
|
215 | 215 |
} |
216 | 216 |
|
217 | 217 |
return mPositions; |
218 | 218 |
} |
219 | 219 |
|
220 |
|
|
221 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
222 |
|
|
223 |
public float[][] getCubitPositions(int[] numLayers) |
|
224 |
{ |
|
225 |
return getPositions(); |
|
226 |
} |
|
227 |
|
|
220 | 228 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
221 | 229 |
|
222 | 230 |
public Static4D getCubitQuats(int cubit, int[] numLayers) |
... | ... | |
250 | 258 |
|
251 | 259 |
private float[] internalPoint(int variant) |
252 | 260 |
{ |
253 |
int[] numLayers = getNumLayers(); |
|
254 |
float[][] pos = getCubitPositions(numLayers); |
|
261 |
float[][] pos = getPositions(); |
|
255 | 262 |
float[] position = pos[variant]; |
256 | 263 |
float[][] center = computeVertexEffectCenter(variant); |
257 | 264 |
float[] cent = center[0]; |
... | ... | |
277 | 284 |
int numV = getNumCubitVariants(numLayers); |
278 | 285 |
mShapes = new ObjectShape[numV]; |
279 | 286 |
createCutPlanes(); |
280 |
mPotentialVertices = FactoryMirror.computePotentialVertices(mCutPlanes);
|
|
287 |
mPotentialVertices = FactoryShape.computePotentialVertices(mCutPlanes);
|
|
281 | 288 |
} |
282 | 289 |
|
283 | 290 |
if( mShapes[variant]==null ) |
284 | 291 |
{ |
285 |
int[] numLayers = getNumLayers(); |
|
286 |
float[][] pos = getCubitPositions(numLayers); |
|
292 |
float[][] pos = getPositions(); |
|
287 | 293 |
float[] point = internalPoint(variant); |
288 |
mShapes[variant] = FactoryMirror.createShape(mCutPlanes,mPotentialVertices,pos[variant],point);
|
|
294 |
mShapes[variant] = FactoryShape.createShape(mCutPlanes,mPotentialVertices,pos[variant],point);
|
|
289 | 295 |
} |
290 | 296 |
|
291 | 297 |
return mShapes[variant]; |
... | ... | |
298 | 304 |
ObjectShape shape = getObjectShape(variant); |
299 | 305 |
int[][] ind = shape.getVertIndices(); |
300 | 306 |
float[][] vert = shape.getVertices(); |
301 |
int[] indices = FactoryMirror.produceBandIndices(vert,ind, getFaceAxis(), getDist() ); |
|
307 |
float[][] pos = getPositions(); |
|
308 |
int[] indices = FactoryShape.produceBandIndices(vert, pos[variant], ind, getFaceAxis(), getDist() ); |
|
302 | 309 |
|
303 | 310 |
if( variant<8 ) |
304 | 311 |
{ |
305 | 312 |
int N = 5; |
306 |
int E1= 3; |
|
307 |
int E2= 1; |
|
308 |
float height = isInIconMode() ? 0.001f : 0.30f; |
|
309 |
float[][] bands = { {height,35,0.16f,0.7f,N,E1,E1}, {0.1f, 35,1.00f,0.0f,3,1,E2} }; |
|
313 |
int E = 2; |
|
314 |
float height = isInIconMode() ? 0.001f : 0.04f; |
|
315 |
float[][] bands = { {height,35,0.16f,0.7f,N,E,E}, {0.001f, 35,1.00f,0.0f,N,E,E} }; |
|
310 | 316 |
return new ObjectFaceShape(bands,indices,null); |
311 | 317 |
} |
312 | 318 |
else |
313 | 319 |
{ |
314 | 320 |
int N = 5; |
315 |
int E = 2;
|
|
316 |
float height = isInIconMode() ? 0.001f : 0.30f;
|
|
317 |
float[][] bands = { {height,35,SQ2/8,0.9f,N,E,E}, {0.1f,35,1,0.0f,3,0,0} }; |
|
321 |
int E = 1;
|
|
322 |
float height = isInIconMode() ? 0.001f : 0.05f;
|
|
323 |
float[][] bands = { {height,35,SQ2/8,0.9f,N,E,E}, {0.001f,35,1,0.0f,3,0,0} };
|
|
318 | 324 |
return new ObjectFaceShape(bands,indices,null); |
319 | 325 |
} |
320 | 326 |
} |
... | ... | |
353 | 359 |
ObjectShape shape = getObjectShape(variant); |
354 | 360 |
float[][] vertices = shape.getVertices(); |
355 | 361 |
float[][] centers = computeVertexEffectCenter(variant); |
356 |
int[] indices = FactoryMirror.computeVertexEffectsIndices(vertices,getFaceAxis(), getDist() ); |
|
357 |
float[][] corners = variant<8 ? new float[][]{{0.04f, 0.20f}} : new float[][]{{0.03f, 0.15f}}; |
|
362 |
float[][] pos = getPositions(); |
|
363 |
int[] indices = FactoryShape.computeVertexEffectsIndices(vertices, pos[variant], getFaceAxis(), getDist() ); |
|
364 |
float[][] corners = variant<8 ? new float[][]{{0.00f, 0.20f}} : new float[][]{{0.00f, 0.15f}}; |
|
358 | 365 |
|
359 | 366 |
return FactoryCubit.generateVertexEffect(vertices,corners,indices,centers,indices); |
360 | 367 |
} |
Also available in: Unified diff
fixes for the generic Mirror mechanism.