commit b804acafd658514ea6d1b35a5eaa9e552fda1ed1
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri May 13 10:17:34 2022 +0200

    Progess with Mixup.

diff --git a/src/main/java/org/distorted/objectlib/main/ObjectType.java b/src/main/java/org/distorted/objectlib/main/ObjectType.java
index 90153e88..5b0f8746 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectType.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectType.java
@@ -80,12 +80,10 @@ public enum ObjectType
   CONT_2 ( TwistyContainer.class     , new int[] {2,2,2,2}    , 12, R.drawable.cont_2, true),
 
   MIXU_3 ( TwistyMixup.class         , new int[] {3,3,3}      , 22, R.drawable.cont_2, false),
-
   VOID_3 ( TwistyVoid.class          , new int[] {3,3,3}      , 17, R.drawable.void_3, false),  // wasDownloadableButNowIsBuiltIn()
   CRYS_3 ( TwistyCrystal.class       , new int[] {3,3,3,3,3,3}, 27, R.drawable.crys_3, false),  // function!
   STAR_3 ( TwistyStarminx.class      , new int[] {3,3,3,3,3,3}, 27, R.drawable.star_3, false),
   PENT_2 ( TwistyPentultimate.class  , new int[] {2,2,2,2,2,2}, 21, R.drawable.pent_2, false),
-
   ;
 
   public static int NUM_OBJECTS;
diff --git a/src/main/java/org/distorted/objectlib/objects/TwistyMixup.java b/src/main/java/org/distorted/objectlib/objects/TwistyMixup.java
index d3279cac..e7e1853c 100644
--- a/src/main/java/org/distorted/objectlib/objects/TwistyMixup.java
+++ b/src/main/java/org/distorted/objectlib/objects/TwistyMixup.java
@@ -49,6 +49,7 @@ public class TwistyMixup extends ShapeHexahedron
   private int[][] mBasicAngle;
   private float[][] mCuts;
   private float[][] mPosition;
+  private int[] mQuatIndex;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -157,8 +158,12 @@ public class TwistyMixup extends ShapeHexahedron
     {
     if( mPosition==null )
       {
-      final float DIST_CORNER = 1.0f;
-      final float DIST_EDGE   = 1.5f;
+      float SHORT_EDGE = 1.5f-0.75f*SQ2;
+      float LONG_EDGE  = 1.5f*(SQ2-1);
+
+      final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
+      final float DIST_EDGE   = LONG_EDGE+SHORT_EDGE;
+      final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
 
       mPosition = new float[][]
          {
@@ -182,7 +187,14 @@ public class TwistyMixup extends ShapeHexahedron
              {      0.0f, DIST_EDGE,-DIST_EDGE },
              { DIST_EDGE,      0.0f,-DIST_EDGE },
              {      0.0f,-DIST_EDGE,-DIST_EDGE },
-             {-DIST_EDGE,      0.0f,-DIST_EDGE }
+             {-DIST_EDGE,      0.0f,-DIST_EDGE },
+
+             {           0,           0, DIST_CENTER },
+             {           0,           0,-DIST_CENTER },
+             {           0, DIST_CENTER,           0 },
+             {           0,-DIST_CENTER,           0 },
+             { DIST_CENTER,           0,           0 },
+             {-DIST_CENTER,           0,           0 },
          };
       }
 
@@ -190,131 +202,81 @@ public class TwistyMixup extends ShapeHexahedron
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// TODO
 
   public Static4D getCubitQuats(int cubit, int[] numLayers)
     {
-    switch(cubit)
+    if( mQuatIndex==null )
       {
-      case  0: return mObjectQuats[0];                   //  unit quat
-      case  1: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
-      case  2: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
-      case  3: return mObjectQuats[9];                   // 180 along X
-      case  4: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
-      case  5: return mObjectQuats[11];                  // 180 along Y
-      case  6: return mObjectQuats[10];                  // 180 along Z
-      case  7: return new Static4D(SQ2/2,0,-SQ2/2,0);    // 180 along (SQ2/2,0,-SQ2/2)
-
-      case  8: return mObjectQuats[0];
-      case  9: return mObjectQuats[2];
-      case 10: return mObjectQuats[10];
-      case 11: return mObjectQuats[8];
-      case 12: return mObjectQuats[1];
-      case 13: return mObjectQuats[4];
-      case 14: return mObjectQuats[6];
-      case 15: return mObjectQuats[7];
-      case 16: return mObjectQuats[11];
-      case 17: return mObjectQuats[5];
-      case 18: return mObjectQuats[9];
-      case 19: return mObjectQuats[3];
+      mQuatIndex = new int[] { 0,1,3,2,8,9,16,23,
+                               0,15,3,17,10,37,36,8,1,24,2,22,
+                               0,2,1,3,10,8 };
       }
 
-    return null;
+    return mObjectQuats[mQuatIndex[cubit]];
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// TODO
 
   public ObjectShape getObjectShape(int variant)
     {
-    if( variant==0 )
-      {
-      float[][] vertices =
-          {
-             { 0.0f, 0.0f, 0.0f },
-             {-0.5f, 0.5f, 0.5f },
-             {-0.5f,-0.5f, 0.5f },
-             { 0.5f, 0.5f, 0.5f },
-             { 0.5f,-0.5f, 0.5f },
-             { 0.5f, 0.5f,-0.5f },
-             { 0.5f,-0.5f,-0.5f },
-             {-0.5f, 0.5f,-0.5f },
-          };
+    float SHORT_EDGE = 1.5f-0.75f*SQ2;
+    float LONG_EDGE  = 1.5f*(SQ2-1);
+    float X = variant==0 ? SHORT_EDGE : LONG_EDGE;
+    float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE;
+    float Z = SHORT_EDGE;
 
-      int[][] indices =
+    float[][] vertices =
           {
-             { 2,4,3,1 },
-             { 1,3,5,7 },
-             { 4,6,5,3 },
-
-             { 0,4,2 },
-             { 0,7,5 },
-             { 0,6,4 },
-             { 0,1,7 },
-             { 0,2,1 },
-             { 0,5,6 }
+              { -X,-Y,-Z },
+              { -X,-Y,+Z },
+              { -X,+Y,-Z },
+              { -X,+Y,+Z },
+              { +X,-Y,-Z },
+              { +X,-Y,+Z },
+              { +X,+Y,-Z },
+              { +X,+Y,+Z },
           };
 
-      return new ObjectShape(vertices, indices);
-      }
-    else
-      {
-      float[][] vertices =
+    int[][] indices =
           {
-             {-0.5f, 0.0f, 0.0f},
-             { 0.5f, 0.0f, 0.0f},
-             {-0.5f,-1.0f, 0.0f},
-             { 0.5f,-1.0f, 0.0f},
-             { 0.0f,-1.5f, 0.0f},
-             {-0.5f, 0.0f,-1.0f},
-             { 0.5f, 0.0f,-1.0f},
-             { 0.0f, 0.0f,-1.5f},
+              {1,5,7,3},
+              {3,7,6,2},
+              {5,4,6,7},
+              {0,1,3,2},
+              {4,0,2,6},
+              {0,4,5,1}
           };
 
-      int[][] indices =
-          {
-             { 0,2,4,3,1 },
-             { 0,1,6,7,5 },
-             { 1,3,6 },
-             { 5,2,0 },
-             { 4,7,6,3 },
-             { 2,5,7,4 }
-          };
-
-      return new ObjectShape(vertices, indices);
-      }
+    return new ObjectShape(vertices, indices);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// TODO
 
   public ObjectFaceShape getObjectFaceShape(int variant)
     {
+    float h1 = isInIconMode() ? 0.001f : 0.06f;
+    float h2 = 0.001f;
+    float[][] bands   = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
+    float[][] centers = { { 0.0f, 0.0f, 0.0f} };
+    float[][] corners = { {0.04f,0.10f} };
+
     if( variant==0 )
       {
-      float h1 = isInIconMode() ? 0.001f : 0.06f;
-      float h2 = isInIconMode() ? 0.001f : 0.01f;
-
-      float[][] bands     = { {h1,35,0.5f,0.7f,5,2,2}, {h2,35,0.2f,0.4f,5,2,2} };
-      int[] bandIndices   = { 0,0,0,1,1,1,1,1,1 };
-      float[][] corners   = { {0.06f,0.12f} };
-      int[] cornerIndices = { -1,0,-1,0,0,0,-1,-1 };
-      float[][] centers   = { { 0.0f, 0.0f, 0.0f} };
-      int[] centerIndices = { -1,0,-1,0,0,0,-1,-1 };
-      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
+      int[] bandIndices = { 0,0,0,1,1,1 };
+      int[] indices     = { -1,0,0,0,0,0,0,0 };
+      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
+      }
+    if( variant==1 )
+      {
+      int[] bandIndices = { 0,0,1,1,1,1 };
+      int[] indices     = { -1,0,0,0,-1,0,0,0 };
+      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
       }
     else
       {
-      float h1 = isInIconMode() ? 0.001f : 0.038f;
-      float h2 = isInIconMode() ? 0.001f : 0.020f;
-
-      float[][] bands     = { {h1,35,0.250f,0.7f,7,2,2}, {h2,35,0.125f,0.2f,3,1,2}, {h2,35,0.125f,0.2f,3,1,1} };
-      int[] bandIndices   = { 0,0,1,1,2,2 };
-      float[][] corners   = { {0.06f,0.20f} };
-      int[] cornerIndices = { 0,0,-1,-1,-1,-1,-1,-1 };
-      float[][] centers   = { { 0.0f,-0.75f,-0.75f} };
-      int[] centerIndices = { 0,0,-1,-1,-1,-1,-1,-1 };
-      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
+      int[] bandIndices = { 0,1,1,1,1,1 };
+      int[] indices     = { -1,0,-1,0,-1,0,-1,0 };
+      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
       }
     }
 
