Project

General

Profile

« Previous | Next » 

Revision f80b9473

Added by Leszek Koltunski 4 months ago

Beginnings of support for automatic solved state which supports faces of the same color.

View differences:

src/main/java/org/distorted/objectlib/helpers/ObjectShape.java
207 207
///////////////////////////////////////////////////////////////////////////////////////////////////
208 208
// return surface defined by the face, i.e. a 4-tuple [ (nx,ny,nz), d ]
209 209

  
210
  public void getFaceSurface(int face, float[] output)
210
  public void getFaceNormal(int face, float[] output)
211 211
    {
212 212
    int[] loopI = mFacesMultigon ? getMultigonIndices()[face][0] : getVertIndices()[face];
213 213

  
......
216 216
    float[] v2 = mVertices[loopI[2]];
217 217

  
218 218
    computeNormalVector(v0,v1,v2,output);
219
    }
220

  
221
///////////////////////////////////////////////////////////////////////////////////////////////////
222
// return any point laying inside the face
223

  
224
  public void getFacePoint(int face, float[] output)
225
    {
226
    int[] loopI = mFacesMultigon ? getMultigonIndices()[face][0] : getVertIndices()[face];
227

  
228
    float[] v0 = mVertices[loopI[0]];
229
    float[] v1 = mVertices[loopI[1]];
230
    float[] v2 = mVertices[loopI[2]];
219 231

  
220
    output[3] = output[0]*v0[0] + output[1]*v0[1] + output[2]*v0[2];
232
    output[0] = (v0[0] + v1[0] + v2[0]) / 3;
233
    output[1] = (v0[1] + v1[1] + v2[1]) / 3;
234
    output[2] = (v0[2] + v1[2] + v2[2]) / 3;
221 235
    }
222 236

  
223 237
///////////////////////////////////////////////////////////////////////////////////////////////////
......
349 363

  
350 364
        if( colorsBitmap[face]!=1 )
351 365
          {
352
          android.util.Log.e("D", "ERROR, cubit= "+cubit+" face "+face+" seems to belong to "+shift+" and still "+colorsBitmap[face]);
366
          android.util.Log.e("ObjectShape", "ERROR, cubit= "+cubit+" face "+face+" seems to belong to "+shift+" and still "+colorsBitmap[face]);
353 367
          }
354 368

  
355 369
        colorsBitmap[face] = shift;

Also available in: Unified diff