commit 7437ebb3b702ddae59d450d21aba38a92189b454
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Mar 16 15:39:24 2020 +0000

    Still a fix for the previous fix - cubits lie on faces only if their RotationRow is very close to 0 or mSize-1, and not when their RotationRow rounded to the nearest integer is 0 or mSize-1 ! ( counterexample: the rotated tetrahedrons of Pyraminx )

diff --git a/src/main/java/org/distorted/object/Cubit.java b/src/main/java/org/distorted/object/Cubit.java
index 445a9d3c..55198f93 100644
--- a/src/main/java/org/distorted/object/Cubit.java
+++ b/src/main/java/org/distorted/object/Cubit.java
@@ -253,12 +253,14 @@ class Cubit
 
     int belongsToHowManyFaces = 0;
     int size = mParent.getSize()-1;
-    int row;
+    float row;
+    final float MAX_ERROR = 0.01f;
 
     for(int i=0; i<mNumAxis; i++)
       {
-      row = (int)(mRotationRow[i]+0.5f);
-      if( row==0 || row==size ) belongsToHowManyFaces++;
+      row = mRotationRow[i];
+      if( (row     <MAX_ERROR && row     >-MAX_ERROR) ||
+          (row-size<MAX_ERROR && row-size>-MAX_ERROR)  ) belongsToHowManyFaces++;
       }
 
     switch(belongsToHowManyFaces)
@@ -273,7 +275,7 @@ class Cubit
                Static4D rotated1 = RubikSurfaceView.rotateVectorByQuat( cubitCenter, quat);
                Static4D rotated2 = RubikSurfaceView.rotateVectorByQuat( cubitCenter, mQuatScramble );
 
-               int row1, row2;
+               float row1, row2, row3, row4;
                float ax,ay,az;
                Static3D axis;
                float x1 = rotated1.get0();
@@ -290,10 +292,13 @@ class Cubit
                  ay = axis.get1();
                  az = axis.get2();
 
-                 row1 = (int)(( (x1*ax + y1*ay + z1*az) - mParent.mStart)/mParent.mStep + 0.5f);
-                 row2 = (int)(( (x2*ax + y2*ay + z2*az) - mParent.mStart)/mParent.mStep + 0.5f);
+                 row1 = ((x1*ax + y1*ay + z1*az) - mParent.mStart) / mParent.mStep;
+                 row2 = ((x2*ax + y2*ay + z2*az) - mParent.mStart) / mParent.mStep;
+                 row3 = row1 - size;
+                 row4 = row2 - size;
 
-                 if( (row1==0 && row2==0) || (row1==size && row2==size) )
+                 if( (row1<MAX_ERROR && row1>-MAX_ERROR && row2<MAX_ERROR && row2>-MAX_ERROR) ||
+                     (row3<MAX_ERROR && row3>-MAX_ERROR && row4<MAX_ERROR && row4>-MAX_ERROR)  )
                    {
                    return true;
                    }
