Project

General

Profile

« Previous | Next » 

Revision 967c1d17

Added by Leszek Koltunski over 2 years ago

Do away with the last method in the object Movement classes. Remove the object Movement classes altogether.
From now on the implementation of a TwistyPuzzle is 100% data, no code at all.
Next step: make the implementation a (generated?) (XML?) file.

View differences:

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

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.TwistyObject.SQ2;
23

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

  
26 24
///////////////////////////////////////////////////////////////////////////////////////////////////
27 25
// Hexahedral objects: map the 2D swipes of user's fingers to 3D rotations
28 26

  
29
abstract class Movement6 extends Movement
27
class Movement6 extends Movement
30 28
{
31 29
  static final float DIST3D = 0.5f;
32 30
  static final float DIST2D = 0.5f;
......
40 38

  
41 39
///////////////////////////////////////////////////////////////////////////////////////////////////
42 40

  
43
  Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
41
  Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[] numEnabled, int[][][] enabled)
44 42
    {
45
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size);
43
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, numEnabled, enabled);
44
    }
45

  
46
///////////////////////////////////////////////////////////////////////////////////////////////////
47
//  corner    edge
48
//  \ 0 /     3 | 0
49
// 3 \ / 1  ___ | ___
50
//   / \        |
51
//  / 2 \     2 | 1
52

  
53
  int returnPart(int type, int face, float[] touchPoint)
54
    {
55
    switch(type)
56
      {
57
      case TYPE_NOT_SPLIT   : return 0;
58
      case TYPE_SPLIT_EDGE  : boolean e0 = touchPoint[0] > 0;
59
                              boolean e1 = touchPoint[1] > 0;
60
                              return e0 ? (e1 ? 0:1) : (e1 ? 3:2);
61
      case TYPE_SPLIT_CORNER: boolean c0 = touchPoint[1] >= touchPoint[0];
62
                              boolean c1 = touchPoint[1] >=-touchPoint[0];
63
                              return c0 ? (c1 ? 0:3) : (c1 ? 1:2);
64
      }
65

  
66
    return 0;
46 67
    }
47 68

  
48 69
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff