Project

General

Profile

« Previous | Next » 

Revision 74d67e50

Added by Leszek Koltunski about 3 years ago

Make the Skewbs standard size (cube size=2,3, i.e. equal to numLayers so that DIST2D and DIST3D are standard)

View differences:

src/main/java/org/distorted/objects/MovementSkewb.java
25 25

  
26 26
class MovementSkewb extends Movement
27 27
{
28
  static final float DIST3D = 0.25f;
29
  static final float DIST2D = 0.25f;
28
  static final float DIST3D = 0.5f;
29
  static final float DIST2D = 0.5f;
30 30

  
31 31
  static final Static3D[] FACE_AXIS = new Static3D[]
32 32
         {
src/main/java/org/distorted/objects/TwistySkewb.java
139 139

  
140 140
  float getScreenRatio()
141 141
    {
142
    return 1.0f;
142
    return 0.5f;
143 143
    }
144 144

  
145 145
///////////////////////////////////////////////////////////////////////////////////////////////////
......
186 186
      {
187 187
      case 2: float[] c2 = new float[] {0.0f};
188 188
              return new float[][] { c2,c2,c2,c2 };
189
      case 3: float[] c3 = new float[] {-SQ3/12,+SQ3/12};
189
      case 3: float[] c3 = new float[] {-SQ3/6,+SQ3/6};
190 190
              return new float[][] { c3,c3,c3,c3 };
191 191
      }
192 192
    return null;
......
203 203

  
204 204
  float[][] getCubitPositions(int numLayers)
205 205
    {
206
    final float DIST_CORNER = (numLayers-1)*0.50f;
207
    final float DIST_EDGE   = (numLayers-1)*0.50f;
208
    final float DIST_CENTER = (numLayers-1)*0.50f;
206
    final float DIST_CORNER = numLayers-1;
207
    final float DIST_EDGE   = numLayers-1;
208
    final float DIST_CENTER = numLayers-1;
209 209

  
210 210
    final int numCorners = getNumCorners();
211 211
    final int numEdges   = getNumEdges(numLayers);
......
246 246

  
247 247
    for (float[] edges : edgeTable)
248 248
      {
249
      float c = (3-numLayers)*0.5f;
249
      float c = 3-numLayers;
250 250

  
251
      for (int j=0; j<numLayers-2; j++, c+=1.0f, index++)
251
      for (int j=0; j<numLayers-2; j++, c+=2, index++)
252 252
        {
253 253
        CENTERS[index] = new float[] { edges[0]==0 ? c : edges[0] ,
254 254
                                       edges[1]==0 ? c : edges[1] ,
......
275 275

  
276 276
    for( float[] centers : centerTable )
277 277
      {
278
      x = (2-numLayers)*0.5f;
278
      x = 2-numLayers;
279 279

  
280
      for(int i=0; i<numLayers-1; i++, x+=1.0f)
280
      for(int i=0; i<numLayers-1; i++, x+=2)
281 281
        {
282
        y = (2-numLayers)*0.5f;
282
        y = 2-numLayers;
283 283

  
284
        for(int j=0; j<numLayers-1; j++, y+=1.0f, index++)
284
        for(int j=0; j<numLayers-1; j++, y+=2, index++)
285 285
          {
286 286
               if( centers[0]==Y ) cen0 = y;
287 287
          else if( centers[0]==X ) cen0 = x;
......
299 299
          }
300 300
        }
301 301

  
302
      x = (3-numLayers)*0.5f;
302
      x = 3-numLayers;
303 303

  
304
      for(int i=0; i<numLayers-2; i++, x+=1.0f)
304
      for(int i=0; i<numLayers-2; i++, x+=2)
305 305
        {
306
        y = (3-numLayers)*0.5f;
306
        y = 3-numLayers;
307 307

  
308
        for(int j=0; j<numLayers-2; j++, y+=1.0f, index++)
308
        for(int j=0; j<numLayers-2; j++, y+=2, index++)
309 309
          {
310 310
               if( centers[0]==Y ) cen0 = y;
311 311
          else if( centers[0]==X ) cen0 = x;
......
395 395

  
396 396
    if( variant==0 )
397 397
      {
398
      double[][] vertices = new double[][] { {-0.5f, 0.0f, 0.0f},{ 0.0f,-0.5f, 0.0f},{ 0.0f, 0.0f,-0.5f},{-0.5f,-0.5f,-0.5f},{ 0.0f, 0.0f, 0.0f} };
398
      double[][] vertices = new double[][] { {-1,0,0},{0,-1,0},{0,0,-1},{-1,-1,-1},{0,0,0} };
399 399
      int[][] vert_indices = new int[][] { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
400 400
      int N = numLayers==2 ? 7:5;
401 401
      int E1= numLayers==2 ? 3:2;
402 402
      int E2= numLayers==2 ? 5:3;
403
      float[][] bands     = new float[][] { {0.028f,35,0.16f,0.7f,N,E1,E1}, {0.000f, 0,1.00f,0.0f,3,1,E2} };
403
      float[][] bands     = new float[][] { {0.020f,35,0.16f,0.7f,N,E1,E1}, {0.000f, 0,1.00f,0.0f,3,1,E2} };
404 404
      int[] bandIndices   = new int[] { 0,0,0,1,1,1 };
405
      float[][] corners   = new float[][] { {0.08f,0.15f}, {0.08f,0.20f} };
405
      float[][] corners   = new float[][] { {0.05f,0.25f}, {0.05f,0.20f} };
406 406
      int[] cornerIndices = new int[] { 1,1,1,0,0 };
407
      float[][] centers   = new float[][] { {-0.25f, -0.25f, -0.25f} };
407
      float[][] centers   = new float[][] { {-0.5f, -0.5f, -0.5f} };
408 408
      int[] centerIndices = new int[] { 0,0,0,-1,0 };
409 409
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
410 410
      }
411 411
    else if( variant==1 )
412 412
      {
413
      double[][] vertices = new double[][] { {-0.5, 0.0, 0.0},{ 0.5, 0.0, 0.0},{ 0.0,-0.5, 0.0},{ 0.0, 0.0,-0.5} };
413
      double[][] vertices = new double[][] { {-1,0,0},{1,0,0},{0,-1,0},{0,0,-1} };
414 414
      int[][] vert_indices = new int[][] { {2,1,0},{3,0,1},{2,3,1},{3,2,0} };
415 415
      int N = numLayers==2 ? 7:5;
416 416
      int E = numLayers==2 ? 5:2;
......
418 418
      int[] bandIndices   = new int[] { 0,0,1,1 };
419 419
      float[][] corners   = new float[][] { {0.07f,0.20f}, {0.02f,0.30f} };
420 420
      int[] cornerIndices = new int[] { 0,0,1,1 };
421
      float[][] centers   = new float[][] { {0.0f, -0.25f, -0.25f} };
421
      float[][] centers   = new float[][] { {0.0f, -0.5f, -0.5f} };
422 422
      int[] centerIndices = new int[] { 0,0,0,0 };
423 423
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
424 424
      }
425 425
    else
426 426
      {
427
      double[][] vertices = new double[][] { {-0.5f, 0.0f, 0.0f },{ 0.0f,-0.5f, 0.0f },{ 0.5f, 0.0f, 0.0f },{ 0.0f, 0.5f, 0.0f },{ 0.0f, 0.0f,-0.5f } };
427
      double[][] vertices = new double[][] { {-1,0,0},{0,-1,0},{1,0,0},{0,1,0},{0,0,-1} };
428 428
      int[][] vert_indices = new int[][] { {0,1,2,3},{4,1,0},{4,2,1},{4,3,2},{4,0,3} };
429 429
      int N = numLayers==2 ? 7:6;
430 430
      int E = numLayers==2 ? 3:1;
431
      float[][] bands     = new float[][] { {0.051f,35,SQ2/8,0.9f,N,E,E}, {0.000f,0,1,0.0f,3,0,0} };
431
      float[][] bands     = new float[][] { {0.04f,35,SQ2/8,0.9f,N,E,E}, {0.000f,0,1,0.0f,3,0,0} };
432 432
      int[] bandIndices   = new int[] { 0,1,1,1,1 };
433
      float[][] corners   = new float[][] { {0.06f,0.10f} };
433
      float[][] corners   = new float[][] { {0.06f,0.15f} };
434 434
      int[] cornerIndices = new int[] { 0,0,0,0,0 };
435
      float[][] centers   = new float[][] { {0,0,-0.2f} };
435
      float[][] centers   = new float[][] { {0,0,-0.4f} };
436 436
      int[] centerIndices = new int[] { 0,0,0,0,-1 };
437 437
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
438 438
      }

Also available in: Unified diff