Project

General

Profile

« Previous | Next » 

Revision 1ded8771

Added by Leszek Koltunski over 3 years ago

Square-1: progress with movement.

View differences:

src/main/java/org/distorted/objects/Movement.java
45 45

  
46 46
  abstract boolean isInsideFace(int face, float[] point);
47 47
  abstract void computeEnabledAxis(int face, float[] touchPoint, int[] enabledAxis);
48
  abstract int computeRowFromOffset(int face, int size, float offset);
49
  public abstract float returnRotationFactor(int size, int row);
48
  abstract int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset);
49
  public abstract float returnRotationFactor(int numLayers, int row);
50 50

  
51 51
///////////////////////////////////////////////////////////////////////////////////////////////////
52 52

  
......
277 277

  
278 278
///////////////////////////////////////////////////////////////////////////////////////////////////
279 279

  
280
  public Static2D newRotation(int size, Static4D rotatedTouchPoint)
280
  public Static2D newRotation(int numLayers, Static4D rotatedTouchPoint)
281 281
    {
282 282
    float objectRatio = TwistyObject.getObjectRatio();
283 283

  
......
294 294
    computeEnabledAxis(mLastTouchedFace, mPoint2D, mEnabledRotAxis);
295 295
    int rotIndex = computeRotationIndex(mLastTouchedFace, mMove2D, mEnabledRotAxis);
296 296
    float offset = computeOffset(mPoint2D, mCastedRotAxis[mLastTouchedFace][rotIndex]);
297
    int row      = computeRowFromOffset(mLastTouchedFace,size,offset);
297
    int row      = computeRowFromOffset(mLastTouchedFace,rotIndex,numLayers,offset);
298 298

  
299 299
    return new Static2D(rotIndex,row);
300 300
    }
src/main/java/org/distorted/objects/MovementCube.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49
    return (int)(size*offset);
49
    return (int)(numLayers*offset);
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementDiamond.java
49 49
// midpoint at SQ3/12) or one of the other face when the cast rotAxis are the wrong way round (and
50 50
// the triangle spans then from 0 to SQ3/2 with midpoint at SQ3/4).
51 51

  
52
  int computeRowFromOffset(int face, int size, float offset)
52
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
53 53
    {
54 54
    float off = ( face==1 || face==3 || face==4 || face==6 ) ? offset/SQ3 + 1.0f/6 : offset/SQ3;
55
    return (int)(2*size*off);
55
    return (int)(2*numLayers*off);
56 56
    }
57 57

  
58 58
///////////////////////////////////////////////////////////////////////////////////////////////////
59 59

  
60
  public float returnRotationFactor(int size, int row)
60
  public float returnRotationFactor(int numLayers, int row)
61 61
    {
62 62
    return 1.0f;
63 63
    }
src/main/java/org/distorted/objects/MovementDino.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49 49
    return offset<DIST2D ? 0:2;
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementHelicopter.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49 49
    return offset<DIST2D ? 0:2;
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementIvy.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49 49
    return offset<DIST2D ? 0:1;
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementMinx.java
58 58

  
59 59
///////////////////////////////////////////////////////////////////////////////////////////////////
60 60

  
61
  int computeRowFromOffset(int face, int size, float offset)
61
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
62 62
    {
63
    if( size==3 )
63
    if( numLayers==3 )
64 64
      {
65 65
      return offset<DIST2D ? 0:2;
66 66
      }
67
    if( size==5 )
67
    if( numLayers==5 )
68 68
      {
69 69
      float quot = offset / DIST2D;
70 70

  
......
79 79

  
80 80
///////////////////////////////////////////////////////////////////////////////////////////////////
81 81

  
82
  public float returnRotationFactor(int size, int row)
82
  public float returnRotationFactor(int numLayers, int row)
83 83
    {
84 84
    return 1.0f;
85 85
    }
src/main/java/org/distorted/objects/MovementPyraminx.java
45 45

  
46 46
///////////////////////////////////////////////////////////////////////////////////////////////////
47 47

  
48
  int computeRowFromOffset(int face, int size, float offset)
48
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
49 49
    {
50
    return (int)(size*offset/(SQ6/3));
50
    return (int)(numLayers*offset/(SQ6/3));
51 51
    }
52 52

  
53 53
///////////////////////////////////////////////////////////////////////////////////////////////////
54 54

  
55
  public float returnRotationFactor(int size, int row)
55
  public float returnRotationFactor(int numLayers, int row)
56 56
    {
57
    return ((float)size)/(size-row);
57
    return ((float)numLayers)/(numLayers-row);
58 58
    }
59 59

  
60 60
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/MovementRedi.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49 49
    return offset<DIST2D ? 0:2;
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementRex.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49 49
    return offset<DIST2D ? 0:2;
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementSkewb.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49
    return offset<DIST2D ? 0:size-1;
49
    return offset<DIST2D ? 0:numLayers-1;
50 50
    }
51 51

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

  
54
  public float returnRotationFactor(int size, int row)
54
  public float returnRotationFactor(int numLayers, int row)
55 55
    {
56 56
    return 1.0f;
57 57
    }
src/main/java/org/distorted/objects/MovementSquare.java
44 44

  
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47
  int computeRowFromOffset(int face, int size, float offset)
47
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
48 48
    {
49
    return (int)(size*offset);
49
    //android.util.Log.e("D", "face="+face+" size="+numLayers+" offset="+offset);
50

  
51
    return offset>DIST2D? 2-axisIndex : 0;
50 52
    }
51 53

  
52 54
///////////////////////////////////////////////////////////////////////////////////////////////////
53 55

  
54
  public float returnRotationFactor(int size, int row)
56
  public float returnRotationFactor(int numLayers, int row)
55 57
    {
56 58
    return 1.0f;
57 59
    }
src/main/java/org/distorted/objects/MovementUltimate.java
59 59

  
60 60
///////////////////////////////////////////////////////////////////////////////////////////////////
61 61

  
62
  int computeRowFromOffset(int face, int size, float offset)
62
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
63 63
    {
64 64
    return offset<DIST2D ? 0:1;
65 65
    }
66 66

  
67 67
///////////////////////////////////////////////////////////////////////////////////////////////////
68 68

  
69
  public float returnRotationFactor(int size, int row)
69
  public float returnRotationFactor(int numLayers, int row)
70 70
    {
71 71
    return 1.0f;
72 72
    }
src/main/java/org/distorted/objects/ObjectList.java
215 215

  
216 216
  SQU1 (
217 217
         new int[][] {
218
                       {2 , 18, 0, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
218
                       {3 , 18, 0, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
219 219
                     },
220 220
         TwistySquare1.class,
221 221
         new MovementSquare(),
src/main/java/org/distorted/objects/TwistySquare1.java
365 365

  
366 366
///////////////////////////////////////////////////////////////////////////////////////////////////
367 367

  
368
  float[][] getCubitPositions(int size)
368
  float[][] getCubitPositions(int numLayers)
369 369
    {
370 370
    return CENTERS;
371 371
    }
......
409 409

  
410 410
  float getScreenRatio()
411 411
    {
412
    return 0.36f;
412
    return 0.5f;
413 413
    }
414 414

  
415 415
///////////////////////////////////////////////////////////////////////////////////////////////////
416 416

  
417
  int getFaceColor(int cubit, int cubitface, int size)
417
  int getFaceColor(int cubit, int cubitface, int numLayers)
418 418
    {
419 419
    int type;
420 420

  

Also available in: Unified diff