Project

General

Profile

« Previous | Next » 

Revision 12ad3fca

Added by Leszek Koltunski about 4 years ago

Progress with object Movement - almost finished.

View differences:

src/main/java/org/distorted/object/RubikCubeMovement.java
28 28
    super(RubikCube.AXIS, 2, 0.5f, 0.5f);
29 29
    }
30 30

  
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

  
33
  void fillPossibleRotations(int axis, int[] output)
34
    {
35
    switch(axis)
36
      {
37
      case 0: output[0]=2; output[1]=1; break; // (Z,Y) when looking at LEFT or RIGHT
38
      case 1: output[0]=0; output[1]=2; break; // (X,Z) when looking at BOTTOM or TOP
39
      case 2: output[0]=0; output[1]=1; break; // (X,Y) when looking at FRONT or BACK
40
      }
41
    }
42

  
43 31
///////////////////////////////////////////////////////////////////////////////////////////////////
44 32

  
45 33
  boolean isInsideFace(float[] p)
46 34
    {
47 35
    return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
48 36
    }
49

  
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

  
52
  float returnAngle(float[] v, int[] possible)
53
    {
54
    float angle= (mRotationVect==possible[0] ? v[possible[1]] : -v[possible[0]]);
55
    if( mLastTouchedAxis==2 ) angle = -angle;
56
    return angle;
57
    }
58 37
}

Also available in: Unified diff