commit d32fe3d9c0d2ff34283a71a9632563ad0af6d898
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Jan 13 14:28:47 2022 +0100

    Fix a bug in FactoryCubit: before sometimes it would incorrectly rotate a 'collapsed sticker' face if the face was flipped.
    Also: polish up the Container.

diff --git a/build.gradle b/build.gradle
index f2dc293..48a00ad 100644
--- a/build.gradle
+++ b/build.gradle
@@ -25,4 +25,5 @@ dependencies {
     implementation 'androidx.legacy:legacy-support-v13:1.0.0'
     implementation 'com.google.android.material:material:1.4.0'
     implementation project(path: ':distorted-objectlib')
+    implementation project(path: ':distorted-puzzle-jsons')
 }
diff --git a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
index d4c8bdc..42b956f 100644
--- a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
+++ b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
@@ -46,6 +46,8 @@ import org.distorted.library.type.Static4D;
 import org.distorted.objectlib.helpers.FactoryCubit;
 import org.distorted.objectlib.helpers.ObjectFaceShape;
 import org.distorted.objectlib.helpers.ObjectShape;
+import org.distorted.objectlib.main.TwistyObject;
+import org.distorted.objectlib.objects.TwistyContainer;
 
 import java.io.DataInputStream;
 import java.io.IOException;
@@ -62,9 +64,7 @@ import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
 
 class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
 {
-    private static final float SQ2 = (float)Math.sqrt(2);
     private static final float SQ3 = (float)Math.sqrt(3);
-    private static final float SQ5 = (float)Math.sqrt(5);
     private final float DEFAULT_SCALE = 0.3f;
 
     private final GLSurfaceView mView;
@@ -289,1289 +289,29 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
 
     private void createMesh()
       {
-      int mode            =24;
-      int numComponents   = 0;
-      float[][] vertices  = null;
-      int[][] vertIndexes = null;
-      float[][] bands     = null;
-      int[] bandIndexes   = null;
-      float[][] corners   = null;
-      int[] cornerIndexes = null;
-      float[][] centers   = null;
-      int[] centerIndexes = null;
-      float[] convexCenter= null;
-
-      ///// CUBE ////////////////////////////////////////////////////////////////////////////////
-
-      if( mode==0 )
-        {
-        vertices = new float[][]
-          {
-              { 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 },
-              {-0.5f,-0.5f,-0.5f },
-          };
-
-        vertIndexes = new int[][]
-          {
-              {2,3,1,0},   // counterclockwise!
-              {7,6,4,5},
-              {4,0,1,5},
-              {7,3,2,6},
-              {6,2,0,4},
-              {3,7,5,1}
-          };
-
-        bands = new float[][]
-          {
-              {0.05f,40,0.5f,0.2f,5,  2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,0,0,0,0 };
-
-        corners = new float[][]
-          {
-              { 0.01f, 0.10f }
-          };
-
-        cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
-
-        centers = new float[][]
-          {
-              { 0.0f, 0.0f, 0.0f }
-          };
-
-        centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
-
-        numComponents = 8;
-        }
-
-      ///// TETRAHEDRON //////////////////////////////////////////////////////////////////////////
-
-      else if( mode==1 )
-        {
-        vertices = new float[][]
-          {
-              {-0.5f, SQ2/4, 0.0f},
-              { 0.5f, SQ2/4, 0.0f},
-              { 0.0f,-SQ2/4, 0.5f},
-              { 0.0f,-SQ2/4,-0.5f}
-          };
-
-        vertIndexes = new int[][]
-          {
-              {2,1,0},   // counterclockwise!
-              {2,3,1},
-              {3,2,0},
-              {3,0,1}
-          };
-
-        bands = new float[][]
-          {
-              {0.05f,30,0.6f,0.5f,5,  2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,0,0 };
-
-        corners = new float[][]
-          {
-              { 0.02f, 0.10f }
-          };
-
-        cornerIndexes = new int[] { 0,0,0,0 };
-
-        centers = new float[][]
-          {
-              { 0.0f, 0.0f, 0.0f }
-          };
-
-        centerIndexes = new int[] { 0,0,0,0 };
-
-        numComponents = 4;
-        }
-
-      ///// DINO ////////////////////////////////////////////////////////////////////////////////
-
-      else if( mode==2 )
-        {
-        vertices = new float[][]
-          {
-             {-1.5f, 0.0f, 0.0f},
-             { 1.5f, 0.0f, 0.0f},
-             { 0.0f,-1.5f, 0.0f},
-             { 0.0f, 0.0f,-1.5f}
-          };
-
-        vertIndexes = new int[][]
-          {
-             {2,1,0},   // counterclockwise!
-             {3,0,1},
-             {2,3,1},
-             {3,2,0},
-          };
-
-        bands = new float[][]
-          {
-              {0.035f,30,0.16f,0.8f,6,2,2},
-              {0.010f,45,0.16f,0.2f,6,2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,1,1 };
-
-        corners = new float[][]
-          {
-               {0.07f,0.40f},
-               {0.05f,0.30f}
-          };
-
-        cornerIndexes = new int[] { 0,0,1,1 };
-
-        centers = new float[][]
-          {
-              { 0.0f,-0.75f,-0.75f }
-          };
-
-        centerIndexes = new int[] { 0,0,0,0 };
-
-        numComponents = 4;
-        }
-
-      ///// OCTAHEDRON ////////////////////////////////////////////////////////////////////////////
-
-      else if( mode==3 )
-        {
-        vertices = new float[][]
-          {
-              { 0.5f,   0.0f, 0.5f},
-              { 0.5f,   0.0f,-0.5f},
-              {-0.5f,   0.0f,-0.5f},
-              {-0.5f,   0.0f, 0.5f},
-              { 0.0f,  SQ2/2, 0.0f},
-              { 0.0f, -SQ2/2, 0.0f},
-          };
-
-        vertIndexes = new int[][]
-          {
-              {3,0,4},   // counterclockwise!
-              {0,1,4},
-              {1,2,4},
-              {2,3,4},
-              {5,0,3},
-              {5,1,0},
-              {5,2,1},
-              {5,3,2}
-          };
-
-        bands = new float[][]
-          {
-             {0.05f,17,0.5f,0.2f,5,  2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,0,0,0,0,0,0 };
-
-        corners = new float[][]
-          {
-              { 0.03f, 0.12f }
-          };
-
-        cornerIndexes = new int[] { 0,0,0,0,0,0 };
-
-        centers = new float[][]
-          {
-              { 0.0f, 0.0f, 0.0f }
-          };
-
-        centerIndexes = new int[] { 0,0,0,0,0,0 };
-
-        numComponents = 8;
-        }
-
-      ///// KILOMINX EDGE ////////////////////////////////////////////////////////////////////////
-
-      else if( mode==4 )
-        {
-        float SQ5  = (float)Math.sqrt(5);
-        float SIN18= (SQ5-1)/4;
-        float COS18= 0.25f*(float)Math.sqrt(10.0+2.0*SQ5);
-        float H = 1.0f;
-        float L = 2.0f;
-        float X = H*(float)Math.sqrt((5+SQ5)/10);
-        float Y = H*(float)Math.sqrt((5-SQ5)/10);
-        float D = H*SIN18/COS18;
-
-        vertices = new float[][]
-          {
-              { 0.0f,    Y, L/2},
-              {    X, 0.0f, L/2},
-              { 0.0f,   -Y, L/2},
-              {   -X, 0.0f, L/2},
-              { 0.0f,    Y, -L/2 +D},
-              {    X, 0.0f,-L/2   },
-              { 0.0f,   -Y, -L/2-D },
-              {   -X, 0.0f,-L/2   }
-          };
-
-        vertIndexes = new int[][]
-          {
-              {3,2,1,0},   // counterclockwise!
-              {0,1,5,4},
-              {3,0,4,7},
-              {2,1,5,6},
-              {3,2,6,7},
-              {4,5,6,7}
-          };
-
-        bands = new float[][]
-          {
-             {0.04f,13,(float)(L/3),(float)L/8, 5,2,3},
-             {0.00f, 0,(float)(L/2),(float)L/4, 5,2,3}
-          };
-
-        bandIndexes = new int[] { 1,0,0,1,1,1 };
-
-        corners = new float[][]
-          {
-              { 0.04f, 0.12f }
-          };
-
-        cornerIndexes = new int[] { 0,-1,-1,-1,0,-1,-1,-1 };
-
-        centers = new float[][]
-          {
-              { 0.0f, 0.0f, 0.0f }
-          };
-
-        centerIndexes = new int[] { 0,-1,-1,-1,0,-1,-1,-1 };
-
-        numComponents = 6;
-        }
-
-      ///// IVY_CORNER ////////////////////////////////////////////////////////////////////////
-
-      else if( mode==5 )
-        {
-        int IVY_N = 8;
-        final float IVY_D = 0.003f;
-        final float angle = (float)Math.PI/(2*IVY_N);
-        final float CORR  = 1.0f - 2*IVY_D;
-
-        vertices = new float[3*IVY_N+7][3];
-        vertIndexes = new int[6][IVY_N+4];
-
-        vertices[0][0] = 0.0f;
-        vertices[0][1] = 0.0f;
-        vertices[0][2] = 0.0f;
-        vertices[1][0] =-1.0f;
-        vertices[1][1] = 0.0f;
-        vertices[1][2] = 0.0f;
-        vertices[2][0] = 0.0f;
-        vertices[2][1] =-1.0f;
-        vertices[2][2] = 0.0f;
-        vertices[3][0] = 0.0f;
-        vertices[3][1] = 0.0f;
-        vertices[3][2] =-1.0f;
-
-        vertIndexes[0][0] = 2;
-        vertIndexes[0][1] = 0;
-        vertIndexes[0][2] = 1;
-        vertIndexes[3][0] = 2;
-        vertIndexes[3][1] = 0;
-        vertIndexes[3][2] = 1;
-
-        vertIndexes[1][0] = 3;
-        vertIndexes[1][1] = 0;
-        vertIndexes[1][2] = 2;
-        vertIndexes[4][0] = 3;
-        vertIndexes[4][1] = 0;
-        vertIndexes[4][2] = 2;
-
-        vertIndexes[2][0] = 1;
-        vertIndexes[2][1] = 0;
-        vertIndexes[2][2] = 3;
-        vertIndexes[5][0] = 1;
-        vertIndexes[5][1] = 0;
-        vertIndexes[5][2] = 3;
-
-        int N1 = 4;
-        int N2 = N1 + IVY_N + 1;
-        int N3 = N2 + IVY_N + 1;
-
-        for(int i=0; i<=IVY_N; i++)
-          {
-          float cos1 = (float)Math.cos((IVY_N-i)*angle);
-          float sin1 = (float)Math.sin((IVY_N-i)*angle);
-          float cos2 = (float)Math.cos((      i)*angle);
-          float sin2 = (float)Math.sin((      i)*angle);
-
-          vertices[N1+i][0] = CORR*(cos1-0.5f) - 0.5f;
-          vertices[N1+i][1] = CORR*(sin1-0.5f) - 0.5f;
-          vertices[N1+i][2] = 0.0f;
-
-          vertices[N2+i][0] = 0.0f;
-          vertices[N2+i][1] = CORR*(sin2-0.5f) - 0.5f;
-          vertices[N2+i][2] = CORR*(cos2-0.5f) - 0.5f;
-
-          vertices[N3+i][0] = CORR*(cos2-0.5f) - 0.5f;
-          vertices[N3+i][1] = 0.0f;
-          vertices[N3+i][2] = CORR*(sin2-0.5f) - 0.5f;
-
-          vertIndexes[0][i+3] = N1 + i;
-          vertIndexes[1][i+3] = N2 + i;
-          vertIndexes[2][i+3] = N3 + i;
-          vertIndexes[3][i+3] = N1 + i;
-          vertIndexes[4][i+3] = N2 + i;
-          vertIndexes[5][i+3] = N3 + i;
-          }
-
-        bands = new float[][]
-          {
-             {+0.012f,20,0.2f,0.5f,7,1,2},
-             {-0.100f,20,0.2f,0.0f,2,1,2}
-          };
+      Static4D quat = new Static4D(0,0,0,1);
+      Static3D move = new Static3D(0,0,0);
+      float scale   = 1.0f;
+      int variant   = 1;
 
-        bandIndexes = new int[] { 0,0,0,1,1,1 };
+      int[] numLayers = new int[] {2,2,2,2};
+      TwistyObject puzzle = new TwistyContainer(numLayers,MESH_NICE,quat,move,scale,null);
 
-        corners = new float[][]
-          {
-              { 0.04f, 0.12f }
-          };
-
-        cornerIndexes = new int[3*IVY_N+7];
-
-        centers = new float[][]
-          {
-              {-0.5f,-0.5f,-0.5f}
-          };
-
-        centerIndexes = new int[3*IVY_N+7];
-
-        for(int i=0; i<4; i++)
-          {
-          cornerIndexes[i] = 0;
-          centerIndexes[i] = 0;
-          }
-        for(int i=4; i<3*IVY_N+7; i++)
-          {
-          cornerIndexes[i] = -1;
-          centerIndexes[i] = -1;
-          }
-
-        float C = 0.5f - SQ2/4;
-        convexCenter = new float[] {-C,-C,-C};
-
-        numComponents = 6;
-        }
-
-      ///// IVY_FACE ////////////////////////////////////////////////////////////////////////
-
-      else if( mode==6 )
-        {
-        int IVY_N = 6;
-        final float IVY_D = 0.003f;
-        final float angle = (float)Math.PI/(2*IVY_N);
-        final float CORR  = 1.0f - 2*IVY_D;
-
-        vertices   = new float[2*IVY_N][3];
-        vertIndexes= new int[2][2*IVY_N];
-
-        for(int i=0; i<IVY_N; i++)
-          {
-          float cos = (float)Math.cos(i*angle);
-          float sin = (float)Math.sin(i*angle);
-
-          vertices[i      ][0] = CORR*(0.5f-cos);
-          vertices[i      ][1] = CORR*(0.5f-sin);
-          vertices[i      ][2] = 0.0f;
-          vertices[i+IVY_N][0] = CORR*(cos-0.5f);
-          vertices[i+IVY_N][1] = CORR*(sin-0.5f);
-          vertices[i+IVY_N][2] = 0.0f;
-
-          vertIndexes[0][i      ] = i;
-          vertIndexes[0][i+IVY_N] = i+IVY_N;
-          vertIndexes[1][i      ] = i;
-          vertIndexes[1][i+IVY_N] = i+IVY_N;
-          }
-
-        bands = new float[][]
-          {
-             {+0.012f,20,0.2f,0.5f,7,1,2},
-             {-0.100f,20,0.2f,0.0f,2,1,2},
-          };
-
-        bandIndexes = new int[] { 0,1 };
-
-        corners = new float[][]
-          {
-             {0.03f,0.10f}
-          };
-
-        centers = new float[][]
-          {
-              {-0.0f,-0.0f,-0.5f}
-          };
-
-        cornerIndexes = new int[2*IVY_N];
-        centerIndexes = new int[2*IVY_N];
-
-        for(int i=0; i<2*IVY_N; i++)
-          {
-          cornerIndexes[i] = -1;
-          centerIndexes[i] = -1;
-          }
-
-        cornerIndexes[0    ] = 0;
-        cornerIndexes[IVY_N] = 0;
-        centerIndexes[0    ] = 0;
-        centerIndexes[IVY_N] = 0;
-
-        numComponents = 2;
-        }
-
-      ///// SKEWB Ultimate SMALL  /////////////////////////////////////////////////////////////
-
-      else if( mode==7 )
-        {
-        float S = (SQ5+1)/4;
-
-        vertices = new float[][]
-          {
-              { 0.0f        ,  0.0f       , 0.0f       },
-              { -0.5f*S     , 0.5f*S+0.25f, -0.25f     },
-              {-0.25f       , -S/2        , (-2*S-1)/4 },
-              { 0.5f*S+0.25f, 0.25f       , -S/2       },
-              { 0.0f        , 0.5f        , -S-0.5f    },
-              { 0.0f        , 0.5f        , 0.0f       },
-              { -0.5f*S     ,-0.5f*S+0.25f, -0.25f     },
-              {  0.5f*S     ,-0.5f*S+0.25f, -0.25f     }
-          };
-
-        vertIndexes = new int[][]
-          {
-              {6,0,5,1},   // counterclockwise!
-              {0,7,3,5},
-              {0,6,2,7},
-              {4,3,5,1},
-              {4,2,7,3},
-              {4,1,6,2},
-          };
-
-        bands = new float[][]
-          {
-             {0.04f,17,0.5f,0.2f,5,  2,2},
-             {0.01f, 1,0.5f,0.2f,5,  2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,0,1,1,1 };
+      ObjectShape shape   = puzzle.getObjectShape(variant);
+      ObjectFaceShape face= puzzle.getObjectFaceShape(variant);
 
-        corners = new float[][]
-          {
-              { 0.013f, 0.08f }
-          };
-
-        cornerIndexes = new int[] { 0, 0, 0, 0,-1,0,0,0 };
-
-        centers = new float[][]
-          {
-              { 0.0f,-0.5f, (float)(-S-0.5) }
-          };
-
-        centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
-
-        numComponents = 8;
-        }
-
-      ///// SKEWB Ultimate BIG ///////////////////////////////////////////////////////////////
-
-      else if( mode==8 )
-        {
-        float S = (SQ5+1)/4;
-
-        vertices = new float[][]
-          {
-              {-S/2      ,-S/2+0.25f,     0.25f},
-              { S/2      , S/2-0.25f,    -0.25f},
-              {-S        ,     0.00f,     0.00f},
-              {     0.25f, S/2      ,-S/2-0.25f},
-              {-S/2      ,-S/2-0.25f,     0.25f},
-              { S/2+0.25f,    -0.25f,-S/2      },
-              {-S        ,    -0.50f,     0.00f},
-              {     0.50f,     0.00f,-S        },
-              {-S  +0.25f, S/2      ,-S/2-0.25f},
-              {     0.25f,-S/2-0.50f,-S/2+0.25f},
-              {-S/2      ,-S/2-0.25f,-S  -0.25f}
-          };
-
-        vertIndexes = new int[][]
-          {
-              {0,1,3,8,2},   // counterclockwise!
-              {0,4,9,5,1},
-              { 0,2,6,4},
-              { 1,5,7,3},
-              {10,9,4,6},
-              {10,9,5,7},
-              {10,8,3,7},
-              {10,8,2,6}
-          };
-
-        bands = new float[][]
-          {
-             {0.04f,17,0.5f,0.2f,5,  2,2},
-             {0.04f,17,0.5f,0.2f,5,  2,2},
-             {0.01f, 1,0.5f,0.2f,5,  2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,1,1,2,2,2,2 };
-
-        corners = new float[][]
-          {
-              { 0.013f, 0.08f }
-          };
-
-        cornerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,-1 };
-
-        centers = new float[][]
-          {
-              { (float)(-S/2), 0.25f, (float)(-S/2-0.5) }
-          };
-
-        centerIndexes = new int[] { 0,0,0,0,0,0,0,0,0,0,0 };
-
-        numComponents = 8;
-        }
-
-      ///// SQUARE-1 MIDDLE ///////////////////////////////////////////////////////////////
-
-      else if( mode==9 )
-        {
-        final float X = 3*(2-SQ3)/2;
-
-        vertices = new float[][]
-          {
-              { -1.5f-X, 0.5f, 1.5f },
-              {    0.0f, 0.5f, 1.5f },
-              {    0.0f, 0.5f,-1.5f },
-              { -1.5f+X, 0.5f,-1.5f },
-              { -1.5f-X,-0.5f, 1.5f },
-              {    0.0f,-0.5f, 1.5f },
-              {    0.0f,-0.5f,-1.5f },
-              { -1.5f+X,-0.5f,-1.5f }
-          };
-
-        vertIndexes = new int[][]
-          {
-              {0,1,2,3},   // counterclockwise!
-              {4,5,6,7},
-              {4,5,1,0},
-              {5,6,2,1},
-              {6,7,3,2},
-              {7,4,0,3}
-          };
-
-        bands = new float[][]
-          {
-             {0.040f,35,0.8f,1.0f,5,2,1},
-             {0.020f,35,0.8f,1.0f,5,2,1},
-             {0.001f,35,0.8f,1.0f,5,2,1}
-          };
-
-        bandIndexes = new int[] { 2,2,1,1,0,2 };
-
-        corners = new float[][]
-          {
-              {0.04f,0.05f}
-          };
-
-        cornerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
-
-        centers = new float[][]
-          {
-              { -0.75f, 0.0f, 0.0f}
-          };
-
-        centerIndexes = new int[] { 0,0,0,0,0,0,0,0 };
-
-        numComponents = 6;
-        }
-
-      ///// SQUARE-1 EDGE ///////////////////////////////////////////////////////////////
-
-      else if( mode==10 )
-        {
-        final float X = 3*(2-SQ3)/2;
-
-        vertices = new float[][]
-          {
-              {  -X, 0.5f, 0.0f },
-              {  +X, 0.5f, 0.0f },
-              {0.0f, 0.5f,-1.5f },
-              {  -X,-0.5f, 0.0f },
-              {  +X,-0.5f, 0.0f },
-              {0.0f,-0.5f,-1.5f },
-          };
-
-        vertIndexes = new int[][]
-          {
-              {0,1,2},   // counterclockwise!
-              {3,4,5},
-              {3,4,1,0},
-              {4,5,2,1},
-              {5,3,0,2}
-          };
-
-        bands = new float[][]
-          {
-            {0.038f,35,0.5f,0.9f, 5,2,1},
-            {0.001f,35,0.5f,0.9f, 5,2,1}
-          };
-
-        bandIndexes = new int[]  { 0,1,0,1,1 };
-
-        corners = new float[][]
-          {
-             {0.06f,0.20f}
-          };
-
-        cornerIndexes = new int[] { 0,0,-1,0,0,-1 };
-
-        centers = new float[][]
-          {
-              { 0.0f, 0.0f,-0.5f}
-          };
-
-        centerIndexes = new int[] { 0,0,-1,0,0,-1 };
-
-        numComponents = 6;
-        }
-
-      ///// SQUARE-1 CORNER ///////////////////////////////////////////////////////////////
-
-      else if( mode==11 )
-        {
-        final float X = 3*(2-SQ3)/2;
-
-        vertices = new float[][]
-          {
-              { X-1.5f, 0.5f,  0.0f },
-              {   0.0f, 0.5f,  0.0f },
-              {   0.0f, 0.5f,X-1.5f },
-              {  -1.5f, 0.5f, -1.5f },
-              { X-1.5f,-0.5f,  0.0f },
-              {   0.0f,-0.5f,  0.0f },
-              {   0.0f,-0.5f,X-1.5f },
-              {  -1.5f,-0.5f, -1.5f }
-          };
-
-        vertIndexes = new int[][]
-          {
-              {0,1,2,3},   // counterclockwise!
-              {4,5,6,7},
-              {4,5,1,0},
-              {5,6,2,1},
-              {7,4,0,3},
-              {6,7,3,2}
-          };
-
-        bands = new float[][]
-          {
-            {0.038f,35,0.9f,1.0f, 5,2,1},
-            {0.001f,35,0.9f,1.0f, 5,2,1}
-          };
-
-        bandIndexes = new int[]  { 0,1,0,0,1,1 };
-
-        corners = new float[][]
-          {
-            {0.08f,0.20f}
-          };
-
-        cornerIndexes = new int[] { 0,0,0,-1,0,0,0,-1 };
-
-        centers = new float[][]
-          {
-             { -0.5f, 0.0f,-0.5f}
-          };
-
-        centerIndexes = new int[] { -1,0,-1,-1,-1,0,-1,-1 };
-
-        numComponents = 6;
-        }
-
-      ///// SQUARE-2 CORNER ///////////////////////////////////////////////////////////////
-
-      else if( mode==12 )
-        {
-        final float X = 3*(2-SQ3)/2;
-        final float Z = 0.75f - X/2;
-
-        vertices = new float[][]
-          {
-              { X-1.5f+Z, 0.5f,  0.0f },
-              {        Z, 0.5f,  0.0f },
-              {  -1.5f+Z, 0.5f, -1.5f },
-              { X-1.5f+Z,-0.5f,  0.0f },
-              {        Z,-0.5f,  0.0f },
-              {  -1.5f+Z,-0.5f, -1.5f }
-          };
-
-        vertIndexes = new int[][]
-          {
-              {0,1,2},   // counterclockwise!
-              {5,4,3},
-              {3,4,1,0},
-              {4,5,2,1},
-              {5,3,0,2}
-          };
-
-        bands = new float[][]
-          {
-            {0.040f,35,0.9f,1.0f, 5,2,1},
-            {0.001f,35,0.9f,1.0f, 5,2,1}
-          };
-
-        bandIndexes = new int[] { 0,0,0,1,1 };
-
-        corners = new float[][]
-          {
-            {0.05f,0.13f}
-          };
-
-        cornerIndexes = new int[] { 0,0,-1,0,0,-1 };
-
-        centers = new float[][]
-          {
-             { 0.0f, 0.0f,-0.5f}
-          };
-
-        centerIndexes = new int[] { 0,0,-1,0,0,-1 };
-
-        numComponents = 5;
-        }
-
-      ///// REDI CORNER ///////////////////////////////////////////////////////////////
-
-      else if( mode==13 )
-        {
-        vertices = new float[][]
-          {
-             { 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 },
-          };
-
-        vertIndexes = new int[][]
-          {
-             { 2,4,3,1 },
-             { 1,3,5,7 },
-             { 4,6,5,3 },
-
-             { 2,4,0 },
-             { 5,7,0 },
-             { 4,6,0 },
-             { 7,1,0 },
-             { 1,2,0 },
-             { 6,5,0 }
-          };
-
-        bands = new float[][]
-          {
-             {0.06f,35,0.5f,0.7f,5,2,2},
-             {0.01f,35,0.2f,0.4f,5,2,2}
-          };
-
-        bandIndexes = new int[] { 0,0,0,1,1,1,1,1,1 };
-
-        corners = new float[][]
-          {
-            {0.06f,0.12f}
-          };
-
-        cornerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 };
-
-        centers = new float[][]
-          {
-             { 0.0f, 0.0f, 0.0f}
-          };
-
-        centerIndexes = new int[] { -1,0,-1,0,0,0,-1,-1 };
-
-        numComponents = 9;
-        }
-
-      ///// JING CORNER ///////////////////////////////////////////////////////////////
-
-      else if( mode==14 )
-        {
-        final float F = 0.24f;
-        final float X = F/2;
-        final float Y = F*SQ2/2;
-        final float Z =-F/2;
-
-        vertices = new float[][]
-          {
-             { 0.0f, 0.0f,  0.0f },
-             {    X,    Y,     Z },
-             { 0.0f,  2*Y,   2*Z },
-             {   -X,    Y,     Z },
-             { 0.0f, 0.0f,    -F },
-             {    X,    Y,   Z-F },
-             { 0.0f,  2*Y, 2*Z-F },
-             {   -X,    Y,   Z-F },
-          };
-
-        vertIndexes = new int[][]
-          {
-             {0,1,2,3},
-             {1,0,4,5},
-             {7,4,0,3},
-             {1,5,6,2},
-             {7,3,2,6},
-             {4,7,6,5}
-          };
-
-        bands = new float[][]
-          {
-             {0.015f,35,0.5f*F,F,5,1,1},
-             {0.001f,35,0.5f*F,F,5,1,1}
-          };
-
-        bandIndexes = new int[] { 0,0,0,1,1,1 };
-
-        corners = new float[][]
-          {
-            {0.08f,0.20f*F},
-            {0.07f,0.20f*F}
-          };
-
-        cornerIndexes = new int[] { 0,1,1,-1,1,-1,-1,-1 };
-
-        centers = new float[][]
-          {
-             { 0.0f, Y, Z-F/2}
-          };
-
-        centerIndexes = new int[] { 0,0,0,-1,0,-1,-1,-1 };
-
-        numComponents = 6;
-        }
-
-      ///// JING EDGE ///////////////////////////////////////////////////////////////
-
-      else if( mode==15 )
-        {
-        final float F = 0.24f;
-        final float X = F/2;
-        final float Y = F*SQ2/2;
-        final float Z =-F/2;
-
-        vertices = new float[][]
-          {
-             { 0.0f, 0.0f,     0.5f-F },
-             {    X,    Y,   Z+0.5f-F },
-             { 0.0f,  2*Y, 2*Z+0.5f-F },
-             {   -X,    Y,   Z+0.5f-F },
-             { 0.0f, 0.0f,    -0.5f+F },
-             {    X,    Y,  -Z-0.5f+F },
-             { 0.0f,  2*Y,-2*Z-0.5f+F },
-             {   -X,    Y,  -Z-0.5f+F },
-          };
-
-        vertIndexes = new int[][]
-          {
-             {0,4,5,1},
-             {3,7,4,0},
-             {0,1,2,3},
-             {4,7,6,5},
-             {1,5,6,2},
-             {2,6,7,3}
-          };
-
-        bands = new float[][]
-          {
-             {0.015f,35,0.5f*F,F,5,1,1},
-             {0.001f,35,0.5f*F,F,5,1,1}
-          };
-
-        bandIndexes = new int[] { 0,0,1,1,1,1 };
-
-        corners = new float[][]
-          {
-            {0.07f,0.20f*F}
-          };
-
-        cornerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 };
-
-        centers = new float[][]
-          {
-             { 0, F*SQ2/2, 0 }
-          };
-
-        centerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 };
-
-        numComponents = 6;
-        }
-
-      ///// JING FACE ///////////////////////////////////////////////////////////////
-
-      else if( mode==16 )
-        {
-        final float F = 0.24f;
-        final float L = (1-3*F);
-        final float X = L/2;
-        final float Y = L*SQ2/2;
-        final float Z =-L/2;
-        final float D = F/L;
-
-        vertices = new float[][]
-          {
-              {    0.0f,     -2*Y/3,   -2*Z/3 },
-              {       X,        Y/3,      Z/3 },
-              {      -X,        Y/3,      Z/3 },
-              {    0.0f,     -2*Y/3,   -2*Z/3+2*D*Z },
-              {   X-D*X,    Y/3-D*Y,  Z/3+D*Z },
-              {  -X+D*X,    Y/3-D*Y,  Z/3+D*Z },
-          };
-
-        vertIndexes = new int[][]
-          {
-             {0,1,2},
-             {3,5,4},
-             {0,3,4,1},
-             {5,3,0,2},
-             {4,5,2,1}
-          };
-
-        bands = new float[][]
-          {
-             {0.025f,35,0.20f*(1-3*F),0.6f*(1-3*F),5,1,1},
-             {0.001f,35,0.05f*(1-3*F),0.1f*(1-3*F),5,1,1}
-          };
-
-        bandIndexes = new int[] { 0,1,1,1,1,1 };
-
-        corners = new float[][]
-          {
-            {0.04f,0.15f}
-          };
-
-        cornerIndexes = new int[] { 0,0,0,-1,-1,-1 };
-
-        centers = new float[][]
-          {
-            { 0, -2*Y/3, 4*Z/3 }
-          };
-
-        centerIndexes = new int[] { 0,0,0,-1,-1,-1 };
-
-        numComponents = 6;
-        }
-
-      ///// REX PETAL ///////////////////////////////////////////////////////////////
-
-      else if( mode==17 )
-        {
-        final float REX_D = 0.2f;
-        float G = (1-REX_D)*SQ2/2;
-        vertices = new float[][] {{-0.10f,0.70f,0},{-0.70f,0.10f,0},{+0.65f,-0.71f,0},{+0.71f,-0.65f,0},{0,0.05f,-0.2f} };
-        vertIndexes = new int[][] { {0,1,2,3},{0,3,4},{3,2,4},{2,1,4},{1,0,4} };
-        centers= new float[][] { {0.0f,0.0f,-G} };
-        corners= new float[][] { {0.03f,0.30f} };
-        cornerIndexes = new int[] {-1,-1,0,0,-1};
-        centerIndexes = new int[] {-1,-1,0,0,-1};
-        bandIndexes   = new int[] { 0,1,1,1,1 };
-        bands = new float[][] { {+0.016f,10,G/3,0.5f,5,1,1},{ +0.0f,45,0.1f,0.1f,2,0,0} };
-
-        numComponents = 5;
-        }
-
-      ///// TRAJBER'S FACE ///////////////////////////////////////////////////////////////
-
-      else if( mode==18 )
-        {
-        final float CUT = 1.0f/6;
-        final float LEN = 1.5f;
-
-        final float A = SQ2*CUT*LEN;
-        final float B =   2*CUT*LEN;
-
-        vertices = new float[][]
-          {
-             {    0.01f,    0.01f,    0},
-             {    A,    A,   -A},
-             {    A,   -A,   -A},
-             {    B,    0,    0},
-             {    0,    0,   -B},
-             {  A+B,    A,   -A},
-             {  A+B,   -A,   -A},
-             {    A,    A, -A-B},
-             {    A,   -A, -A-B},
-
-             {  LEN      ,    A, SQ2*A-LEN},
-             {  LEN      ,   -A, SQ2*A-LEN},
-             {  LEN-SQ2*A,    A,      -LEN},
-             {  LEN-SQ2*A,   -A,      -LEN}
-          };
-
-        vertIndexes = new int[][]
-          {
-             {0,3,5,1},
-             {0,2,6,3},
-             {0,4,8,2},
-             {0,1,7,4},
-             {3,6,10,9,5},
-             {2,8,12,10,6},
-             {4,7,11,12,8},
-             {1,5,9,11,7},
-             {9,10,12,11}
-          };
-
-         bands         = new float[][] { {0.05f,35,0.15f,0.3f,4,1,1},{0.00f,35,0.15f,0.3f,3,0,0} };
-         bandIndexes   = new int[] { 0,0,0,0,1,1,1,1,1 };
-         corners       = new float[][] { {0.03f,0.10f} };
-         cornerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
-         centers       = new float[][] { { LEN/2, 0.0f, -LEN/2} };
-         centerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
-
-         numComponents = 9;
-         }
-
-      ///// TRAJBER'S EDGE ///////////////////////////////////////////////////////////////
-
-      else if( mode==19 )
-        {
-        final float CUT = 1.0f/6;
-        final float LEN = 1.5f;
-
-        final float A = SQ2*CUT*LEN;
-        final float B = LEN-2*LEN*CUT;
-
-        vertices = new float[][]
-          {
-             {    -B,     0,   0},
-             {  -B+A, SQ2*A,  -A},
-             {  -B+A,-SQ2*A,  -A},
-             {     B,     0,   0},
-             {   B-A, SQ2*A,  -A},
-             {   B-A,-SQ2*A,  -A},
-             {     0, SQ2*A,  -B},
-             {     0,-SQ2*A,  -B},
-          };
-
-        vertIndexes = new int[][]
-          {
-             {0,3,4,1},
-             {0,2,5,3},
-             {1,4,6},
-             {2,7,5},
-             {0,1,6,7,2},
-             {3,5,7,6,4}
-          };
-
-        bands        = new float[][] { {0.03f,35,0.15f,0.3f,3,1,1},{0.00f,35,0.15f,0.3f,3,0,0} };
-        bandIndexes  = new int[] { 0,0,1,1,1,1 };
-        corners      = new float[][] { {0.02f,0.10f} };
-        cornerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 };
-        centers      = new float[][] { { 0, 0, -LEN/2} };
-        centerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 };
-
-        numComponents = 9;
-        }
-
-      ///// TRAJBER'S CORNER ///////////////////////////////////////////////////////////////
-
-      else if( mode==20 )
-        {
-        final float CUT = 1.0f/6;
-        final float LEN = 1.5f;
-
-        final float A = SQ2*CUT*LEN;
-        final float C = LEN-2*LEN*CUT;
-        final float L = C-A;
-
-        vertices = new float[][]
-          {
-             { -L, -(SQ2/3)*L,   L/3 },
-             {  L, -(SQ2/3)*L,   L/3 },
-             {  0,(2*SQ2/3)*L,-2*L/3 },
-             {  0, -(SQ2/3)*L,-2*L/3 },
-          };
-
-        vertIndexes = new int[][]
-          {
-             {0,1,2},
-             {0,1,3},
-             {0,2,3},
-             {1,3,2},
-          };
-
-        bands        = new float[][] { {0.05f,35,0.15f,0.3f,4,1,1},{0.00f,35,0.15f,0.3f,4,0,0} };
-        bandIndexes  = new int[] { 0,1,1,1 };
-        corners      = new float[][] { {0.02f,0.10f} };
-        cornerIndexes= new int[] { 0,0,0,-1 };
-        centers      = new float[][] { {0, -(SQ2/3)*L,-2*L/3} };
-        centerIndexes= new int[] { 0,0,0,-1 };
-
-        numComponents = 9;
-        }
-
-      ///// WINDMILL CORNER ///////////////////////////////////////////////////////////////
-
-      else if( mode==21 )
-        {
-        final float X = 1.8f;  // the cut goes from a corner and splits the opposing side 1.2 / 1.8
-        final float h = 3*X*X/(X*X+9);
-        final float d = h*X/3;
-        final float l = X/2;
-
-        vertices = new float[][]
-          {
-             {  -l, 0.5f, 0.0f },
-             {   l, 0.5f, 0.0f },
-             {   l,-0.5f, 0.0f },
-             {  -l,-0.5f, 0.0f },
-             { d-l, 0.5f,   -h },
-             { d-l,-0.5f,   -h },
-          };
-
-        vertIndexes = new int[][]
-          {
-             { 3,2,1,0 },
-             { 0,1,4 },
-             { 5,2,3 },
-             { 5,3,0,4 },
-             { 2,5,4,1 },
-          };
-
-        bands        = new float[][] { {0.03f,20,0.2f,0.4f,5,1,1}, {0.01f,20,0.2f,0.4f,5,1,1} };
-        bandIndexes  = new int[] { 0,0,0,1,1 };
-        corners      = new float[][] { {0.05f,0.10f} };
-        cornerIndexes= new int[] { 0,0,0,0,-1,-1 };
-        centers      = new float[][] { { d-l, 0.0f,-h } };
-        centerIndexes= new int[] { 0,0,0,0,-1,-1 };
-
-        numComponents = 5;
-        }
-
-      ///// WINDMILL EDGE ///////////////////////////////////////////////////////////////
-
-      else if( mode==22 )
-        {
-        final float X = 1.8f;  // the cut goes from a corner and splits the opposing side 1.2 / 1.8
-        final float h = 3*X*X/(X*X+9);
-        final float d = h*X/3;
-        final float H = 3*h/X;
-        final float l = (3-X)/2;
-
-        vertices = new float[][]
-          {
-             { -l, 0.5f, 0.0f },
-             {  l, 0.5f, 0.0f },
-             {  l,-0.5f, 0.0f },
-             { -l,-0.5f, 0.0f },
-             {h-l, 0.5f,  -H  },
-             {d+l, 0.5f,  -h  },
-             {d+l,-0.5f,  -h  },
-             {h-l,-0.5f,  -H  }
-          };
-
-        vertIndexes = new int[][]
-          {
-             { 3,2,1,0 },
-             { 0,1,5,4 },
-             { 7,6,2,3 },
-             { 2,6,5,1 },
-             { 6,7,4,5 },
-             { 7,3,0,4 }
-          };
-
-        bands        = new float[][] { {0.03f,20,0.2f,0.4f,5,1,1}, {0.01f,20,0.2f,0.4f,5,1,1} };
-        bandIndexes  = new int[] { 0,0,0,1,1,1 };
-        corners      = new float[][] { {0.05f,0.10f} };
-        cornerIndexes= new int[] { 0,0,0,0,-1,-1,-1,-1 };
-        centers      = new float[][] { {h-l, 0.5f, -H } };
-        centerIndexes= new int[] { 0,0,0,0,-1,-1,-1,-1 };
-
-        numComponents = 6;
-        }
-
-      ///// Pyramorphics corner ///////////////////////////////////////////////////////////////
-
-      else if( mode==23 )
-        {
-        final float Y = SQ2/2;
-        final float Z = 1.0f;
-
-        vertices = new float[][]
-          {
-              {0.0f, 2*Y/3, 2*Z/3 },
-              {0.0f, 2*Y/3,  -Z/3 },
-              { Z/2,  -Y/3,   Z/6 },
-              {-Z/2,  -Y/3,   Z/6 },
-              {0.0f,  -Y/3,  -Z/3 }
-          };
-
-        vertIndexes  = new int[][] { {3,2,0},{2,1,0},{1,3,0},{1,2,4},{3,1,4},{2,3,4} };
-        bands        = new float[][] { {0.03f,40,0.2f,0.4f,5,1,1}, {0.001f,40,0.2f,0.4f,5,1,1} };
-        bandIndexes  = new int[] { 0,0,0,1,1,1 };
-        corners      = new float[][] { {0.08f,0.13f} };
-        cornerIndexes= new int[] { 0,0,0,0,-1 };
-        centers      = new float[][] { { 0.0f,0.0f,0.0f } };
-        centerIndexes= new int[] { 0,0,0,0,-1 };
-        }
-
-      ///// Pyramorphics face ///////////////////////////////////////////////////////////////
-
-      else if( mode==24 )
-        {
-        final float X = 1.0f;
-        final float Y = SQ2/2;
-        final float Z = 0.5f;
-
-        vertices = new float[][]
-          {
-              {-X/2,   Y/3,   Z/3 },
-              { X/2,   Y/3,   Z/3 },
-              {0.0f,-2*Y/3,-2*Z/3 },
-              {0.0f,   Y/3,-2*Z/3 }
-          };
-
-        vertIndexes  = new int[][]  { {0,2,1},{0,1,3},{2,3,1},{2,0,3} };
-        bands        = new float[][]  { {0.03f,30,0.15f,0.5f,5,1,2}, {0.001f,30,0.25f,0.5f,5,1,2} };
-        bandIndexes  = new int[] { 0,1,1,1 };
-        corners      = new float[][] { {0.09f,0.13f} };
-        cornerIndexes= new int[] { 0,0,0,-1 };
-        centers      = new float[][] { { 0.0f, Y/3,-2*Z/3 } };
-        centerIndexes= new int[] { 0,0,0,-1 };
-        }
-
-      ///// END DEFINITIONS /////////////////////////////////////////////////////////////////
+      int[][] indices = shape.getVertIndices();
+      int numComponents = indices.length;
+      int[] outer = new int[numComponents];
 
       FactoryCubit factory = FactoryCubit.getInstance();
       factory.clear();
-
-      ObjectShape shape   = new ObjectShape(vertices,vertIndexes);
-      ObjectFaceShape face= new ObjectFaceShape(bands,bandIndexes,corners,cornerIndexes,centers,centerIndexes,convexCenter);
-
-      int[] outer = new int[vertIndexes.length];
-
       factory.createNewFaceTransform(shape,outer);
       mMesh = factory.createRoundedSolid(shape,face,MESH_NICE,numComponents);
 
       int numEff = mMesh.getNumEffComponents();
 
-      for(int i=0; i<numEff; i++)
-        {
-        mMesh.setEffectAssociation(i, 0, i);
-        }
+      for(int i=0; i<numEff; i++) mMesh.setEffectAssociation(i, 0, i);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
