Project

General

Profile

« Previous | Next » 

Revision 5b985091

Added by Leszek Koltunski about 2 years ago

fix for BandagedObject's faceAxis.

View differences:

src/main/java/org/distorted/objectlib/bandaged/BandagedCubit.java
43 43
    private final DistortedEffects mEffects;
44 44
    private final DistortedTexture mTexture;
45 45
    private final Static3D mMove;
46
    private final int mVariant;
47 46
    private final boolean mRoundCorners;
48 47

  
49 48
    private float mUnscaledX, mUnscaledY, mUnscaledZ;
......
117 116
// PUBLIC API
118 117
///////////////////////////////////////////////////////////////////////////////////////////////////
119 118

  
120
    public BandagedCubit(BandagedObject object, float[] position, int variant, Static4D quat1,
119
    public BandagedCubit(BandagedObject object, float[] position, Static4D quat1,
121 120
                         Static4D quat2, Static3D scale, boolean roundCorners)
122 121
      {
123 122
      mObject = object;
......
125 124
      mPosition = position;
126 125
      mIsAttached = true;
127 126
      mMarkedEffectID = -1;
128
      mVariant = variant;
129 127

  
130 128
      computeMove(mPosition);
131 129
      mMove = new Static3D(0,0,0);
src/main/java/org/distorted/objectlib/bandaged/BandagedObject.java
40 40
     Static3D[] axis = getFaceAxis();
41 41
     int numAxis = axis.length;
42 42
     mFaceAxis = new float[numAxis][];
43
     for(int i=0; i<numAxis; i++) mFaceAxis[i] = new float[] { axis[i].get0(), axis[i].get1(), axis[1].get2() };
43
     for(int i=0; i<numAxis; i++) mFaceAxis[i] = new float[] { axis[i].get0(), axis[i].get1(), axis[i].get2() };
44 44
     }
45 45

  
46 46
///////////////////////////////////////////////////////////////////////////////////////////////////
......
64 64
     {
65 65
     mCubits = new BandagedCubit[mNumCubits];
66 66
     float[][][] pos = getPositions();
67
     int c=0,numVariants = pos.length;
67
     int c=0;
68 68

  
69
     for(int v=0; v<numVariants; v++)
70
       {
71
       int numCubits = pos[v].length;
72

  
73
       for(int vi=0; vi<numCubits; vi++)
74
         mCubits[c++] = new BandagedCubit(this,pos[v][vi],v,quatT,quatA,scale,false);
75
       }
69
     for(float[][] po : pos)
70
        for(float[] p : po)
71
           mCubits[c++]=new BandagedCubit(this, p, quatT, quatA, scale, false);
76 72
     }
77 73

  
78 74
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/bandaged/FactoryBandagedPyraminx.java
140 140
// see BandagedObjectPyraminx.addTetrahedralLattice()
141 141
// from there, 'y' is always of the form -DY*(size-1)/2 + K*DY, where DY = SQ2/2, K integer
142 142
// and 'size' is mNumLayers[0]-1 in case of Octahedrons and mNumLayers[0] in case of Tetrahedrons.
143
// From the above, the below quickly follows:
144
// + 2*num1 to avoid negative values.
143
// From the above, the below quickly follows. +2*num1 to avoid negative values.
145 144

  
146 145
  public int getElementVariant(float x, float y, float z)
147 146
    {
......
155 154

  
156 155
  float faceDiameter(float[][] vertices, int[][] indices)
157 156
    {
158
    return 0;
157
    return 1;
159 158
    }
160 159

  
161 160
///////////////////////////////////////////////////////////////////////////////////////////////////
......
226 225
    int numVertI= mNumLayers[0]>=5 ? 2 : 3;
227 226

  
228 227
    return new float[][] { {  0.001f,angle[0],R,S,numVertI,extraV,extraI},
229
            {height  ,angle[1],R,S,numVertA,extraV,extraI},
230
            {height/2,angle[2],R,S,numVertA,extraV,extraI},
231
            {height/3,angle[3],R,S,numVertA,extraV,extraI},
232
            {height/4,angle[4],R,S,numVertA,extraV,extraI},
233
            {height/5,angle[5],R,S,numVertA,extraV,extraI} };
228
                           {height  ,angle[1],R,S,numVertA,extraV,extraI},
229
                           {height/2,angle[2],R,S,numVertA,extraV,extraI},
230
                           {height/3,angle[3],R,S,numVertA,extraV,extraI},
231
                           {height/4,angle[4],R,S,numVertA,extraV,extraI},
232
                           {height/5,angle[5],R,S,numVertA,extraV,extraI} };
234 233
    }
235 234
  }

Also available in: Unified diff