commit 68ce0d53b4e0356e80d75ec80d9fdea4a7869d6f
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Mar 23 13:30:25 2021 +0100

    Simplify the 'bandaged' class API.

diff --git a/src/main/java/org/distorted/objects/TwistyBandaged2Bar.java b/src/main/java/org/distorted/objects/TwistyBandaged2Bar.java
index dedeb5d6..1ac8bcba 100644
--- a/src/main/java/org/distorted/objects/TwistyBandaged2Bar.java
+++ b/src/main/java/org/distorted/objects/TwistyBandaged2Bar.java
@@ -33,68 +33,54 @@ import java.util.Random;
 
 class TwistyBandaged2Bar extends TwistyBandagedAbstract
 {
-  TwistyBandaged2Bar(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
-                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
-    {
-    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN2, res, scrWidth);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int getCubitVariant(int cubit)
-    {
-    return cubit<=1 ? 2:0;
-    }
+  private static final float[][] POSITIONS = new float[][]
+      {
+       { 0.0f, +1.0f,  1.0f, 0.0f, +1.0f,  0.0f, 0.0f, +1.0f, -1.0f},
+       {-1.0f, -1.0f,  0.0f, 0.0f, -1.0f,  0.0f, 1.0f, -1.0f,  0.0f},
+       {-1.0f, +1.0f, +1.0f},
+       {-1.0f, +1.0f,  0.0f},
+       {-1.0f, +1.0f, -1.0f},
+       {-1.0f,  0.0f, +1.0f},
+       {-1.0f,  0.0f,  0.0f},
+       {-1.0f,  0.0f, -1.0f},
+       {-1.0f, -1.0f, +1.0f},
+       {-1.0f, -1.0f, -1.0f},
+       {+1.0f, +1.0f, +1.0f},
+       {+1.0f, +1.0f,  0.0f},
+       {+1.0f, +1.0f, -1.0f},
+       {+1.0f,  0.0f, +1.0f},
+       {+1.0f,  0.0f,  0.0f},
+       {+1.0f,  0.0f, -1.0f},
+       {+1.0f, -1.0f, +1.0f},
+       {+1.0f, -1.0f, -1.0f},
+       { 0.0f,  0.0f, +1.0f},
+       { 0.0f, -1.0f, +1.0f},
+       { 0.0f,  0.0f, -1.0f},
+       { 0.0f, -1.0f, -1.0f}
+      };
+
+  private static final int[] QUAT_INDICES = new int[] { 2 };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getNumCubits()
+  TwistyBandaged2Bar(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
+                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
     {
-    return 22;
+    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN2, res, scrWidth);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  float[] getCubitPosition(int cubit)
+  float[][] getPositions()
     {
-    switch(cubit)
-      {
-      case  0: return new float[] { 0.0f, +1.0f,  1.0f,
-                                    0.0f, +1.0f,  0.0f,
-                                    0.0f, +1.0f, -1.0f};
-      case  1: return new float[] {-1.0f, -1.0f,  0.0f,
-                                    0.0f, -1.0f,  0.0f,
-                                    1.0f, -1.0f,  0.0f};
-      case  2: return new float[] {-1.0f, +1.0f, +1.0f};
-      case  3: return new float[] {-1.0f, +1.0f,  0.0f};
-      case  4: return new float[] {-1.0f, +1.0f, -1.0f};
-      case  5: return new float[] {-1.0f,  0.0f, +1.0f};
-      case  6: return new float[] {-1.0f,  0.0f,  0.0f};
-      case  7: return new float[] {-1.0f,  0.0f, -1.0f};
-      case  8: return new float[] {-1.0f, -1.0f, +1.0f};
-      case  9: return new float[] {-1.0f, -1.0f, -1.0f};
-      case 10: return new float[] {+1.0f, +1.0f, +1.0f};
-      case 11: return new float[] {+1.0f, +1.0f,  0.0f};
-      case 12: return new float[] {+1.0f, +1.0f, -1.0f};
-      case 13: return new float[] {+1.0f,  0.0f, +1.0f};
-      case 14: return new float[] {+1.0f,  0.0f,  0.0f};
-      case 15: return new float[] {+1.0f,  0.0f, -1.0f};
-      case 16: return new float[] {+1.0f, -1.0f, +1.0f};
-      case 17: return new float[] {+1.0f, -1.0f, -1.0f};
-      case 18: return new float[] { 0.0f,  0.0f, +1.0f};
-      case 19: return new float[] { 0.0f, -1.0f, +1.0f};
-      case 20: return new float[] { 0.0f,  0.0f, -1.0f};
-      case 21: return new float[] { 0.0f, -1.0f, -1.0f};
-      }
-
-    return null;
+    return POSITIONS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getQuatIndex(int cubit)
+  int[] getQuatIndices()
     {
-    return cubit==0 ? 2 : 0;
+    return QUAT_INDICES;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objects/TwistyBandaged3Plate.java b/src/main/java/org/distorted/objects/TwistyBandaged3Plate.java
index 9028b91e..cf337357 100644
--- a/src/main/java/org/distorted/objects/TwistyBandaged3Plate.java
+++ b/src/main/java/org/distorted/objects/TwistyBandaged3Plate.java
@@ -159,74 +159,49 @@ class TwistyBandaged3Plate extends TwistyBandagedAbstract
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  TwistyBandaged3Plate(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
-                       DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
-    {
-    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN3, res, scrWidth);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
+  private static final float[][] POSITIONS = new float[][]
+      {
+       {-1.0f,  1.0f,  1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
+       { 1.0f,  0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f, -1.0f,  1.0f,  1.0f,  0.0f},
+       {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f,  0.0f,  0.0f, -1.0f, -1.0f,  0.0f, -1.0f,  0.0f},
+       { 1.0f,  1.0f,  1.0f},
+       { 1.0f,  0.0f,  1.0f},
+       { 1.0f, -1.0f,  1.0f},
+       {-1.0f, -1.0f,  1.0f},
+       { 0.0f, -1.0f,  1.0f},
+       { 1.0f, -1.0f,  0.0f},
+       { 1.0f, -1.0f, -1.0f},
+       {-1.0f,  1.0f, -1.0f},
+       {-1.0f,  1.0f,  0.0f},
+       { 0.0f,  1.0f, -1.0f},
+       { 0.0f,  1.0f,  0.0f},
+       {-1.0f,  0.0f, -1.0f},
+       {-1.0f,  0.0f,  0.0f},
+       { 0.0f,  0.0f, -1.0f}
+      };
 
-  int getCubitVariant(int cubit)
-    {
-    return cubit<=2 ? 3:0;
-    }
+  private static final int[] QUAT_INDICES = new int[] { 1, 3 };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getNumCubits()
+  TwistyBandaged3Plate(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
+                       DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
     {
-    return 17;
+    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN3, res, scrWidth);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  float[] getCubitPosition(int cubit)
+  float[][] getPositions()
     {
-    switch(cubit)
-      {
-      case  0: return new float[] {-1.0f,  1.0f,  1.0f,
-                                   -1.0f,  0.0f,  1.0f,
-                                    0.0f,  1.0f,  1.0f,
-                                    0.0f,  0.0f,  1.0f};
-      case  1: return new float[] { 1.0f,  0.0f, -1.0f,
-                                    1.0f,  0.0f,  0.0f,
-                                    1.0f,  1.0f, -1.0f,
-                                    1.0f,  1.0f,  0.0f};
-      case  2: return new float[] {-1.0f, -1.0f, -1.0f,
-                                   -1.0f, -1.0f,  0.0f,
-                                    0.0f, -1.0f, -1.0f,
-                                    0.0f, -1.0f,  0.0f};
-      case  3: return new float[] { 1.0f,  1.0f,  1.0f};
-      case  4: return new float[] { 1.0f,  0.0f,  1.0f};
-      case  5: return new float[] { 1.0f, -1.0f,  1.0f};
-      case  6: return new float[] {-1.0f, -1.0f,  1.0f};
-      case  7: return new float[] { 0.0f, -1.0f,  1.0f};
-      case  8: return new float[] { 1.0f, -1.0f,  0.0f};
-      case  9: return new float[] { 1.0f, -1.0f, -1.0f};
-      case 10: return new float[] {-1.0f,  1.0f, -1.0f};
-      case 11: return new float[] {-1.0f,  1.0f,  0.0f};
-      case 12: return new float[] { 0.0f,  1.0f, -1.0f};
-      case 13: return new float[] { 0.0f,  1.0f,  0.0f};
-      case 14: return new float[] {-1.0f,  0.0f, -1.0f};
-      case 15: return new float[] {-1.0f,  0.0f,  0.0f};
-      case 16: return new float[] { 0.0f,  0.0f, -1.0f};
-      }
-
-    return null;
+    return POSITIONS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getQuatIndex(int cubit)
+  int[] getQuatIndices()
     {
-    switch(cubit)
-      {
-      case 0: return 1;
-      case 1: return 3;
-      }
-
-    return 0;
+    return QUAT_INDICES;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objects/TwistyBandagedAbstract.java b/src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
index 8c944c1a..1f0fbb64 100644
--- a/src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
+++ b/src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
@@ -138,10 +138,48 @@ abstract class TwistyBandagedAbstract extends TwistyObject
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  abstract int getCubitVariant(int cubit);
-  abstract int getNumCubits();
-  abstract int getQuatIndex(int cubit);
-  abstract float[] getCubitPosition(int cubit);
+  abstract float[][] getPositions();
+  abstract int[] getQuatIndices();
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  int getCubitVariant(int cubit)
+    {
+    float[][] pos = getPositions();
+
+    if( cubit>=0 && cubit< pos.length )
+      {
+      int numPoints = pos[cubit].length/3;
+      return numPoints==8 ? 4:numPoints;
+      }
+
+    return 1;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  int getNumCubits()
+    {
+    return getPositions().length;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  float[] getCubitPosition(int cubit)
+    {
+    float[][] pos = getPositions();
+
+    return ( cubit>=0 && cubit< pos.length ) ? pos[cubit] : null;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  int getQuatIndex(int cubit)
+    {
+    int[] indices = getQuatIndices();
+
+    return ( cubit>=0 && cubit< indices.length ) ? indices[cubit] : 0;
+    }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/main/java/org/distorted/objects/TwistyBandagedEvil.java b/src/main/java/org/distorted/objects/TwistyBandagedEvil.java
index 7708c2aa..5d8b2ca0 100644
--- a/src/main/java/org/distorted/objects/TwistyBandagedEvil.java
+++ b/src/main/java/org/distorted/objects/TwistyBandagedEvil.java
@@ -33,86 +33,46 @@ import java.util.Random;
 
 class TwistyBandagedEvil extends TwistyBandagedAbstract
 {
-  TwistyBandagedEvil(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
-                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
-    {
-    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int getCubitVariant(int cubit)
-    {
-    switch(cubit)
+  private static final float[][] POSITIONS = new float[][]
       {
-      case 0: return 0;
-      case 1: return 3;
-      }
-
-    return 1;
-    }
+        { 1.0f,  1.0f, -1.0f},
+        {-1.0f, -1.0f,  0.0f, -1.0f,  0.0f,  0.0f, 0.0f, -1.0f,  0.0f,  0.0f,  0.0f,  0.0f},
+        {-1.0f,  1.0f, -1.0f,  0.0f,  1.0f, -1.0f},
+        {-1.0f,  0.0f, -1.0f,  0.0f,  0.0f, -1.0f},
+        {-1.0f, -1.0f, -1.0f,  0.0f, -1.0f, -1.0f},
+        {-1.0f,  1.0f,  0.0f, -1.0f,  1.0f,  1.0f},
+        { 0.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f},
+        { 1.0f,  1.0f,  0.0f,  1.0f,  1.0f,  1.0f},
+        {-1.0f, -1.0f,  1.0f, -1.0f,  0.0f,  1.0f},
+        { 0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
+        { 1.0f, -1.0f,  1.0f,  1.0f,  0.0f,  1.0f},
+        { 1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  0.0f},
+        { 1.0f, -1.0f, -1.0f,  1.0f,  0.0f, -1.0f}
+      };
+
+  private static final int[] QUAT_INDICES = new int[]
+      { 0, 1, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3 };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getNumCubits()
+  TwistyBandagedEvil(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
+                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
     {
-    return 13;
+    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  float[] getCubitPosition(int cubit)
+  float[][] getPositions()
     {
-    switch(cubit)
-      {
-      case  0: return new float[] { 1.0f,  1.0f, -1.0f};
-      case  1: return new float[] {-1.0f, -1.0f,  0.0f,
-                                   -1.0f,  0.0f,  0.0f,
-                                    0.0f, -1.0f,  0.0f,
-                                    0.0f,  0.0f,  0.0f};
-      case  2: return new float[] {-1.0f,  1.0f, -1.0f,
-                                    0.0f,  1.0f, -1.0f};
-      case  3: return new float[] {-1.0f,  0.0f, -1.0f,
-                                    0.0f,  0.0f, -1.0f};
-      case  4: return new float[] {-1.0f, -1.0f, -1.0f,
-                                    0.0f, -1.0f, -1.0f};
-      case  5: return new float[] {-1.0f,  1.0f,  0.0f,
-                                   -1.0f,  1.0f,  1.0f};
-      case  6: return new float[] { 0.0f,  1.0f,  0.0f,
-                                    0.0f,  1.0f,  1.0f};
-      case  7: return new float[] { 1.0f,  1.0f,  0.0f,
-                                    1.0f,  1.0f,  1.0f};
-      case  8: return new float[] {-1.0f, -1.0f,  1.0f,
-                                   -1.0f,  0.0f,  1.0f};
-      case  9: return new float[] { 0.0f, -1.0f,  1.0f,
-                                    0.0f,  0.0f,  1.0f};
-      case 10: return new float[] { 1.0f, -1.0f,  1.0f,
-                                    1.0f,  0.0f,  1.0f};
-      case 11: return new float[] { 1.0f, -1.0f,  0.0f,
-                                    1.0f,  0.0f,  0.0f};
-      case 12: return new float[] { 1.0f, -1.0f, -1.0f,
-                                    1.0f,  0.0f, -1.0f};
-      }
-
-    return null;
+    return POSITIONS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getQuatIndex(int cubit)
+  int[] getQuatIndices()
     {
-    switch(cubit)
-      {
-      case 1: return 1;
-      case 0:
-      case 2:
-      case 3:
-      case 4: return 0;
-      case 5:
-      case 6:
-      case 7: return 2;
-      default:return 3;
-      }
+    return QUAT_INDICES;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objects/TwistyBandagedFused.java b/src/main/java/org/distorted/objects/TwistyBandagedFused.java
index a736bf89..e034662e 100644
--- a/src/main/java/org/distorted/objects/TwistyBandagedFused.java
+++ b/src/main/java/org/distorted/objects/TwistyBandagedFused.java
@@ -33,69 +33,59 @@ import java.util.Random;
 
 class TwistyBandagedFused extends TwistyBandagedAbstract
 {
-  TwistyBandagedFused(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
-                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
-    {
-    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN1, res, scrWidth);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  int getCubitVariant(int cubit)
-    {
-    return cubit==0 ? 4:0;
-    }
+  private static final float[][] POSITIONS = new float[][]
+      {
+       {-1.0f, -1.0f, +0.0f,
+        -1.0f, -1.0f, +1.0f,
+        -1.0f,  0.0f, +0.0f,
+        -1.0f,  0.0f, +1.0f,
+         0.0f, -1.0f, +0.0f,
+         0.0f, -1.0f, +1.0f,
+         0.0f,  0.0f, +0.0f,
+         0.0f,  0.0f, +1.0f},
+       {-1.0f, +1.0f, +1.0f},
+       {-1.0f, +1.0f, +0.0f},
+       {-1.0f, +1.0f, -1.0f},
+       { 0.0f, +1.0f, +1.0f},
+       { 0.0f, +1.0f, +0.0f},
+       { 0.0f, +1.0f, -1.0f},
+       { 1.0f, +1.0f, +1.0f},
+       { 1.0f, +1.0f, +0.0f},
+       { 1.0f, +1.0f, -1.0f},
+       { 1.0f,  0.0f, +1.0f},
+       { 1.0f,  0.0f, +0.0f},
+       { 1.0f,  0.0f, -1.0f},
+       { 1.0f, -1.0f, +1.0f},
+       { 1.0f, -1.0f, +0.0f},
+       { 1.0f, -1.0f, -1.0f},
+       {-1.0f, -1.0f, -1.0f},
+       {-1.0f,  0.0f, -1.0f},
+       { 0.0f, -1.0f, -1.0f},
+       { 0.0f,  0.0f, -1.0f}
+      };
+
+  private static final int[] QUAT_INDICES = new int[] { 0 };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getNumCubits()
+  TwistyBandagedFused(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
+                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
     {
-    return 20;
+    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN1, res, scrWidth);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  float[] getCubitPosition(int cubit)
+  float[][] getPositions()
     {
-    switch(cubit)
-      {
-      case  0: return new float[] {-1.0f, -1.0f, +0.0f,
-                                   -1.0f, -1.0f, +1.0f,
-                                   -1.0f,  0.0f, +0.0f,
-                                   -1.0f,  0.0f, +1.0f,
-                                    0.0f, -1.0f, +0.0f,
-                                    0.0f, -1.0f, +1.0f,
-                                    0.0f,  0.0f, +0.0f,
-                                    0.0f,  0.0f, +1.0f};
-      case  1: return new float[] {-1.0f, +1.0f, +1.0f};
-      case  2: return new float[] {-1.0f, +1.0f, +0.0f};
-      case  3: return new float[] {-1.0f, +1.0f, -1.0f};
-      case  4: return new float[] { 0.0f, +1.0f, +1.0f};
-      case  5: return new float[] { 0.0f, +1.0f, +0.0f};
-      case  6: return new float[] { 0.0f, +1.0f, -1.0f};
-      case  7: return new float[] { 1.0f, +1.0f, +1.0f};
-      case  8: return new float[] { 1.0f, +1.0f, +0.0f};
-      case  9: return new float[] { 1.0f, +1.0f, -1.0f};
-      case 10: return new float[] { 1.0f,  0.0f, +1.0f};
-      case 11: return new float[] { 1.0f,  0.0f, +0.0f};
-      case 12: return new float[] { 1.0f,  0.0f, -1.0f};
-      case 13: return new float[] { 1.0f, -1.0f, +1.0f};
-      case 14: return new float[] { 1.0f, -1.0f, +0.0f};
-      case 15: return new float[] { 1.0f, -1.0f, -1.0f};
-      case 16: return new float[] {-1.0f, -1.0f, -1.0f};
-      case 17: return new float[] {-1.0f,  0.0f, -1.0f};
-      case 18: return new float[] { 0.0f, -1.0f, -1.0f};
-      case 19: return new float[] { 0.0f,  0.0f, -1.0f};
-      }
-
-    return null;
+    return POSITIONS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getQuatIndex(int cubit)
+  int[] getQuatIndices()
     {
-    return 0;
+    return QUAT_INDICES;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
