Project

General

Profile

« Previous | Next » 

Revision ef018c1b

Added by Leszek Koltunski over 2 years ago

Abstract the next function, computeRowFromOffset(), out of the individual Movement classes.
Still two issues:

1) mysterious 1.5 multiplier in Movement12
2) in Movement8, moving the offset works only if the rotAxis are face-turning, i.e. they connect the centers of the opposing faces of the octahedron.

View differences:

src/main/java/org/distorted/objects/MovementMinx.java
23 23

  
24 24
class MovementMinx extends Movement12
25 25
{
26
  MovementMinx()
26
  MovementMinx(float[][] cuts, boolean[][] rotatable, int numLayers)
27 27
    {
28
    super(TwistyMinx.ROT_AXIS);
29
    }
30

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

  
33
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
34
    {
35
    if( numLayers==3 )
36
      {
37
      return offset<0 ? 0:2;
38
      }
39
    if( numLayers==5 )
40
      {
41
      float quot = offset / DIST2D;
42

  
43
      if( quot>-1.00f && quot<=-0.66f ) return 0;
44
      if( quot>-0.66f && quot<= 0.00f ) return 1;
45
      if( quot> 0.00f && quot<= 0.66f ) return 3;
46
      if( quot> 0.66f && quot<= 1.00f ) return 4;
47
      }
48

  
49
    return 0;
28
    super(TwistyMinx.ROT_AXIS,cuts,rotatable,numLayers);
50 29
    }
51 30

  
52 31
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff