Project

General

Profile

« Previous | Next » 

Revision 28b54fe3

Added by Leszek Koltunski almost 4 years ago

Progress with Megaminx. Darken the RED color.

View differences:

src/main/java/org/distorted/objects/FactoryCubit.java
1313 1313
    float sinA = (2*SIN54*SIN54-1)/COS54;
1314 1314
    float cosA = (float)Math.sqrt(1-sinA*sinA);
1315 1315
    float LEN  = 0.5f/SIN54;
1316
    float scale= 2*SIN54*(0.5f-MEGA_D)/(0.5f*(numLayers-1));
1316
    float scale= (numLayers/6.0f-MEGA_D)/(LEN*0.5f*(numLayers-1));
1317 1317

  
1318 1318
    Static3D axisA = new Static3D( SIN54, COS54, 0.0f);
1319 1319
    Static3D axisB = new Static3D(-SIN54, COS54, 0.0f);
src/main/java/org/distorted/objects/TwistyMegaminx.java
59 59
           { 1,  3, 19,  7, 17},
60 60
         };
61 61

  
62
  private static MeshBase mCenterMesh, mCornerMesh;
63
  private static MeshBase[] mEdgeMesh;
62
  private static MeshBase[] mCenterMeshes, mCornerMeshes, mEdgeMeshes;
64 63

  
65 64
  private static final Static4D[] mBasicV, mCurrV;
66 65

  
67 66
  static
68 67
    {
69
    float D = 0.5f-MEGA_D;
70

  
71 68
    mBasicV = new Static4D[3];
72 69
    mCurrV  = new Static4D[3];
73 70

  
74
    mBasicV[0] = new Static4D( (SQ5+1)*0.125f*D, (SQ5-1)*0.125f*D, 0.250f*D, 0.0f );
75
    mBasicV[1] = new Static4D(-(SQ5+1)*0.125f*D, (SQ5-1)*0.125f*D, 0.250f*D, 0.0f );
76
    mBasicV[2] = new Static4D(                0,        -0.500f*D,     0.0f, 0.0f );
71
    mBasicV[0] = new Static4D( (SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
72
    mBasicV[1] = new Static4D(-(SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
73
    mBasicV[2] = new Static4D(              0,        -0.500f,    0.0f, 0.0f );
77 74
    };
78 75

  
79 76
///////////////////////////////////////////////////////////////////////////////////////////////////
......
181 178
      }
182 179
    else
183 180
      {
184
      float E = 2.0f/(numLayers-1);
181
      float E = 2.0f*(numLayers/6.0f - MEGA_D)/(0.5f*(numLayers-1));
185 182
      int N = (numCubitsPerCorner-1)/3;
186 183
      int b1 = (part-1) % N;
187 184
      int b2 = (part-1) / N;
188 185
      Static4D pri = mCurrV[b2];
189 186
      Static4D sec = mCurrV[(b2+2)%3];
190 187

  
191
      int multP = b1 % ((numLayers-3)/2);
192
      int multS = b1 / ((numLayers-3)/2);
188
      int multP = (b1 % ((numLayers-3)/2)) + 1;
189
      int multS = (b1 / ((numLayers-3)/2));
193 190

  
194 191
      pos.set( corn.get0()*D + (pri.get0()*multP + sec.get0()*multS)*E,
195 192
               corn.get1()*D + (pri.get1()*multP + sec.get1()*multS)*E,
......
287 284
    {
288 285
    int numCubitsPerCorner = numCubitsPerCorner(numLayers);
289 286
    int numCubitsPerEdge   = numCubitsPerEdge(numLayers);
287
    int index = (numLayers-3)/2;
290 288
    MeshBase mesh;
291 289

  
290
    if( mCornerMeshes==null ) mCornerMeshes = new MeshBase[ObjectList.MEGA.getNumVariants()];
291

  
292 292
//    if( cubit < NUM_CORNERS*numCubitsPerCorner )
293 293
      {
294
      if( mCenterMesh==null ) mCenterMesh = FactoryCubit.getInstance().createMegaminxCornerMesh(numLayers);
295
      mesh = mCenterMesh.copy(true);
294
      if( mCornerMeshes[index]==null ) mCornerMeshes[index] = FactoryCubit.getInstance().createMegaminxCornerMesh(numLayers);
295
      mesh = mCornerMeshes[index].copy(true);
296 296
      }
297 297
/*
298 298
    else if( cubit<NUM_CENTERS + NUM_CORNERS*numCubitsPerCorner )
src/main/java/org/distorted/objects/TwistyObject.java
61 61
  static final int COLOR_WHITE  = 0xffffffff;
62 62
  static final int COLOR_BLUE   = 0xff0000ff;
63 63
  static final int COLOR_GREEN  = 0xff00bb00;
64
  static final int COLOR_RED    = 0xffff0000;
64
  static final int COLOR_RED    = 0xff990000;
65 65
  static final int COLOR_ORANGE = 0xffff6200;
66 66
  static final int COLOR_GREY   = 0xff727c7b;
67 67
  static final int COLOR_VIOLET = 0xff7700bb;

Also available in: Unified diff