Project

General

Profile

« Previous | Next » 

Revision 338e42aa

Added by Leszek Koltunski about 2 years ago

Fixes for scrambling locally-produced bandaged cuboid.
Still does not work completely.

View differences:

src/main/java/org/distorted/objectlib/helpers/ObjectSignature.java
206 206
        if( getBit(index)!=0 )
207 207
          {
208 208
          float[] touch = getCubitTouchOfIndex(index);
209
          if( belongsToTheLeft(touch,axis,layer) ) return false;
209
          if( belongsLeft(touch,axis,layer) ) return false;
210 210
          }
211 211

  
212 212
    return true;
......
223 223
      float[][] cyc = mAllCycles[i];
224 224
      float[] p0 = cyc[0];
225 225
      float[] p1 = cyc[1];
226
      float[] p2 = cyc[2];
226 227

  
227
      if( (belongsToTheLeft(p0,axis,layer) && belongsToTheLeft(p1,axis,layer)) ||
228
          (belongsToTheCent(p0,axis,layer) && belongsToTheCent(p1,axis,layer))  )
228
      if( (belongsLeft(p0,axis,layer) && belongsLeft(p1,axis,layer) && belongsLeft(p2,axis,layer)) ||
229
          (belongsCent(p0,axis,layer) && belongsCent(p1,axis,layer) && belongsCent(p2,axis,layer))  )
229 230
        {
230 231
        ret.cycle(turn,cyc);
231 232
        }
......
234 235
    return ret;
235 236
    }
236 237

  
238
///////////////////////////////////////////////////////////////////////////////////////////////////
239

  
240
  private boolean belongsLeft(float[] point, int axis, int layer)
241
    {
242
    return 2*point[axis]+mLayer[axis] == 2*layer;
243
    }
244

  
245
///////////////////////////////////////////////////////////////////////////////////////////////////
246

  
247
  private boolean belongsCent(float[] point, int axis, int layer)
248
    {
249
    return 2*point[axis]+mLayer[axis] == 2*layer+1;
250
    }
251

  
237 252
///////////////////////////////////////////////////////////////////////////////////////////////////
238 253

  
239 254
  private void cycle(int turn, float[][] cyc)
......
456 471
    return -1;
457 472
    }
458 473

  
459
///////////////////////////////////////////////////////////////////////////////////////////////////
460

  
461
  private boolean belongsToTheLeft(float[] point, int axis, int layer)
462
    {
463
    return 2*point[axis]+mLayer[axis] == 2*layer;
464
    }
465

  
466
///////////////////////////////////////////////////////////////////////////////////////////////////
467

  
468
  private boolean belongsToTheCent(float[] point, int axis, int layer)
469
    {
470
    return 2*point[axis]+mLayer[axis] == 2*layer+1;
471
    }
472

  
473 474
///////////////////////////////////////////////////////////////////////////////////////////////////
474 475

  
475 476
  private int getIndexOfCubitTouch(float x, float y, float z)

Also available in: Unified diff