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/MovementIvy.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 MovementIvy extends Movement
24
class MovementIvy 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
  MovementIvy()
41 27
    {
42
    super(TwistyIvy.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
28
    super(TwistyIvy.ROT_AXIS);
43 29
    }
44 30

  
45 31
///////////////////////////////////////////////////////////////////////////////////////////////////
......
49 35
    return offset<DIST2D ? 0: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
// faces 0,1,2,3  --> /
61 40
// faces 4,5      --> \
......
66 45
    else                     return touchPoint[1] >= touchPoint[0];
67 46
    }
68 47

  
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

  
71
  boolean isInsideFace(int face, float[] p)
72
    {
73
    return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
74
    }
75

  
76 48
///////////////////////////////////////////////////////////////////////////////////////////////////
77 49
// 0 +++
78 50
// 1 ++-

Also available in: Unified diff