commit fb52fae9ea7b79d60864725b23215edd4be12396
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Sep 14 14:38:36 2020 +0100

    Beginnings of support for the Skewb.

diff --git a/src/main/java/org/distorted/objects/RubikCube.java b/src/main/java/org/distorted/objects/RubikCube.java
index e5539f5c..9e56da28 100644
--- a/src/main/java/org/distorted/objects/RubikCube.java
+++ b/src/main/java/org/distorted/objects/RubikCube.java
@@ -548,14 +548,8 @@ class RubikCube extends RubikObject
     final int FRONT= 4;
     final int BACK = 5;
 
-    final char[] FACE_NAMES = { 'R', 'L', 'U', 'D', 'F', 'B'};
-
-/////////////////////
-// LIVE DEBUGGING
-/////////////////////
-try
-  {
-/////////////////////
+    // 'I' - interior, theoretically can happen
+    final char[] FACE_NAMES = { 'R', 'L', 'U', 'D', 'F', 'B', 'I'};
 
     face = UP;
 
@@ -640,26 +634,6 @@ try
       objectString.append(FACE_NAMES[color]);
       }
 
-/////////////////////
-  }
-catch(java.lang.ArrayIndexOutOfBoundsException ex)
-  {
-  FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
-
-  String str="";
-  for(int i=0; i<NUM_CUBITS; i++)
-    {
-    str += (CUBITS[i].mQuatIndex+" ");
-    }
-
-  crashlytics.setCustomKey("ObjectString", "color="+color+" cubitIndex="+cubitIndex+" face="+face+" row="+row+" col="+col );
-  crashlytics.setCustomKey("Quaternion", "NUM_CUBITS: "+NUM_CUBITS+" quats: "+str );
-  crashlytics.recordException(ex);
-  }
-/////////////////////
-// END LIVE DEBUGGING
-/////////////////////
-
     return objectString.toString();
     }
 }
diff --git a/src/main/java/org/distorted/objects/RubikMovementSkewb.java b/src/main/java/org/distorted/objects/RubikMovementSkewb.java
new file mode 100644
index 00000000..70c5ce38
--- /dev/null
+++ b/src/main/java/org/distorted/objects/RubikMovementSkewb.java
@@ -0,0 +1,116 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2020 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube is free software: you can redistribute it and/or modify                            //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Magic Cube is distributed in the hope that it will be useful,                                 //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.objects;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class RubikMovementSkewb extends RubikMovement
+{
+  RubikMovementSkewb()
+    {
+    super(RubikSkewb.ROT_AXIS, RubikSkewb.FACE_AXIS, 0.5f, 0.5f);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// _____________
+// |  \  0  /  |
+// |   \   /   |
+// | 3 |   | 1 |
+// |   /   \   |
+// |  /  2  \  |
+// -------------
+
+  private int getQuarter(float[] touchPoint)
+    {
+    boolean p0 = touchPoint[1] >= touchPoint[0];
+    boolean p1 = touchPoint[1] >=-touchPoint[0];
+
+    if( p0 )  return p1 ? 0:3;
+    else      return p1 ? 1:2;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  boolean isInsideFace(float[] p)
+    {
+    return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
+    {
+    enabled[0] = 2;
+
+    int quarter = getQuarter(touchPoint);
+
+    switch(face)
+      {
+      case 0: switch(quarter)
+                {
+                case 0: enabled[1]=0; enabled[2]=1; break;
+                case 1: enabled[1]=3; enabled[2]=1; break;
+                case 2: enabled[1]=2; enabled[2]=3; break;
+                case 3: enabled[1]=0; enabled[2]=2; break;
+                }
+              break;
+      case 1: switch(quarter)
+                {
+                case 0: enabled[1]=2; enabled[2]=3; break;
+                case 1: enabled[1]=3; enabled[2]=1; break;
+                case 2: enabled[1]=0; enabled[2]=1; break;
+                case 3: enabled[1]=0; enabled[2]=2; break;
+                }
+              break;
+      case 2: switch(quarter)
+                {
+                case 0: enabled[1]=1; enabled[2]=2; break;
+                case 1: enabled[1]=0; enabled[2]=1; break;
+                case 2: enabled[1]=0; enabled[2]=3; break;
+                case 3: enabled[1]=2; enabled[2]=3; break;
+                }
+              break;
+      case 3: switch(quarter)
+                {
+                case 0: enabled[1]=1; enabled[2]=2; break;
+                case 1: enabled[1]=2; enabled[2]=3; break;
+                case 2: enabled[1]=0; enabled[2]=3; break;
+                case 3: enabled[1]=0; enabled[2]=1; break;
+                }
+              break;
+      case 4: switch(quarter)
+                {
+                case 0: enabled[1]=0; enabled[2]=3; break;
+                case 1: enabled[1]=0; enabled[2]=2; break;
+                case 2: enabled[1]=1; enabled[2]=2; break;
+                case 3: enabled[1]=1; enabled[2]=3; break;
+                }
+              break;
+      case 5: switch(quarter)
+                {
+                case 0: enabled[1]=1; enabled[2]=2; break;
+                case 1: enabled[1]=0; enabled[2]=2; break;
+                case 2: enabled[1]=0; enabled[2]=3; break;
+                case 3: enabled[1]=1; enabled[2]=3; break;
+                }
+              break;
+      }
+    }
+}
diff --git a/src/main/java/org/distorted/objects/RubikObject.java b/src/main/java/org/distorted/objects/RubikObject.java
index 55d7b4c7..05e520aa 100644
--- a/src/main/java/org/distorted/objects/RubikObject.java
+++ b/src/main/java/org/distorted/objects/RubikObject.java
@@ -59,7 +59,7 @@ public abstract class RubikObject extends DistortedNode
   private static final float MAX_SIZE_CHANGE = 1.3f;
   private static final float MIN_SIZE_CHANGE = 0.8f;
 
-  private static boolean mCreateFromDMesh = true;
+  private static boolean mCreateFromDMesh = false;
 
   private static final Static3D CENTER = new Static3D(0,0,0);
   static final int INTERIOR_COLOR = 0xff000000;
diff --git a/src/main/java/org/distorted/objects/RubikObjectList.java b/src/main/java/org/distorted/objects/RubikObjectList.java
index 16220f06..48c7a5bd 100644
--- a/src/main/java/org/distorted/objects/RubikObjectList.java
+++ b/src/main/java/org/distorted/objects/RubikObjectList.java
@@ -65,6 +65,15 @@ public enum RubikObjectList
          new RubikMovementDino(),
          2
        ),
+
+  SKEW (
+         new int[][] {
+                       {2 , 11, R.raw.dino, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
+                     },
+         RubikSkewb.class,
+         new RubikMovementSkewb(),
+         2
+       ),
   ;
 
   public static final int NUM_OBJECTS = values().length;
@@ -433,13 +442,14 @@ public enum RubikObjectList
     {
     DistortedTexture texture = new DistortedTexture();
     DistortedEffects effects = new DistortedEffects();
-    MeshSquare mesh      = new MeshSquare(20,20);   // mesh of the node, not of the cubits
+    MeshSquare mesh          = new MeshSquare(20,20);   // mesh of the node, not of the cubits
 
     switch(ordinal())
       {
       case 0: return new RubikCube    (size, quat, texture, mesh, effects, moves, res, scrWidth);
       case 1: return new RubikPyraminx(size, quat, texture, mesh, effects, moves, res, scrWidth);
       case 2: return new RubikDino    (size, quat, texture, mesh, effects, moves, res, scrWidth);
+      case 3: return new RubikSkewb   (size, quat, texture, mesh, effects, moves, res, scrWidth);
       }
 
     return null;
diff --git a/src/main/java/org/distorted/objects/RubikSkewb.java b/src/main/java/org/distorted/objects/RubikSkewb.java
new file mode 100644
index 00000000..f75cc12b
--- /dev/null
+++ b/src/main/java/org/distorted/objects/RubikSkewb.java
@@ -0,0 +1,643 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2020 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube is free software: you can redistribute it and/or modify                            //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Magic Cube is distributed in the hope that it will be useful,                                 //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.objects;
+
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+
+import org.distorted.library.effect.MatrixEffectQuaternion;
+import org.distorted.library.effect.VertexEffectDeform;
+import org.distorted.library.effect.VertexEffectMove;
+import org.distorted.library.effect.VertexEffectRotate;
+import org.distorted.library.effect.VertexEffectScale;
+import org.distorted.library.main.DistortedEffects;
+import org.distorted.library.main.DistortedTexture;
+import org.distorted.library.mesh.MeshBase;
+import org.distorted.library.mesh.MeshJoined;
+import org.distorted.library.mesh.MeshPolygon;
+import org.distorted.library.mesh.MeshSquare;
+import org.distorted.library.mesh.MeshTriangle;
+import org.distorted.library.type.Static1D;
+import org.distorted.library.type.Static3D;
+import org.distorted.library.type.Static4D;
+import org.distorted.main.RubikSurfaceView;
+
+import java.util.Random;
+
+import static org.distorted.effects.scramble.ScrambleEffect.START_AXIS;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class RubikSkewb extends RubikObject
+{
+  private static final float SQ2 = (float)Math.sqrt(2);
+  private static final float SQ3 = (float)Math.sqrt(3);
+
+  private static final int FACES_PER_CUBIT =6;
+
+  // the four rotation axis of a RubikSkewb. Must be normalized.
+  static final Static3D[] ROT_AXIS = new Static3D[]
+         {
+           new Static3D(+SQ3/3,+SQ3/3,+SQ3/3),
+           new Static3D(+SQ3/3,+SQ3/3,-SQ3/3),
+           new Static3D(+SQ3/3,-SQ3/3,+SQ3/3),
+           new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
+         };
+
+  // the six axis that determine the faces
+  static final Static3D[] FACE_AXIS = new Static3D[]
+         {
+           new Static3D(1,0,0), new Static3D(-1,0,0),
+           new Static3D(0,1,0), new Static3D(0,-1,0),
+           new Static3D(0,0,1), new Static3D(0,0,-1)
+         };
+
+  private static final int[] FACE_COLORS = new int[]
+         {
+           0xffffff00, 0xffffffff,   // FACE_AXIS[0] (right-YELLOW) FACE_AXIS[1] (left  -WHITE)
+           0xff0000ff, 0xff00ff00,   // FACE_AXIS[2] (top  -BLUE  ) FACE_AXIS[3] (bottom-GREEN)
+           0xffff0000, 0xffb5651d    // FACE_AXIS[4] (front-RED   ) FACE_AXIS[5] (back  -BROWN)
+         };
+
+  // All legal rotation quats of a RubikSkewb
+  private static final Static4D[] QUATS = new Static4D[]
+         {
+           new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),
+           new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
+           new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
+           new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
+
+           new Static4D(  0.5f,  0.5f,  0.5f,  0.5f ),
+           new Static4D(  0.5f,  0.5f,  0.5f, -0.5f ),
+           new Static4D(  0.5f,  0.5f, -0.5f,  0.5f ),
+           new Static4D(  0.5f,  0.5f, -0.5f, -0.5f ),
+           new Static4D(  0.5f, -0.5f,  0.5f,  0.5f ),
+           new Static4D(  0.5f, -0.5f,  0.5f, -0.5f ),
+           new Static4D(  0.5f, -0.5f, -0.5f,  0.5f ),
+           new Static4D(  0.5f, -0.5f, -0.5f, -0.5f )
+         };
+
+  // centers of the 8 corners + 6 sides ( i.e. of the all 14 cubits)
+  private static final Static3D[] CENTERS = new Static3D[]
+         {
+           new Static3D( 0.5f, 0.5f, 0.5f ),
+           new Static3D( 0.5f, 0.5f,-0.5f ),
+           new Static3D( 0.5f,-0.5f, 0.5f ),
+           new Static3D( 0.5f,-0.5f,-0.5f ),
+           new Static3D(-0.5f, 0.5f, 0.5f ),
+           new Static3D(-0.5f, 0.5f,-0.5f ),
+           new Static3D(-0.5f,-0.5f, 0.5f ),
+           new Static3D(-0.5f,-0.5f,-0.5f ),
+
+           new Static3D( 0.5f, 0.0f, 0.0f ),
+           new Static3D(-0.5f, 0.0f, 0.0f ),
+           new Static3D( 0.0f, 0.5f, 0.0f ),
+           new Static3D( 0.0f,-0.5f, 0.0f ),
+           new Static3D( 0.0f, 0.0f, 0.5f ),
+           new Static3D( 0.0f, 0.0f,-0.5f ),
+         };
+
+  // Colors of the faces of cubits. Each cubit, even the face pyramid, has 6 faces
+  // (the face has one extra 'fake' face so that everything would have the same number)
+  private static final int[][] mFaceMap = new int[][]
+         {
+           { 4,2,0, 6,6,6 },
+           { 2,5,0, 6,6,6 },
+           { 3,4,0, 6,6,6 },
+           { 5,3,0, 6,6,6 },
+           { 1,2,4, 6,6,6 },
+           { 5,2,1, 6,6,6 },
+           { 4,3,1, 6,6,6 },
+           { 1,3,5, 6,6,6 },
+
+           { 0, 6,6,6,6,6 },
+           { 1, 6,6,6,6,6 },
+           { 2, 6,6,6,6,6 },
+           { 3, 6,6,6,6,6 },
+           { 4, 6,6,6,6,6 },
+           { 5, 6,6,6,6,6 },
+         };
+
+  private static MeshBase mCornerMesh, mFaceMesh;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  RubikSkewb(int size, Static4D quat, DistortedTexture texture,
+             MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
+    {
+    super(size, 60, quat, texture, mesh, effects, moves, RubikObjectList.SKEW, res, scrWidth);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void createCornerMesh()
+    {
+    float D = 0.02f;
+    float E = 0.5f;
+    float F = SQ2/2;
+
+    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
+
+    float[] bands0 = { 1.0f    , 0,
+                       1.0f-2*D, D*0.25f,
+                       1.0f-4*D, D*0.35f,
+                       1.0f-8*D, D*0.6f,
+                       0.60f   , D*1.0f,
+                       0.30f   , D*1.375f,
+                       0.0f    , D*1.4f };
+
+    MeshBase[] meshes = new MeshBase[FACES_PER_CUBIT];
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
+    meshes[0].setEffectAssociation(0,1,0);
+    meshes[1] = meshes[0].copy(true);
+    meshes[1].setEffectAssociation(0,2,0);
+    meshes[2] = meshes[0].copy(true);
+    meshes[2].setEffectAssociation(0,4,0);
+
+    float[] vertices1 = { 0,0, F,0, F/2,(SQ3/2)*F };
+    float[] bands1 = { 1.0f, 0.0f, 0.0f, 0.0f };
+
+    meshes[3] = new MeshPolygon(vertices1,bands1,0,0);
+    meshes[3].setEffectAssociation(0,8,0);
+    meshes[4] = meshes[3].copy(true);
+    meshes[4].setEffectAssociation(0,16,0);
+    meshes[5] = meshes[3].copy(true);
+    meshes[5].setEffectAssociation(0,32,0);
+
+    mCornerMesh = new MeshJoined(meshes);
+
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisY  = new Static3D(0,1,0);
+    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
+    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
+    Static1D angle1 = new Static1D(+90);
+    Static1D angle2 = new Static1D(-90);
+    Static1D angle3 = new Static1D(-15);
+    Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3)));
+    Static1D angle5 = new Static1D(120);
+    Static1D angle6 = new Static1D(240);
+    Static3D center1= new Static3D(0,0,0);
+    Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f);
+    Static3D move1  = new Static3D(-E/4,-E/4,0);
+    Static3D move2  = new Static3D(-0.5f,-0.5f,-0.5f);
+
+    float d0 =-0.04f;
+    float d1 = 0.04f;
+    float r0 = 0.15f;
+    float r1 = 0.10f;
+
+    Static3D vec0   = new Static3D(d0*(+SQ3/3),d0*(+SQ3/3),d0*(+SQ3/3));
+    Static3D vec1   = new Static3D(d1*(+SQ3/3),d1*(-SQ3/3),d1*(-SQ3/3));
+    Static3D vec2   = new Static3D(d1*(-SQ3/3),d1*(+SQ3/3),d1*(-SQ3/3));
+    Static3D vec3   = new Static3D(d1*(-SQ3/3),d1*(-SQ3/3),d1*(+SQ3/3));
+
+    Static1D radius = new Static1D(0.5f);
+
+    Static3D cent0  = new Static3D( 0.0f, 0.0f, 0.0f);
+    Static3D cent1  = new Static3D(-0.5f, 0.0f, 0.0f);
+    Static3D cent2  = new Static3D( 0.0f,-0.5f, 0.0f);
+    Static3D cent3  = new Static3D( 0.0f, 0.0f,-0.5f);
+
+    Static4D reg0   = new Static4D(0,0,0,r0);
+    Static4D reg1   = new Static4D(0,0,0,r1);
+
+    VertexEffectMove   effect0 = new VertexEffectMove(move1);
+    VertexEffectScale  effect1 = new VertexEffectScale(new Static3D(1,1,-1));
+    VertexEffectRotate effect2 = new VertexEffectRotate(angle1,axisX,center1);
+    VertexEffectRotate effect3 = new VertexEffectRotate(angle2,axisY,center1);
+    VertexEffectMove   effect4 = new VertexEffectMove(move2);
+    VertexEffectRotate effect5 = new VertexEffectRotate(angle1,axisX,center2);
+    VertexEffectRotate effect6 = new VertexEffectRotate(angle3,axisY,center2);
+    VertexEffectRotate effect7 = new VertexEffectRotate(angle4,axis0,center2);
+    VertexEffectRotate effect8 = new VertexEffectRotate(angle5,axis1,center2);
+    VertexEffectRotate effect9 = new VertexEffectRotate(angle6,axis1,center2);
+
+    VertexEffectDeform effect10= new VertexEffectDeform(vec0,radius,cent0,reg0);
+    VertexEffectDeform effect11= new VertexEffectDeform(vec1,radius,cent1,reg1);
+    VertexEffectDeform effect12= new VertexEffectDeform(vec2,radius,cent2,reg1);
+    VertexEffectDeform effect13= new VertexEffectDeform(vec3,radius,cent3,reg1);
+
+    effect0.setMeshAssociation( 7,-1);  // meshes 0,1,2
+    effect1.setMeshAssociation( 6,-1);  // meshes 1,2
+    effect2.setMeshAssociation( 2,-1);  // mesh 1
+    effect3.setMeshAssociation( 4,-1);  // mesh 2
+    effect4.setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect5.setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect6.setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect7.setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect8.setMeshAssociation(16,-1);  // mesh 4
+    effect9.setMeshAssociation(32,-1);  // mesh 5
+
+    effect10.setMeshAssociation(63,-1); // all meshes
+    effect11.setMeshAssociation(63,-1); // all meshes
+    effect12.setMeshAssociation(63,-1); // all meshes
+    effect13.setMeshAssociation(63,-1); // all meshes
+
+    mCornerMesh.apply(effect0);
+    mCornerMesh.apply(effect1);
+    mCornerMesh.apply(effect2);
+    mCornerMesh.apply(effect3);
+    mCornerMesh.apply(effect4);
+    mCornerMesh.apply(effect5);
+    mCornerMesh.apply(effect6);
+    mCornerMesh.apply(effect7);
+    mCornerMesh.apply(effect8);
+    mCornerMesh.apply(effect9);
+
+    mCornerMesh.apply(effect10);
+    mCornerMesh.apply(effect11);
+    mCornerMesh.apply(effect12);
+    mCornerMesh.apply(effect13);
+
+    mCornerMesh.mergeEffComponents();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void createFaceMesh()
+    {
+    int association = 1;
+
+    float D = 0.03f;
+    float E = SQ2/4;
+    float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
+
+    float[] bands0 = { 1.0f    ,0,
+                       1.0f-D/2,D*0.45f,
+                       1.0f-D  ,D*0.75f,
+                       1.0f-2*D,D,
+                       0.60f, 0.052f,
+                       0.30f, 0.060f,
+                       0.0f, 0.065f };
+
+    MeshBase[] meshes = new MeshBase[FACES_PER_CUBIT];
+    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
+    meshes[0].setEffectAssociation(0,association,0);
+
+    association <<= 1;
+
+    float[] vertices1 = { -E,-SQ3*E, +E,-SQ3*E, 0,0 };
+    float[] bands1 = { 1.0f, 0.0f, 0.0f, 0.0f };
+
+    meshes[1] = new MeshPolygon(vertices1,bands1,0,0);
+    meshes[1].setEffectAssociation(0,association,0);
+
+    for(int i=2; i<FACES_PER_CUBIT-1; i++)
+      {
+      association <<= 1;
+      meshes[i] = meshes[1].copy(true);
+      meshes[i].setEffectAssociation(0,association,0);
+      }
+
+    association <<= 1;
+    meshes[FACES_PER_CUBIT-1] = new MeshTriangle(1);                  // empty triangle so that
+    meshes[FACES_PER_CUBIT-1].setEffectAssociation(0,association,0);  // all cubits have 6 faces
+
+    mFaceMesh = new MeshJoined(meshes);
+
+    Static3D center = new Static3D(0,0,0);
+    Static3D axis1   = new Static3D(1,0,0);
+    Static3D axis2   = new Static3D(0,0,1);
+    float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3));
+
+    float f = 0.06f;
+    float r = 0.10f;
+    float d = 0.5f;
+    float e = +D*0.6f;
+    Static3D vector0 = new Static3D(-f, 0, 0);
+    Static3D vector1 = new Static3D( 0,+f, 0);
+    Static3D vector2 = new Static3D(+f, 0, 0);
+    Static3D vector3 = new Static3D( 0,-f, 0);
+    Static1D radius  = new Static1D(1.0f);
+    Static4D region  = new Static4D(0,0,0,r);
+    Static3D center0 = new Static3D(+d, 0, e);
+    Static3D center1 = new Static3D( 0,-d, e);
+    Static3D center2 = new Static3D(-d, 0, e);
+    Static3D center3 = new Static3D( 0,+d, e);
+
+    VertexEffectRotate effect0 = new VertexEffectRotate( new Static1D(angle), axis1, center);
+    VertexEffectRotate effect1 = new VertexEffectRotate( new Static1D(  135), axis2, center);
+    VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D(   45), axis2, center);
+    VertexEffectRotate effect3 = new VertexEffectRotate( new Static1D(  -45), axis2, center);
+    VertexEffectRotate effect4 = new VertexEffectRotate( new Static1D( -135), axis2, center);
+    VertexEffectMove   effect5 = new VertexEffectMove( new Static3D(0,0,-0.5f) );
+    VertexEffectDeform effect6 = new VertexEffectDeform(vector0,radius,center0,region);
+    VertexEffectDeform effect7 = new VertexEffectDeform(vector1,radius,center1,region);
+    VertexEffectDeform effect8 = new VertexEffectDeform(vector2,radius,center2,region);
+    VertexEffectDeform effect9 = new VertexEffectDeform(vector3,radius,center3,region);
+    VertexEffectScale  effect10= new VertexEffectScale(0.01f);
+
+    effect0.setMeshAssociation(30,-1);  // meshes 1,2,3,4
+    effect1.setMeshAssociation( 2,-1);  // mesh 1
+    effect2.setMeshAssociation( 5,-1);  // meshes 0,2
+    effect3.setMeshAssociation( 8,-1);  // mesh 3
+    effect4.setMeshAssociation(16,-1);  // mesh 4
+    effect5.setMeshAssociation(30,-1);  // meshes 1,2,3,4
+    effect6.setMeshAssociation(31,-1);  // meshes 0,1,2,3,4
+    effect7.setMeshAssociation(31,-1);  // meshes 0,1,2,3,4
+    effect8.setMeshAssociation(31,-1);  // meshes 0,1,2,3,4
+    effect9.setMeshAssociation(31,-1);  // meshes 0,1,2,3,4
+    effect10.setMeshAssociation(32,-1); // mesh 5
+
+    mFaceMesh.apply(effect0);
+    mFaceMesh.apply(effect1);
+    mFaceMesh.apply(effect2);
+    mFaceMesh.apply(effect3);
+    mFaceMesh.apply(effect4);
+    mFaceMesh.apply(effect5);
+    mFaceMesh.apply(effect6);
+    mFaceMesh.apply(effect7);
+    mFaceMesh.apply(effect8);
+    mFaceMesh.apply(effect9);
+    mFaceMesh.apply(effect10);
+
+    mFaceMesh.mergeEffComponents();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  float getScreenRatio()
+    {
+    return 1.0f;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  Static4D[] getQuats()
+    {
+    return QUATS;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  int getNumFaces()
+    {
+    return FACE_COLORS.length;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  int getNumCubitFaces()
+    {
+    return FACES_PER_CUBIT;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  Static3D[] getCubitPositions(int size)
+    {
+    return CENTERS;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private Static4D getQuat(int cubit)
+    {
+    switch(cubit)
+      {
+      case  0: return QUATS[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 QUATS[1];                          // 180 along X
+      case  4: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
+      case  5: return QUATS[2];                          // 180 along Y
+      case  6: return QUATS[3];                          // 180 along Z
+      case  7: return new Static4D(SQ2/2,0,-SQ2/2,0);    // 180 along (SQ2/2,0,-SQ2/2)
+      case  8: return new Static4D(0,-SQ2/2,0,SQ2/2);    // -90 along Y
+      case  9: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
+      case 10: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
+      case 11: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
+      case 12: return QUATS[0];                          //  unit quaternion
+      case 13: return QUATS[1];                          // 180 along X
+      }
+
+    return null;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createCubitMesh(int cubit)
+    {
+    MeshBase mesh;
+
+    if( cubit<8 )
+      {
+      if( mCornerMesh==null ) createCornerMesh();
+      mesh = mCornerMesh.copy(true);
+      }
+    else
+      {
+      if( mFaceMesh==null ) createFaceMesh();
+      mesh = mFaceMesh.copy(true);
+      }
+
+    MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit), new Static3D(0,0,0) );
+    mesh.apply(quat,0xffffffff,0);
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  int getFaceColor(int cubit, int cubitface, int size)
+    {
+    return mFaceMap[cubit][cubitface];
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// TODO
+
+  void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top, int side)
+    {
+    paint.setColor(FACE_COLORS[face]);
+    paint.setStyle(Paint.Style.FILL);
+    canvas.drawRect(left,top,left+side,top+side,paint);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  float returnMultiplier()
+    {
+    return 2.0f;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  float[] getRowChances()
+    {
+    float[] chances = new float[2];
+
+    chances[0] = 0.5f;
+    chances[1] = 1.0f;
+
+    return chances;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// PUBLIC API
+
+  public Static3D[] getRotationAxis()
+    {
+    return ROT_AXIS;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int getBasicAngle()
+    {
+    return 3;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int computeRowFromOffset(float offset)
+    {
+    return offset<0.5f ? 0:1;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public float returnRotationFactor(float offset)
+    {
+    return 1.0f;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int randomizeNewRotAxis(Random rnd, int oldRotAxis)
+    {
+    int numAxis = ROTATION_AXIS.length;
+
+    if( oldRotAxis == START_AXIS )
+      {
+      return rnd.nextInt(numAxis);
+      }
+    else
+      {
+      int newVector = rnd.nextInt(numAxis-1);
+      return (newVector>=oldRotAxis ? newVector+1 : newVector);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis)
+    {
+    float rowFloat = rnd.nextFloat();
+
+    for(int row=0; row<mRowChances.length; row++)
+      {
+      if( rowFloat<=mRowChances[row] ) return row;
+      }
+
+    return 0;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// remember about the double cover or unit quaternions!
+
+  private int mulQuat(int q1, int q2)
+    {
+    Static4D result = RubikSurfaceView.quatMultiply(QUATS[q1],QUATS[q2]);
+
+    float rX = result.get0();
+    float rY = result.get1();
+    float rZ = result.get2();
+    float rW = result.get3();
+
+    final float MAX_ERROR = 0.1f;
+    float dX,dY,dZ,dW;
+
+    for(int i=0; i<QUATS.length; i++)
+      {
+      dX = QUATS[i].get0() - rX;
+      dY = QUATS[i].get1() - rY;
+      dZ = QUATS[i].get2() - rZ;
+      dW = QUATS[i].get3() - rW;
+
+      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
+          dY<MAX_ERROR && dY>-MAX_ERROR &&
+          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
+          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
+
+      dX = QUATS[i].get0() + rX;
+      dY = QUATS[i].get1() + rY;
+      dZ = QUATS[i].get2() + rZ;
+      dW = QUATS[i].get3() + rW;
+
+      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
+          dY<MAX_ERROR && dY>-MAX_ERROR &&
+          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
+          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
+      }
+
+    return -1;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// The Skewb is solved if and only if:
+//
+// 1) all of its corner cubits are rotated with the same quat
+// 2) all its face cubits are rotated with the same quat like the corner ones,
+//    and optionally they also might be upside down.
+//
+// i.e.
+// cubits [ 8] and [ 9] - might be extra QUAT[1]
+// cubits [10] and [11] - might be extra QUAT[2]
+// cubits [12] and [13] - might be extra QUAT[3]
+
+  public boolean isSolved()
+    {
+    int q = CUBITS[0].mQuatIndex;
+
+    if ( CUBITS[1].mQuatIndex == q &&
+         CUBITS[2].mQuatIndex == q &&
+         CUBITS[3].mQuatIndex == q &&
+         CUBITS[4].mQuatIndex == q &&
+         CUBITS[5].mQuatIndex == q &&
+         CUBITS[6].mQuatIndex == q &&
+         CUBITS[7].mQuatIndex == q  )
+      {
+      int q1 = mulQuat(q,1);
+      int q2 = mulQuat(q,2);
+      int q3 = mulQuat(q,3);
+
+      return (CUBITS[ 8].mQuatIndex == q || CUBITS[ 8].mQuatIndex == q1) &&
+             (CUBITS[ 9].mQuatIndex == q || CUBITS[ 9].mQuatIndex == q1) &&
+             (CUBITS[10].mQuatIndex == q || CUBITS[10].mQuatIndex == q2) &&
+             (CUBITS[11].mQuatIndex == q || CUBITS[11].mQuatIndex == q2) &&
+             (CUBITS[12].mQuatIndex == q || CUBITS[12].mQuatIndex == q3) &&
+             (CUBITS[13].mQuatIndex == q || CUBITS[13].mQuatIndex == q3)  ;
+      }
+
+    return false;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// TODO  (only needed for solvers - there are no Skewb solvers ATM)
+
+  public String retObjectString()
+    {
+    return "";
+    }
+
+}
