commit ad38d800d2de6ec1b92b78de9f42bbeb881871b4
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Aug 9 23:01:36 2020 +0100

    Introduce separate ROT_AXIS and FACE_AXIS ( step 1 )

diff --git a/src/main/java/org/distorted/main/RubikSurfaceView.java b/src/main/java/org/distorted/main/RubikSurfaceView.java
index 0d60ad06..2ddf8a57 100644
--- a/src/main/java/org/distorted/main/RubikSurfaceView.java
+++ b/src/main/java/org/distorted/main/RubikSurfaceView.java
@@ -34,7 +34,7 @@ import org.distorted.library.type.Static2D;
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 import org.distorted.objects.RubikObject;
-import org.distorted.objects.RubikObjectMovement;
+import org.distorted.objects.RubikMovementObject;
 import org.distorted.solvers.SolverMain;
 import org.distorted.states.RubikState;
 import org.distorted.states.RubikStatePlay;
@@ -71,7 +71,7 @@ public class RubikSurfaceView extends GLSurfaceView
 
     private RubikRenderer mRenderer;
     private RubikPreRender mPreRender;
-    private RubikObjectMovement mMovement;
+    private RubikMovementObject mMovement;
     private boolean mDragging, mBeginningRotation, mContinuingRotation;
     private int mScreenWidth, mScreenHeight, mScreenMin;
 
@@ -140,7 +140,7 @@ public class RubikSurfaceView extends GLSurfaceView
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    void setMovement(RubikObjectMovement movement)
+    void setMovement(RubikMovementObject movement)
       {
       mMovement = movement;
       }
diff --git a/src/main/java/org/distorted/objects/RubikCube.java b/src/main/java/org/distorted/objects/RubikCube.java
index 5700343a..25f0e1c8 100644
--- a/src/main/java/org/distorted/objects/RubikCube.java
+++ b/src/main/java/org/distorted/objects/RubikCube.java
@@ -43,18 +43,26 @@ class RubikCube extends RubikObject
   static final float SQ2 = (float)Math.sqrt(2);
 
   // the three rotation axis of a RubikCube. Must be normalized.
-  static final Static3D[] AXIS = new Static3D[]
+  static final Static3D[] ROT_AXIS = new Static3D[]
          {
            new Static3D(1,0,0),
            new Static3D(0,1,0),
            new Static3D(0,0,1)
          };
 
+  // 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,   // AXIS[0]right (right-YELLOW) AXIS[0]left (left  -WHITE)
-           0xff0000ff, 0xff00ff00,   // AXIS[1]right (top  -BLUE  ) AXIS[1]left (bottom-GREEN)
-           0xffff0000, 0xffb5651d    // AXIS[2]right (front-RED   ) AXIS[2]left (back  -BROWN)
+           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 RubikCube of any size.
@@ -304,7 +312,7 @@ class RubikCube extends RubikObject
 
   public Static3D[] getRotationAxis()
     {
-    return AXIS;
+    return ROT_AXIS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objects/RubikCubeMovement.java b/src/main/java/org/distorted/objects/RubikCubeMovement.java
deleted file mode 100644
index 872cec9e..00000000
--- a/src/main/java/org/distorted/objects/RubikCubeMovement.java
+++ /dev/null
@@ -1,37 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// 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 RubikCubeMovement extends RubikObjectMovement
-{
-  RubikCubeMovement()
-    {
-    super(RubikCube.AXIS, 2, 0.5f, 0.5f);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  boolean isInsideFace(float[] p)
-    {
-    return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
-    }
-}
diff --git a/src/main/java/org/distorted/objects/RubikDino.java b/src/main/java/org/distorted/objects/RubikDino.java
index fd8d38bb..a4f0481e 100644
--- a/src/main/java/org/distorted/objects/RubikDino.java
+++ b/src/main/java/org/distorted/objects/RubikDino.java
@@ -51,7 +51,7 @@ public class RubikDino extends RubikObject
   private static final float ANGLE_FACES = (float)((180/Math.PI)*(2*Math.asin(SQ3/3))); // angle between two faces of a tetrahedron
 
   // the four rotation axis of a RubikDino. Must be normalized.
-  static final Static3D[] AXIS = new Static3D[]
+  static final Static3D[] ROT_AXIS = new Static3D[]
          {
            new Static3D(+SQ3/3,+SQ3/3,+SQ3/3),
            new Static3D(+SQ3/3,+SQ3/3,-SQ3/3),
@@ -59,11 +59,19 @@ public class RubikDino extends RubikObject
            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,   // (right-YELLOW) (left  -WHITE)
-           0xff0000ff, 0xff00ff00,   // (top  -BLUE  ) (bottom-GREEN)
-           0xffff0000, 0xffb5651d    // (front-RED   ) (back  -BROWN)
+           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 RubikDino
@@ -328,7 +336,7 @@ public class RubikDino extends RubikObject
 
   public Static3D[] getRotationAxis()
     {
-    return AXIS;
+    return ROT_AXIS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objects/RubikDinoMovement.java b/src/main/java/org/distorted/objects/RubikDinoMovement.java
deleted file mode 100644
index 8411c3c2..00000000
--- a/src/main/java/org/distorted/objects/RubikDinoMovement.java
+++ /dev/null
@@ -1,37 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// 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 RubikDinoMovement extends RubikObjectMovement
-{
-  RubikDinoMovement()
-    {
-    super(RubikDino.AXIS, 1.5f, 0.5f, 0.5f);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  boolean isInsideFace(float[] p)
-    {
-    return false;//( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
-    }
-}
diff --git a/src/main/java/org/distorted/objects/RubikMovementCube.java b/src/main/java/org/distorted/objects/RubikMovementCube.java
new file mode 100644
index 00000000..775a1722
--- /dev/null
+++ b/src/main/java/org/distorted/objects/RubikMovementCube.java
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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 RubikMovementCube extends RubikMovementObject
+{
+  RubikMovementCube()
+    {
+    super(RubikCube.ROT_AXIS, RubikCube.FACE_AXIS, 0.5f, 0.5f);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  boolean isInsideFace(float[] p)
+    {
+    return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
+    }
+}
diff --git a/src/main/java/org/distorted/objects/RubikMovementDino.java b/src/main/java/org/distorted/objects/RubikMovementDino.java
new file mode 100644
index 00000000..8f05264a
--- /dev/null
+++ b/src/main/java/org/distorted/objects/RubikMovementDino.java
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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 RubikMovementDino extends RubikMovementObject
+{
+  RubikMovementDino()
+    {
+    super(RubikDino.ROT_AXIS, RubikDino.FACE_AXIS, 0.5f, 0.5f);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  boolean isInsideFace(float[] p)
+    {
+    return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
+    }
+}
diff --git a/src/main/java/org/distorted/objects/RubikMovementObject.java b/src/main/java/org/distorted/objects/RubikMovementObject.java
new file mode 100644
index 00000000..bcd43985
--- /dev/null
+++ b/src/main/java/org/distorted/objects/RubikMovementObject.java
@@ -0,0 +1,316 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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 org.distorted.library.type.Static2D;
+import org.distorted.library.type.Static3D;
+import org.distorted.library.type.Static4D;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public abstract class RubikMovementObject
+  {
+  private int mLastTouchedAxis;
+  private float[] mPoint, mCamera, mTouch;
+  private float[] mPoint2D, mMove2D;
+  private float[][][] mCastAxis;
+  private int mLastTouchedLR;
+  private int mNumRotAxis, mNumFaceAxis, mNumFacesPerAxis;
+  private float mDistanceCenterFace3D, mDistanceCenterFace2D;
+  private Static3D[] mRotAxis, mFaceAxis;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  abstract boolean isInsideFace(float[] point);
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  RubikMovementObject(Static3D[] rotAxis, Static3D[] faceAxis, float distance3D, float distance2D)
+    {
+    mPoint = new float[3];
+    mCamera= new float[3];
+    mTouch = new float[3];
+
+    mPoint2D = new float[2];
+    mMove2D  = new float[2];
+
+    mRotAxis    = rotAxis;
+    mNumRotAxis = mRotAxis.length;
+    mFaceAxis   = faceAxis;
+    mNumFaceAxis= mFaceAxis.length;
+
+    mNumFacesPerAxis = mNumFaceAxis / mNumRotAxis;
+    mDistanceCenterFace3D = distance3D; // distance from the center of the object to each of its faces
+    mDistanceCenterFace2D = distance2D; // distance from the center of a face to its edge
+
+    // mCastAxis[1][2]{0,1} are the 2D coords of the 2nd axis cast onto the face defined by the
+    // 1st pair (axis,lr)
+    mCastAxis = new float[mNumFaceAxis][mNumRotAxis][2];
+
+    for( int casted=0; casted<mNumRotAxis; casted++)
+      {
+      Static3D a = mRotAxis[casted];
+      mPoint[0]= a.get0();
+      mPoint[1]= a.get1();
+      mPoint[2]= a.get2();
+
+      for( int surface=0; surface<mNumRotAxis; surface++)
+        for(int lr=0; lr<mNumFacesPerAxis; lr++)
+          {
+          int index = surface*mNumFacesPerAxis + lr;
+
+          if( casted!=surface )
+            {
+            convertTo2Dcoords( mPoint, mRotAxis[surface], lr, mPoint2D);
+            mCastAxis[index][casted][0] = mPoint2D[0];
+            mCastAxis[index][casted][1] = mPoint2D[1];
+            normalize2D(mCastAxis[index][casted]);
+            }
+          else
+            {
+            mCastAxis[index][casted][0] = 0;
+            mCastAxis[index][casted][1] = 0;
+            }
+          }
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void normalize2D(float[] vect)
+    {
+    float len = (float)Math.sqrt(vect[0]*vect[0] + vect[1]*vect[1]);
+    vect[0] /= len;
+    vect[1] /= len;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// find the casted axis with which our move2D vector forms an angle closest to 90 deg.
+
+  private int computeRotationIndex(int axis, int lr, float[] move2D)
+    {
+    float cosAngle, minCosAngle = Float.MAX_VALUE;
+    int minIndex=-1;
+    int index = axis*mNumFacesPerAxis + lr;
+    float m0 = move2D[0];
+    float m1 = move2D[1];
+    float len = (float)Math.sqrt(m0*m0 + m1*m1);
+
+    if( len!=0.0f )
+      {
+      m0 /= len;
+      m1 /= len;
+      }
+    else
+      {
+      m0 = 1.0f;  // arbitrarily
+      m1 = 0.0f;  //
+      }
+
+    for(int i=0; i<mNumRotAxis; i++)
+      {
+      if( axis != i )
+        {
+        cosAngle = m0*mCastAxis[index][i][0] +  m1*mCastAxis[index][i][1];
+        if( cosAngle<0 ) cosAngle = -cosAngle;
+
+        if( cosAngle<minCosAngle )
+          {
+          minCosAngle=cosAngle;
+          minIndex = i;
+          }
+        }
+      }
+
+    return minIndex;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private float computeOffset(float[] point, float[] axis)
+    {
+    return point[0]*axis[0] + point[1]*axis[1] + mDistanceCenterFace2D;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private boolean faceIsVisible(Static3D axis, int lr)
+    {
+    float castCameraOnAxis = mCamera[0]*axis.get0() + mCamera[1]*axis.get1() + mCamera[2]*axis.get2();
+    return (2*lr-1)*castCameraOnAxis > mDistanceCenterFace3D;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// given precomputed mCamera and mPoint, respectively camera and touch point positions in ScreenSpace,
+// compute point 'output[]' which:
+// 1) lies on a face of the Object, i.e. surface defined by (axis, distance from (0,0,0)) [and this
+//    distance is +-mDistanceCenterFace, depending if it is the face on the left or the right end of
+//    the axis] (lr=0 or 1, so (2lr-1)*mDistanceCenterFace)
+// 2) is co-linear with mCamera and mPoint
+//
+// output = camera + alpha*(point-camera), where alpha = [dist-axis*camera] / [axis*(point-camera)]
+
+  private void castTouchPointOntoFace(Static3D axis, int lr, float[] output)
+    {
+    float d0 = mPoint[0]-mCamera[0];
+    float d1 = mPoint[1]-mCamera[1];
+    float d2 = mPoint[2]-mCamera[2];
+    float a0 = axis.get0();
+    float a1 = axis.get1();
+    float a2 = axis.get2();
+
+    float denom = a0*d0 + a1*d1 + a2*d2;
+
+    if( denom != 0.0f )
+      {
+      float axisCam = a0*mCamera[0] + a1*mCamera[1] + a2*mCamera[2];
+      float distance = (2*lr-1)*mDistanceCenterFace3D;
+      float alpha = (distance-axisCam)/denom;
+
+      output[0] = mCamera[0] + d0*alpha;
+      output[1] = mCamera[1] + d1*alpha;
+      output[2] = mCamera[2] + d2*alpha;
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Convert the 3D point3D into a 2D point on the same face surface, but in a different
+// coordinate system: a in-plane 2D coord where the origin is in the point where the axis intersects
+// the surface, and whose Y axis points 'north' i.e. is in the plane given by the 3D origin, the
+// original 3D Y axis and our 2D in-plane origin.
+// If those 3 points constitute a degenerate triangle which does not define a plane - which can only
+// happen if axis is vertical (or in theory when 2D origin and 3D origin meet, but that would have to
+// mean that the distance between the center of the Object and its faces is 0) - then we arbitrarily
+// decide that 2D Y = (0,0,-1) in the North Pole and (0,0,1) in the South Pole)
+
+  private void convertTo2Dcoords(float[] point3D, Static3D axis, int lr, float[] output)
+    {
+    float y0,y1,y2; // base Y vector of the 2D coord system
+    float a0 = axis.get0();
+    float a1 = axis.get1();
+    float a2 = axis.get2();
+
+    if( lr==0 )
+      {
+      a0=-a0; a1=-a1; a2=-a2;
+      }
+
+    if( a0==0.0f && a2==0.0f )
+      {
+      y0=0; y1=0; y2=-a1;
+      }
+    else if( a1==0.0f )
+      {
+      y0=0; y1=1; y2=0;
+      }
+    else
+      {
+      float norm = (float)(-a1/Math.sqrt(1-a1*a1));
+      y0 = norm*a0; y1= norm*(a1-1/a1); y2=norm*a2;
+      }
+
+    float x0 = y1*a2 - y2*a1;  //
+    float x1 = y2*a0 - y0*a2;  // (2D coord baseY) x (axis) = 2D coord baseX
+    float x2 = y0*a1 - y1*a0;  //
+
+    float originAlpha = point3D[0]*a0 + point3D[1]*a1 + point3D[2]*a2;
+
+    float origin0 = originAlpha*a0; // coords of the point where axis
+    float origin1 = originAlpha*a1; // intersects surface plane i.e.
+    float origin2 = originAlpha*a2; // the origin of our 2D coord system
+
+    float v0 = point3D[0] - origin0;
+    float v1 = point3D[1] - origin1;
+    float v2 = point3D[2] - origin2;
+
+    output[0] = v0*x0 + v1*x1 + v2*x2;
+    output[1] = v0*y0 + v1*y1 + v2*y2;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// PUBLIC API
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public boolean faceTouched(Static4D rotatedTouchPoint, Static4D rotatedCamera)
+    {
+    float objectRatio = RubikObject.getObjectRatio();
+
+    mPoint[0]  = rotatedTouchPoint.get0()/objectRatio;
+    mPoint[1]  = rotatedTouchPoint.get1()/objectRatio;
+    mPoint[2]  = rotatedTouchPoint.get2()/objectRatio;
+
+    mCamera[0] = rotatedCamera.get0()/objectRatio;
+    mCamera[1] = rotatedCamera.get1()/objectRatio;
+    mCamera[2] = rotatedCamera.get2()/objectRatio;
+
+    for( mLastTouchedAxis=0; mLastTouchedAxis<mNumRotAxis; mLastTouchedAxis++)
+      {
+      for( mLastTouchedLR=0; mLastTouchedLR<mNumFacesPerAxis; mLastTouchedLR++)
+        {
+        if( faceIsVisible(mRotAxis[mLastTouchedAxis], mLastTouchedLR) )
+          {
+          castTouchPointOntoFace(mRotAxis[mLastTouchedAxis], mLastTouchedLR, mTouch);
+          convertTo2Dcoords(mTouch, mRotAxis[mLastTouchedAxis], mLastTouchedLR, mPoint2D);
+
+          if( isInsideFace(mPoint2D) ) return true;
+          }
+        }
+      }
+
+    return false;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public Static2D newRotation(Static4D rotatedTouchPoint)
+    {
+    float objectRatio = RubikObject.getObjectRatio();
+
+    mPoint[0] = rotatedTouchPoint.get0()/objectRatio;
+    mPoint[1] = rotatedTouchPoint.get1()/objectRatio;
+    mPoint[2] = rotatedTouchPoint.get2()/objectRatio;
+
+    castTouchPointOntoFace(mRotAxis[mLastTouchedAxis], mLastTouchedLR, mTouch);
+    convertTo2Dcoords(mTouch, mRotAxis[mLastTouchedAxis], mLastTouchedLR, mMove2D);
+
+    mMove2D[0] -= mPoint2D[0];
+    mMove2D[1] -= mPoint2D[1];
+
+    int rotIndex = computeRotationIndex(mLastTouchedAxis, mLastTouchedLR, mMove2D);
+    int index    = mLastTouchedAxis*mNumFacesPerAxis+mLastTouchedLR;
+    float offset = computeOffset(mPoint2D, mCastAxis[index][rotIndex]);
+
+    return new Static2D(rotIndex,offset);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int getTouchedFace()
+    {
+    return mNumFacesPerAxis==2 ? 2*mLastTouchedAxis + 1 - mLastTouchedLR : mLastTouchedAxis;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public float[] getTouchedPoint3D()
+    {
+    return mTouch;
+    }
+  }
diff --git a/src/main/java/org/distorted/objects/RubikMovementPyraminx.java b/src/main/java/org/distorted/objects/RubikMovementPyraminx.java
new file mode 100644
index 00000000..2f7a0227
--- /dev/null
+++ b/src/main/java/org/distorted/objects/RubikMovementPyraminx.java
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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 RubikMovementPyraminx extends RubikMovementObject
+{
+  private static final float SQ6 = (float)Math.sqrt(6);
+  private static final float SQ3 = (float)Math.sqrt(3);
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  RubikMovementPyraminx()
+    {
+    super(RubikPyraminx.ROT_AXIS, RubikPyraminx.FACE_AXIS, SQ6/12, SQ3/6);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  boolean isInsideFace(float[] p)
+    {
+    boolean a1 = p[1] >= -SQ3/6;
+    boolean a2 = p[1] <=  SQ3*(1.0f/3 + p[0]);
+    boolean a3 = p[1] <=  SQ3*(1.0f/3 - p[0]);
+
+    return a1 && a2 && a3;
+    }
+}
diff --git a/src/main/java/org/distorted/objects/RubikObjectList.java b/src/main/java/org/distorted/objects/RubikObjectList.java
index 58964be8..2c17be51 100644
--- a/src/main/java/org/distorted/objects/RubikObjectList.java
+++ b/src/main/java/org/distorted/objects/RubikObjectList.java
@@ -42,7 +42,7 @@ public enum RubikObjectList
                        {5 , 24, R.raw.cube5, R.drawable.ui_small_cube5, R.drawable.ui_medium_cube5, R.drawable.ui_big_cube5, R.drawable.ui_huge_cube5}
                      },
          RubikCube.class,
-         new RubikCubeMovement()
+         new RubikMovementCube()
        ),
 
   PYRA (
@@ -52,7 +52,7 @@ public enum RubikObjectList
                        {5 , 20, R.raw.pyra5, R.drawable.ui_small_pyra5, R.drawable.ui_medium_pyra5, R.drawable.ui_big_pyra5, R.drawable.ui_huge_pyra5}
                      },
          RubikPyraminx.class,
-         new RubikPyraminxMovement()
+         new RubikMovementPyraminx()
        ),
 
   DINO (
@@ -60,7 +60,7 @@ public enum RubikObjectList
                        {3 , 10, R.raw.pyra3, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
                      },
          RubikDino.class,
-         new RubikDinoMovement()
+         new RubikMovementDino()
        ),
   ;
 
@@ -71,7 +71,7 @@ public enum RubikObjectList
 
   private final int[] mObjectSizes, mMaxLevels, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
   private final Class<? extends RubikObject> mObjectClass;
-  private final RubikObjectMovement mObjectMovementClass;
+  private final RubikMovementObject mObjectMovementClass;
   private static final RubikObjectList[] objects;
   private static int mNumAll;
 
@@ -283,7 +283,7 @@ public enum RubikObjectList
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  RubikObjectList(int[][] info, Class<? extends RubikObject> object , RubikObjectMovement movement)
+  RubikObjectList(int[][] info, Class<? extends RubikObject> object , RubikMovementObject movement)
     {
     int length = info.length;
 
@@ -373,7 +373,7 @@ public enum RubikObjectList
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public RubikObjectMovement getObjectMovementClass()
+  public RubikMovementObject getObjectMovementClass()
     {
     return mObjectMovementClass;
     }
diff --git a/src/main/java/org/distorted/objects/RubikObjectMovement.java b/src/main/java/org/distorted/objects/RubikObjectMovement.java
deleted file mode 100644
index 337bc968..00000000
--- a/src/main/java/org/distorted/objects/RubikObjectMovement.java
+++ /dev/null
@@ -1,313 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// 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 org.distorted.library.type.Static2D;
-import org.distorted.library.type.Static3D;
-import org.distorted.library.type.Static4D;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public abstract class RubikObjectMovement
-  {
-  private int mLastTouchedAxis;
-  private float[] mPoint, mCamera, mTouch;
-  private float[] mPoint2D, mMove2D;
-  private float[][][] mCastAxis;
-  private int mLastTouchedLR;
-  private int mNumAxis, mNumFacesPerAxis;
-  private float mDistanceCenterFace3D, mDistanceCenterFace2D;
-  private Static3D[] mAxis;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  abstract boolean isInsideFace(float[] point);
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  RubikObjectMovement(Static3D[] axis, float numFacesPerAxis, float distance3D, float distance2D)
-    {
-    mPoint = new float[3];
-    mCamera= new float[3];
-    mTouch = new float[3];
-
-    mPoint2D = new float[2];
-    mMove2D  = new float[2];
-
-    mAxis = axis;
-    mNumAxis = mAxis.length;
-    mNumFacesPerAxis = (int)numFacesPerAxis;  // TODO
-    mDistanceCenterFace3D = distance3D; // distance from the center of the object to each of its faces
-    mDistanceCenterFace2D = distance2D; // distance from the center of a face to its edge
-
-    // mCastAxis[1][2]{0,1} are the 2D coords of the 2nd axis cast onto the face defined by the
-    // 1st pair (axis,lr)
-    mCastAxis = new float[mNumAxis*mNumFacesPerAxis][mNumAxis][2];
-
-    for( int casted=0; casted<mNumAxis; casted++)
-      {
-      Static3D a = mAxis[casted];
-      mPoint[0]= a.get0();
-      mPoint[1]= a.get1();
-      mPoint[2]= a.get2();
-
-      for( int surface=0; surface<mNumAxis; surface++)
-        for(int lr=0; lr<mNumFacesPerAxis; lr++)
-          {
-          int index = surface*mNumFacesPerAxis + lr;
-
-          if( casted!=surface )
-            {
-            convertTo2Dcoords( mPoint, mAxis[surface], lr, mPoint2D);
-            mCastAxis[index][casted][0] = mPoint2D[0];
-            mCastAxis[index][casted][1] = mPoint2D[1];
-            normalize2D(mCastAxis[index][casted]);
-            }
-          else
-            {
-            mCastAxis[index][casted][0] = 0;
-            mCastAxis[index][casted][1] = 0;
-            }
-          }
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void normalize2D(float[] vect)
-    {
-    float len = (float)Math.sqrt(vect[0]*vect[0] + vect[1]*vect[1]);
-    vect[0] /= len;
-    vect[1] /= len;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// find the casted axis with which our move2D vector forms an angle closest to 90 deg.
-
-  private int computeRotationIndex(int axis, int lr, float[] move2D)
-    {
-    float cosAngle, minCosAngle = Float.MAX_VALUE;
-    int minIndex=-1;
-    int index = axis*mNumFacesPerAxis + lr;
-    float m0 = move2D[0];
-    float m1 = move2D[1];
-    float len = (float)Math.sqrt(m0*m0 + m1*m1);
-
-    if( len!=0.0f )
-      {
-      m0 /= len;
-      m1 /= len;
-      }
-    else
-      {
-      m0 = 1.0f;  // arbitrarily
-      m1 = 0.0f;  //
-      }
-
-    for(int i=0; i<mNumAxis; i++)
-      {
-      if( axis != i )
-        {
-        cosAngle = m0*mCastAxis[index][i][0] +  m1*mCastAxis[index][i][1];
-        if( cosAngle<0 ) cosAngle = -cosAngle;
-
-        if( cosAngle<minCosAngle )
-          {
-          minCosAngle=cosAngle;
-          minIndex = i;
-          }
-        }
-      }
-
-    return minIndex;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private float computeOffset(float[] point, float[] axis)
-    {
-    return point[0]*axis[0] + point[1]*axis[1] + mDistanceCenterFace2D;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private boolean faceIsVisible(Static3D axis, int lr)
-    {
-    float castCameraOnAxis = mCamera[0]*axis.get0() + mCamera[1]*axis.get1() + mCamera[2]*axis.get2();
-    return (2*lr-1)*castCameraOnAxis > mDistanceCenterFace3D;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// given precomputed mCamera and mPoint, respectively camera and touch point positions in ScreenSpace,
-// compute point 'output[]' which:
-// 1) lies on a face of the Object, i.e. surface defined by (axis, distance from (0,0,0)) [and this
-//    distance is +-mDistanceCenterFace, depending if it is the face on the left or the right end of
-//    the axis] (lr=0 or 1, so (2lr-1)*mDistanceCenterFace)
-// 2) is co-linear with mCamera and mPoint
-//
-// output = camera + alpha*(point-camera), where alpha = [dist-axis*camera] / [axis*(point-camera)]
-
-  private void castTouchPointOntoFace(Static3D axis, int lr, float[] output)
-    {
-    float d0 = mPoint[0]-mCamera[0];
-    float d1 = mPoint[1]-mCamera[1];
-    float d2 = mPoint[2]-mCamera[2];
-    float a0 = axis.get0();
-    float a1 = axis.get1();
-    float a2 = axis.get2();
-
-    float denom = a0*d0 + a1*d1 + a2*d2;
-
-    if( denom != 0.0f )
-      {
-      float axisCam = a0*mCamera[0] + a1*mCamera[1] + a2*mCamera[2];
-      float distance = (2*lr-1)*mDistanceCenterFace3D;
-      float alpha = (distance-axisCam)/denom;
-
-      output[0] = mCamera[0] + d0*alpha;
-      output[1] = mCamera[1] + d1*alpha;
-      output[2] = mCamera[2] + d2*alpha;
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Convert the 3D point3D into a 2D point on the same face surface, but in a different
-// coordinate system: a in-plane 2D coord where the origin is in the point where the axis intersects
-// the surface, and whose Y axis points 'north' i.e. is in the plane given by the 3D origin, the
-// original 3D Y axis and our 2D in-plane origin.
-// If those 3 points constitute a degenerate triangle which does not define a plane - which can only
-// happen if axis is vertical (or in theory when 2D origin and 3D origin meet, but that would have to
-// mean that the distance between the center of the Object and its faces is 0) - then we arbitrarily
-// decide that 2D Y = (0,0,-1) in the North Pole and (0,0,1) in the South Pole)
-
-  private void convertTo2Dcoords(float[] point3D, Static3D axis, int lr, float[] output)
-    {
-    float y0,y1,y2; // base Y vector of the 2D coord system
-    float a0 = axis.get0();
-    float a1 = axis.get1();
-    float a2 = axis.get2();
-
-    if( lr==0 )
-      {
-      a0=-a0; a1=-a1; a2=-a2;
-      }
-
-    if( a0==0.0f && a2==0.0f )
-      {
-      y0=0; y1=0; y2=-a1;
-      }
-    else if( a1==0.0f )
-      {
-      y0=0; y1=1; y2=0;
-      }
-    else
-      {
-      float norm = (float)(-a1/Math.sqrt(1-a1*a1));
-      y0 = norm*a0; y1= norm*(a1-1/a1); y2=norm*a2;
-      }
-
-    float x0 = y1*a2 - y2*a1;  //
-    float x1 = y2*a0 - y0*a2;  // (2D coord baseY) x (axis) = 2D coord baseX
-    float x2 = y0*a1 - y1*a0;  //
-
-    float originAlpha = point3D[0]*a0 + point3D[1]*a1 + point3D[2]*a2;
-
-    float origin0 = originAlpha*a0; // coords of the point where axis
-    float origin1 = originAlpha*a1; // intersects surface plane i.e.
-    float origin2 = originAlpha*a2; // the origin of our 2D coord system
-
-    float v0 = point3D[0] - origin0;
-    float v1 = point3D[1] - origin1;
-    float v2 = point3D[2] - origin2;
-
-    output[0] = v0*x0 + v1*x1 + v2*x2;
-    output[1] = v0*y0 + v1*y1 + v2*y2;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// PUBLIC API
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public boolean faceTouched(Static4D rotatedTouchPoint, Static4D rotatedCamera)
-    {
-    float objectRatio = RubikObject.getObjectRatio();
-
-    mPoint[0]  = rotatedTouchPoint.get0()/objectRatio;
-    mPoint[1]  = rotatedTouchPoint.get1()/objectRatio;
-    mPoint[2]  = rotatedTouchPoint.get2()/objectRatio;
-
-    mCamera[0] = rotatedCamera.get0()/objectRatio;
-    mCamera[1] = rotatedCamera.get1()/objectRatio;
-    mCamera[2] = rotatedCamera.get2()/objectRatio;
-
-    for( mLastTouchedAxis=0; mLastTouchedAxis<mNumAxis; mLastTouchedAxis++)
-      {
-      for( mLastTouchedLR=0; mLastTouchedLR<mNumFacesPerAxis; mLastTouchedLR++)
-        {
-        if( faceIsVisible(mAxis[mLastTouchedAxis], mLastTouchedLR) )
-          {
-          castTouchPointOntoFace(mAxis[mLastTouchedAxis], mLastTouchedLR, mTouch);
-          convertTo2Dcoords(mTouch, mAxis[mLastTouchedAxis], mLastTouchedLR, mPoint2D);
-
-          if( isInsideFace(mPoint2D) ) return true;
-          }
-        }
-      }
-
-    return false;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public Static2D newRotation(Static4D rotatedTouchPoint)
-    {
-    float objectRatio = RubikObject.getObjectRatio();
-
-    mPoint[0] = rotatedTouchPoint.get0()/objectRatio;
-    mPoint[1] = rotatedTouchPoint.get1()/objectRatio;
-    mPoint[2] = rotatedTouchPoint.get2()/objectRatio;
-
-    castTouchPointOntoFace(mAxis[mLastTouchedAxis], mLastTouchedLR, mTouch);
-    convertTo2Dcoords(mTouch, mAxis[mLastTouchedAxis], mLastTouchedLR, mMove2D);
-
-    mMove2D[0] -= mPoint2D[0];
-    mMove2D[1] -= mPoint2D[1];
-
-    int rotIndex = computeRotationIndex(mLastTouchedAxis, mLastTouchedLR, mMove2D);
-    int index    = mLastTouchedAxis*mNumFacesPerAxis+mLastTouchedLR;
-    float offset = computeOffset(mPoint2D, mCastAxis[index][rotIndex]);
-
-    return new Static2D(rotIndex,offset);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public int getTouchedFace()
-    {
-    return mNumFacesPerAxis==2 ? 2*mLastTouchedAxis + 1 - mLastTouchedLR : mLastTouchedAxis;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public float[] getTouchedPoint3D()
-    {
-    return mTouch;
-    }
-  }
diff --git a/src/main/java/org/distorted/objects/RubikPyraminx.java b/src/main/java/org/distorted/objects/RubikPyraminx.java
index 08e32a51..909a174c 100644
--- a/src/main/java/org/distorted/objects/RubikPyraminx.java
+++ b/src/main/java/org/distorted/objects/RubikPyraminx.java
@@ -46,7 +46,7 @@ public class RubikPyraminx extends RubikObject
   private static final float SQ3 = (float)Math.sqrt(3);
   private static final float SQ6 = (float)Math.sqrt(6);
 
-  static final Static3D[] AXIS = new Static3D[]
+  static final Static3D[] ROT_AXIS = new Static3D[]
          {
            new Static3D(         0,        1,       0 ),
            new Static3D(         0,  -1.0f/3, 2*SQ2/3 ),
@@ -54,10 +54,18 @@ public class RubikPyraminx extends RubikObject
            new Static3D( SQ2*SQ3/3,  -1.0f/3,  -SQ2/3 )
          };
 
+  static final Static3D[] FACE_AXIS = new Static3D[]
+         {
+           new Static3D(         0,      -1,       0 ),
+           new Static3D(         0,  1.0f/3,-2*SQ2/3 ),
+           new Static3D( SQ2*SQ3/3,  1.0f/3,   SQ2/3 ),
+           new Static3D(-SQ2*SQ3/3,  1.0f/3,   SQ2/3 )
+         };
+
   private static final int[] FACE_COLORS = new int[]
          {
-           0xff00ff00, 0xffffff00,  // AXIS[0]right (GREEN ) AXIS[1]right (YELLOW )
-           0xff0000ff, 0xffff0000   // AXIS[2]right (BLUE  ) AXIS[3]right (RED    )
+           0xff00ff00, 0xffffff00,  // FACE_AXIS[0] (GREEN ) FACE_AXIS[1] (YELLOW )
+           0xff0000ff, 0xffff0000   // FACE_AXIS[2] (BLUE  ) FACE_AXIS[3] (RED    )
          };
 
   // computed with res/raw/compute_quats.c
@@ -81,18 +89,18 @@ public class RubikPyraminx extends RubikObject
   private static VertexEffectRotate[] ROTATION;
 
   private static MeshBase mMesh =null;
-  private static MeshBase[] mMeshRotated = new MeshBase[AXIS.length];
+  private static MeshBase[] mMeshRotated = new MeshBase[ROT_AXIS.length];
 
   static
     {
     Static3D center = new Static3D(0,0,0);
     Static1D angle  = new Static1D(180.0f);
 
-    ROTATION = new VertexEffectRotate[AXIS.length];
+    ROTATION = new VertexEffectRotate[ROT_AXIS.length];
 
-    for(int i=0; i<AXIS.length; i++)
+    for(int i = 0; i< ROT_AXIS.length; i++)
       {
-      ROTATION[i] = new VertexEffectRotate( angle, AXIS[i], center);
+      ROTATION[i] = new VertexEffectRotate( angle, ROT_AXIS[i], center);
       mMeshRotated[i] = null;
       }
     }
@@ -388,7 +396,7 @@ public class RubikPyraminx extends RubikObject
 
   public Static3D[] getRotationAxis()
     {
-    return AXIS;
+    return ROT_AXIS;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objects/RubikPyraminxMovement.java b/src/main/java/org/distorted/objects/RubikPyraminxMovement.java
deleted file mode 100644
index b56343c3..00000000
--- a/src/main/java/org/distorted/objects/RubikPyraminxMovement.java
+++ /dev/null
@@ -1,46 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// 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 RubikPyraminxMovement extends RubikObjectMovement
-{
-  private static final float SQ6 = (float)Math.sqrt(6);
-  private static final float SQ3 = (float)Math.sqrt(3);
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  RubikPyraminxMovement()
-    {
-    super(RubikPyraminx.AXIS, 1, SQ6/12, SQ3/6);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  boolean isInsideFace(float[] p)
-    {
-    boolean a1 = p[1] >= -SQ3/6;
-    boolean a2 = p[1] <=  SQ3*(1.0f/3 + p[0]);
-    boolean a3 = p[1] <=  SQ3*(1.0f/3 - p[0]);
-
-    return a1 && a2 && a3;
-    }
-}
