commit ba6d9ee93041760ee80450522ff5d15e83c40054
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Oct 12 22:42:33 2021 +0200

    Cuboids

diff --git a/src/main/java/org/distorted/objectlib/main/Movement.java b/src/main/java/org/distorted/objectlib/main/Movement.java
index 22cbf81c..7df8b2ff 100644
--- a/src/main/java/org/distorted/objectlib/main/Movement.java
+++ b/src/main/java/org/distorted/objectlib/main/Movement.java
@@ -61,7 +61,7 @@ public abstract class Movement
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   Movement(Static3D[] rotAxis, Static3D[] faceAxis, float[][] cuts, boolean[][] rotatable,
-           float distance3D, int size, int type, int[][][] enabled)
+           float distance3D, float size, int type, int[][][] enabled)
     {
     mPoint = new float[3];
     mCamera= new float[3];
@@ -268,7 +268,7 @@ public abstract class Movement
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  private float[] computeBorder(float[] cuts, boolean[] rotatable, int size)
+  private float[] computeBorder(float[] cuts, boolean[] rotatable, float size)
     {
     if( cuts==null ) return null;
 
@@ -306,16 +306,16 @@ public abstract class Movement
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// size, not numLayers (see Master Skewb where size!=numLayers)
+// size, not numLayers (see Master Skewb where size!=numLayers) - also cuboids.
 
-  void computeBorders(float[][] cuts, boolean[][] rotatable, int size)
+  void computeBorders(float[][] cuts, boolean[][] rotatable, float size)
     {
     int numCuts = cuts.length;
     mTouchBorders = new float[numCuts][];
 
-    for(int i=0; i<numCuts; i++)
+    for(int axis=0; axis<numCuts; axis++)
       {
-      mTouchBorders[i] = computeBorder(cuts[i],rotatable[i],size);
+      mTouchBorders[axis] = computeBorder(cuts[axis],rotatable[axis],size);
       }
     }
 
diff --git a/src/main/java/org/distorted/objectlib/main/Movement12.java b/src/main/java/org/distorted/objectlib/main/Movement12.java
index 574d5757..7460c704 100644
--- a/src/main/java/org/distorted/objectlib/main/Movement12.java
+++ b/src/main/java/org/distorted/objectlib/main/Movement12.java
@@ -54,7 +54,7 @@ public class Movement12 extends Movement
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[][][] enabled)
+  public Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, float size, int type, int[][][] enabled)
     {
     super(rotAxis, FACE_AXIS, cuts,rotatable,DIST3D, size, type, enabled);
     }
diff --git a/src/main/java/org/distorted/objectlib/main/Movement4.java b/src/main/java/org/distorted/objectlib/main/Movement4.java
index 93dddcc5..f300e1fd 100644
--- a/src/main/java/org/distorted/objectlib/main/Movement4.java
+++ b/src/main/java/org/distorted/objectlib/main/Movement4.java
@@ -39,7 +39,7 @@ public class Movement4 extends Movement
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public Movement4(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[][][] enabled)
+  public Movement4(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, float size, int type, int[][][] enabled)
     {
     super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, enabled);
     }
diff --git a/src/main/java/org/distorted/objectlib/main/Movement6.java b/src/main/java/org/distorted/objectlib/main/Movement6.java
index 8f9fbc35..0aca77cf 100644
--- a/src/main/java/org/distorted/objectlib/main/Movement6.java
+++ b/src/main/java/org/distorted/objectlib/main/Movement6.java
@@ -38,7 +38,7 @@ public class Movement6 extends Movement
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[][][] enabled)
+  public Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, float size, int type, int[][][] enabled)
     {
     super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, enabled);
     }
diff --git a/src/main/java/org/distorted/objectlib/main/Movement8.java b/src/main/java/org/distorted/objectlib/main/Movement8.java
index d0af1754..559db5ac 100644
--- a/src/main/java/org/distorted/objectlib/main/Movement8.java
+++ b/src/main/java/org/distorted/objectlib/main/Movement8.java
@@ -39,7 +39,7 @@ public class Movement8 extends Movement
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public Movement8(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[][][] enabled)
+  public Movement8(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, float size, int type, int[][][] enabled)
     {
     super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, enabled);
     }
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectType.java b/src/main/java/org/distorted/objectlib/main/ObjectType.java
index 9bf0afe5..00cccec2 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectType.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectType.java
@@ -184,7 +184,7 @@ public enum ObjectType
       case  0:
       case  1:
       case  2:
-      case  3: return new TwistyCuboid(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
+      case  3: return new TwistyCuboid        (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
       case  4: return new TwistyJing          (numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
       case  5:
       case  6:
diff --git a/src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java b/src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java
index 9569da43..048ce2a3 100644
--- a/src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java
+++ b/src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java
@@ -545,40 +545,16 @@ public class TwistyCuboid extends Twisty6
       {
       mCuts = new float[3][];
 
-      int lenX = numLayers[0];
-
-      if( lenX>=2 )
+      for(int axis=0; axis<3; axis++)
         {
-        mCuts[0] = new float[lenX-1];
-        for(int i=0; i<lenX-1; i++) mCuts[0][i] = (2-lenX)*0.5f + i;
-        }
-      else
-        {
-        mCuts[0] = null;
-        }
+        int len = numLayers[axis];
+        float start = (2-len)*0.5f;
 
-      int lenY = numLayers[1];
-
-      if( lenY>=2 )
-        {
-        mCuts[1] = new float[lenY-1];
-        for(int i=0; i<lenY-1; i++) mCuts[1][i] = (2-lenY)*0.5f + i;
-        }
-      else
-        {
-        mCuts[1] = null;
-        }
-
-      int lenZ = numLayers[2];
-
-      if( lenZ>=2 )
-        {
-        mCuts[2] = new float[lenZ-1];
-        for(int i=0; i<lenZ-1; i++) mCuts[2][i] = (2-lenZ)*0.5f + i;
-        }
-      else
-        {
-        mCuts[2] = null;
+        if( len>=2 )
+          {
+          mCuts[axis] = new float[len-1];
+          for(int i=0; i<len-1; i++) mCuts[axis][i] = start+i;
+          }
         }
       }
 
@@ -641,7 +617,8 @@ public class TwistyCuboid extends Twisty6
       int[] numLayers = getNumLayers();
       if( mCuts==null ) getCuts(numLayers);
       getLayerRotatable(numLayers);
-      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_NOT_SPLIT,ENABLED);
+      float avg = (numLayers[0]+numLayers[1]+numLayers[2])/3.0f;
+      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,avg,TYPE_NOT_SPLIT,ENABLED);
       }
     return mMovement;
     }
@@ -669,8 +646,8 @@ public class TwistyCuboid extends Twisty6
     {
     switch(numLayers[0])
       {
-      case 2: return numLayers[1]==2 ? ObjectType.CUBE_2 : ObjectType.CU_223;
-      case 3: return numLayers[1]==3 ? ObjectType.CUBE_3 : ObjectType.CU_334;
+      case 2: return ObjectType.CUBE_2;
+      case 3: return ObjectType.CUBE_3;
       case 4: return ObjectType.CUBE_4;
       case 5: return ObjectType.CUBE_5;
       }
