commit d55d2c6a59317648a58cd3c679a777858b1aaede
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Jan 4 21:27:52 2022 +0100

    Clenups.

diff --git a/src/main/java/org/distorted/objectlib/main/Cubit.java b/src/main/java/org/distorted/objectlib/main/Cubit.java
index 24323158..a4c54ca6 100644
--- a/src/main/java/org/distorted/objectlib/main/Cubit.java
+++ b/src/main/java/org/distorted/objectlib/main/Cubit.java
@@ -76,12 +76,12 @@ public class Cubit
     float xd,yd,zd,wd;
     float diff, mindiff = Float.MAX_VALUE;
     int ret=0;
-    int num_quats = mParent.OBJECT_QUATS.length;
+    int num_quats = mParent.mObjectQuats.length;
     Static4D qt;
 
     for(int q=0; q<num_quats; q++)
       {
-      qt = mParent.OBJECT_QUATS[q];
+      qt = mParent.mObjectQuats[q];
 
       xd = x - qt.get0();
       yd = y - qt.get1();
@@ -155,7 +155,7 @@ public class Cubit
     for(int axis=0; axis<mNumAxis; axis++)
       {
       result += (mRotationRow[axis]<<accumulativeShift);
-      accumulativeShift += mParent.SHIFT;
+      accumulativeShift += mParent.mMaxNumLayers;
       }
 
     return result;
@@ -182,7 +182,7 @@ public class Cubit
 
   int removeRotationNow(Static4D quat)
     {
-    Static4D q = QuatHelper.quatMultiply(quat,mParent.OBJECT_QUATS[mQuatIndex]);
+    Static4D q = QuatHelper.quatMultiply(quat,mParent.mObjectQuats[mQuatIndex]);
     mQuatIndex = normalizeScrambleQuat(q);
 
     modifyCurrentPosition(quat);
@@ -206,19 +206,6 @@ public class Cubit
     mParent = null;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// this is only needed for MODE_REPLACE objects (i.e. - currently - CUBE_3), so it is enough to only
-// take into consideration the first position.
-
-  float getDistSquared(float[] point)
-    {
-    float dx = mCurrentPosition[0] - point[0];
-    float dy = mCurrentPosition[1] - point[1];
-    float dz = mCurrentPosition[2] - point[2];
-
-    return dx*dx + dy*dy + dz*dz;
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public int getRotRow(int axisIndex)
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index d85cab88..0a96d91d 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -198,7 +198,7 @@ public class ObjectPreRender implements EffectListener
     {
     mAddRotation = false;
 
-    if( mNewObject.NUM_AXIS>mAddRotationAxis )
+    if( mNewObject.mNumAxis > mAddRotationAxis )
       {
       mAddRotationID = mNewObject.addNewRotation( mAddRotationAxis, mAddRotationRowBitmap,
                                                   mAddRotationAngle, mAddRotationDuration, this);
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObject.java b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
index a3b652c5..db7adf36 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObject.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
@@ -93,8 +93,8 @@ public abstract class TwistyObject
   private static final int POST_ROTATION_MILLISEC = 500;
 
   protected float[][] mStickerCoords;
-  int NUM_AXIS, SHIFT;
-  Static4D[] OBJECT_QUATS;
+  int mNumAxis, mMaxNumLayers;
+  Static4D[] mObjectQuats;
 
   private int[][] mStickerVariants;
   private float[] mStickerScales;
@@ -179,26 +179,26 @@ public abstract class TwistyObject
     mSolvedFunctionIndex = getSolvedFunctionIndex();
 
     int numAxis = mAxis.length;
-    SHIFT = -1;
+    mMaxNumLayers = -1;
 
     mCuts = getCuts(mNumLayers);
     mNumCuts = new int[numAxis];
     for(int i=0; i<numAxis; i++)
       {
-      if( SHIFT<mNumLayers[i] ) SHIFT = mNumLayers[i];
+      if( mMaxNumLayers<mNumLayers[i] ) mMaxNumLayers = mNumLayers[i];
       mNumCuts[i] = (mCuts==null || mCuts[i]==null ? 0 : mCuts[i].length);
       }
 
     mNumCubits = mOrigPos.length;
     mNumFaceColors = getNumFaceColors();
-    NUM_AXIS = mAxis.length;
+    mNumAxis = mAxis.length;
 
-    OBJECT_QUATS = getQuats();
-    mNumQuats = OBJECT_QUATS.length;
+    mObjectQuats = getQuats();
+    mNumQuats = mObjectQuats.length;
 
     int scramblingType = getScrambleType();
     ScrambleState[] states = getScrambleStates();
-    mScrambler = new TwistyObjectScrambler(scramblingType,NUM_AXIS,mNumLayers,states);
+    mScrambler = new TwistyObjectScrambler(scramblingType, mNumAxis,mNumLayers,states);
 
     boolean bandaged=false;
 
@@ -239,7 +239,7 @@ public abstract class TwistyObject
 
     for( int q=0; q<mNumQuats; q++)
       {
-      VertexEffectQuaternion vq = new VertexEffectQuaternion(OBJECT_QUATS[q],CENTER);
+      VertexEffectQuaternion vq = new VertexEffectQuaternion(mObjectQuats[q],CENTER);
       vq.setMeshAssociation(0,q);
       mEffects.apply(vq);
       }
@@ -354,7 +354,7 @@ public abstract class TwistyObject
 
       for(int i=0; i<mNumCubits; i++)
         {
-        mCubits[i] = new Cubit(this,mOrigPos[i], NUM_AXIS);
+        mCubits[i] = new Cubit(this,mOrigPos[i], mNumAxis);
         mMesh.setEffectAssociation(i, mCubits[i].computeAssociation(), 0);
         }
       }
@@ -364,7 +364,7 @@ public abstract class TwistyObject
 
       for(int i=0; i<mNumCubits; i++)
         {
-        mCubits[i] = new Cubit(this,mOrigPos[i], NUM_AXIS);
+        mCubits[i] = new Cubit(this,mOrigPos[i], mNumAxis);
         cubitMesh[i] = createCubitMesh(i,mNumLayers,meshState,mNumCubitFaces);
         Static3D pos = getPos(mOrigPos[i]);
         cubitMesh[i].apply(new MatrixEffectMove(pos),1,0);
@@ -591,7 +591,7 @@ public abstract class TwistyObject
     float MAXDIFF = 0.01f;
     float[] center= mOrigPos[centerNum];
     Static4D sc = new Static4D(center[0], center[1], center[2], 1.0f);
-    Static4D result = QuatHelper.rotateVectorByQuat(sc,OBJECT_QUATS[quatNum]);
+    Static4D result = QuatHelper.rotateVectorByQuat(sc,mObjectQuats[quatNum]);
 
     float x = result.get0();
     float y = result.get1();
@@ -898,7 +898,7 @@ public abstract class TwistyObject
 
   int mulQuat(int q1, int q2)
     {
-    Static4D result = QuatHelper.quatMultiply(OBJECT_QUATS[q1],OBJECT_QUATS[q2]);
+    Static4D result = QuatHelper.quatMultiply(mObjectQuats[q1],mObjectQuats[q2]);
 
     float rX = result.get0();
     float rY = result.get1();
@@ -910,20 +910,20 @@ public abstract class TwistyObject
 
     for(int i=0; i<mNumQuats; i++)
       {
-      dX = OBJECT_QUATS[i].get0() - rX;
-      dY = OBJECT_QUATS[i].get1() - rY;
-      dZ = OBJECT_QUATS[i].get2() - rZ;
-      dW = OBJECT_QUATS[i].get3() - rW;
+      dX = mObjectQuats[i].get0() - rX;
+      dY = mObjectQuats[i].get1() - rY;
+      dZ = mObjectQuats[i].get2() - rZ;
+      dW = mObjectQuats[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 = OBJECT_QUATS[i].get0() + rX;
-      dY = OBJECT_QUATS[i].get1() + rY;
-      dZ = OBJECT_QUATS[i].get2() + rZ;
-      dW = OBJECT_QUATS[i].get3() + rW;
+      dX = mObjectQuats[i].get0() + rX;
+      dY = mObjectQuats[i].get1() + rY;
+      dZ = mObjectQuats[i].get2() + rZ;
+      dW = mObjectQuats[i].get3() + rW;
 
       if( dX<MAX_ERROR && dX>-MAX_ERROR &&
           dY<MAX_ERROR && dY>-MAX_ERROR &&
@@ -1030,7 +1030,7 @@ public abstract class TwistyObject
       mRotationAngle.resetToBeginning();
       mRotationAngle.add(new Static1D(0));
       mRotationAngle.add(new Static1D(angle));
-      mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*SHIFT) , -1);
+      mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*mMaxNumLayers) , -1);
       mRotateEffect.notifyWhenFinished(listener);
 
       return mRotateEffect.getID();
@@ -1050,7 +1050,7 @@ public abstract class TwistyObject
 
   synchronized void beginNewRotation(int axis, int row )
     {
-    if( axis<0 || axis>=NUM_AXIS )
+    if( axis<0 || axis>=mNumAxis )
       {
       android.util.Log.e("object", "invalid rotation axis: "+axis);
       return;
@@ -1066,7 +1066,7 @@ public abstract class TwistyObject
     mRotationAngleStatic.set0(0.0f);
     mRotationAxis.set( mAxis[axis] );
     mRotationAngle.add(mRotationAngleStatic);
-    mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*SHIFT) , -1);
+    mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*mMaxNumLayers) , -1);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1147,7 +1147,7 @@ public abstract class TwistyObject
 
       if( mQuatDebug[i]>=0 && mQuatDebug[i]<mNumQuats )
         {
-        mCubits[i].modifyCurrentPosition(OBJECT_QUATS[mQuatDebug[i]]);
+        mCubits[i].modifyCurrentPosition(mObjectQuats[mQuatDebug[i]]);
         mMesh.setEffectAssociation(i, mCubits[i].computeAssociation(),mQuatDebug[i]);
         }
       else
