Project

General

Profile

« Previous | Next » 

Revision 39e74052

Added by Leszek Koltunski about 4 years ago

Progress with object Movement.

View differences:

src/main/java/org/distorted/magic/RubikSurfaceView.java
267 267
                                           Static2D rot = mMovement.newRotation(rotatedTouchPoint2);
268 268
                                           RubikObject object = mRenderer.getObject();
269 269

  
270
                                           object.beginNewRotation( (int)rot.get0(), (int)(object.getSize()*rot.get1()) );
270
                                           object.beginNewRotation( (int)rot.get0(), object.returnRowFromOffset(rot.get1()) );
271 271

  
272 272
                                           if( RubikState.getCurrentState()==RubikState.SOLV )
273 273
                                             {
src/main/java/org/distorted/object/RubikCube.java
211 211
    {
212 212
    return 4;
213 213
    }
214

  
215
///////////////////////////////////////////////////////////////////////////////////////////////////
216

  
217
  public int returnRowFromOffset(float offset)
218
    {
219
    return (int)(getSize()*offset);
220
    }
214 221
}
src/main/java/org/distorted/object/RubikObject.java
405 405
      return;
406 406
      }
407 407

  
408
    //android.util.Log.e("object", "beginning new rotation: axis: "+axis+" row: "+row);
409

  
408 410
    mRotAxis = axis;
409 411
    mRotRow  = row;
410 412

  
......
484 486
  abstract MeshBase createCubitMesh(int cubit, int vertices);
485 487
  abstract Static3D[] getRotationAxis();
486 488
  public abstract int getBasicAngle();
489
  public abstract int returnRowFromOffset(float offset);
487 490
  }
src/main/java/org/distorted/object/RubikObjectMovement.java
278 278

  
279 279
          if( isInsideFace(mPoint2D) )
280 280
            {
281
            android.util.Log.e("move", "face "+getFaceColor(mLastTouchedAxis)+" ("+mPoint2D[0]+","+mPoint2D[1]+")");
282

  
283 281
            fillPossibleRotations(mLastTouchedAxis, mPossible);
284 282
            return true;
285 283
            }
......
308 306
    int index = mLastTouchedAxis*mNumFacesPerAxis+mLastTouchedLR;
309 307
    float offset = computeOffset(mPoint2D, mCastAxis[index][mRotationVect]);
310 308

  
311
android.util.Log.d("move", "new rot: face "+getFaceColor(mLastTouchedAxis)+" vect: "+mRotationVect+" offset: "+offset);
312

  
313 309
    return new Static2D(mRotationVect,offset);
314 310
    }
315 311

  
src/main/java/org/distorted/object/RubikPyraminx.java
303 303
    {
304 304
    return 3;
305 305
    }
306

  
307
///////////////////////////////////////////////////////////////////////////////////////////////////
308

  
309
  public int returnRowFromOffset(float offset)
310
    {
311
    return (int)(getSize()*offset/(SQ3/2));
312
    }
306 313
}

Also available in: Unified diff