Project

General

Profile

« Previous | Next » 

Revision be7c9190

Added by Leszek Koltunski over 2 years ago

Abstract out some methods from the Movement classes. only two remain now: rowFromOffset and enabledAxis.

View differences:

src/main/java/org/distorted/objects/MovementSkewb.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import org.distorted.library.type.Static3D;
23

  
24 22
///////////////////////////////////////////////////////////////////////////////////////////////////
25 23

  
26
class MovementSkewb extends Movement
24
class MovementSkewb extends Movement6
27 25
{
28
  static final float DIST3D = 0.5f;
29
  static final float DIST2D = 0.5f;
30

  
31
  static final Static3D[] FACE_AXIS = new Static3D[]
32
         {
33
           new Static3D(1,0,0), new Static3D(-1,0,0),
34
           new Static3D(0,1,0), new Static3D(0,-1,0),
35
           new Static3D(0,0,1), new Static3D(0,0,-1)
36
         };
37

  
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

  
40 26
  MovementSkewb()
41 27
    {
42
    super(TwistySkewb.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
28
    super(TwistySkewb.ROT_AXIS);
43 29
    }
44 30

  
45 31
///////////////////////////////////////////////////////////////////////////////////////////////////
......
49 35
    return offset<DIST2D ? 0:numLayers-1;
50 36
    }
51 37

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53

  
54
  public float returnRotationFactor(int numLayers, int row)
55
    {
56
    return 1.0f;
57
    }
58

  
59 38
///////////////////////////////////////////////////////////////////////////////////////////////////
60 39
// _____________
61 40
// |  \  0  /  |
......
74 53
    else      return p1 ? 1:2;
75 54
    }
76 55

  
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
79
  boolean isInsideFace(int face, float[] p)
80
    {
81
    return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
82
    }
83

  
84 56
///////////////////////////////////////////////////////////////////////////////////////////////////
85 57

  
86 58
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)

Also available in: Unified diff