Project

General

Profile

« Previous | Next » 

Revision 6c295be1

Added by Leszek Koltunski 12 months ago

Progress with BandagedObjectPyraminx.

View differences:

src/main/java/org/distorted/bandaged/BandagedObject.java
51 51
   abstract float[] getDist3D();
52 52
   abstract int[] getColors();
53 53
   abstract Static3D[] getFaceAxis();
54
   abstract float[][] getPositions();
54
   abstract float[][][] getPositions();
55 55
   abstract boolean isAdjacent(float dx, float dy, float dz);
56 56
   abstract int computeProjectionAngle();
57 57
   abstract boolean tryChangeObject(int x, int y, int z);
58 58
   abstract void getTouchedPosition(float[] output, int face, float pointX, float pointY);
59 59
   abstract boolean isInsideFace(int face, float[] p);
60 60
   abstract TwistyObject createObject(int mode, float scale );
61
   abstract MeshBase createMesh(float[] pos, boolean round);
61
   abstract MeshBase createMesh(int variant, float[] pos, boolean round);
62 62

  
63 63
///////////////////////////////////////////////////////////////////////////////////////////////////
64 64

  
......
72 72
   void createCubits(Static4D quatT, Static4D quatA, Static3D scale)
73 73
     {
74 74
     mCubits = new BandagedCubit[mNumCubits];
75
     int c=0;
76
     for(float[] p : getPositions() ) mCubits[c++] = new BandagedCubit(this,p,quatT,quatA,scale,false);
75
     float[][][] pos = getPositions();
76
     int c=0,numVariants = pos.length;
77

  
78
     for(int v=0; v<numVariants; v++)
79
       {
80
       int numCubits = pos[v].length;
81

  
82
       for(int vi=0; vi<numCubits; vi++)
83
         mCubits[c++] = new BandagedCubit(this,pos[v][vi],v,quatT,quatA,scale,false);
84
       }
77 85
     }
78 86

  
79 87
///////////////////////////////////////////////////////////////////////////////////////////////////
......
247 255
        int len = pos.length/3;
248 256

  
249 257
        for(int p=0; p<len; p++)
250
          if( pos[3*p]==mTmp[0] && pos[3*p+1]==mTmp[1] && pos[3*p+2]==mTmp[2] ) return c;
258
          {
259
          float dx = pos[3*p  ]-mTmp[0];
260
          float dy = pos[3*p+1]-mTmp[1];
261
          float dz = pos[3*p+2]-mTmp[2];
262

  
263
          if( dx*dx + dy*dy + dz*dz < 0.01f ) return c;
264
          }
251 265
        }
252 266

  
253 267
    android.util.Log.e("D", "whichCubitTouched: IMPOSSIBLE!!");

Also available in: Unified diff