Project

General

Profile

Download (15.9 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / tablebases / TablebasesAbstract.java @ 15d1f6ad

1 a110ebe1 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2023 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10
package org.distorted.objectlib.tablebases;
11
12 352b3356 Leszek Koltunski
import android.content.res.Resources;
13
14 a110ebe1 Leszek Koltunski
import org.distorted.library.main.QuatHelper;
15
import org.distorted.library.type.Static3D;
16
import org.distorted.library.type.Static4D;
17
import org.distorted.objectlib.helpers.QuatGroupGenerator;
18
19 352b3356 Leszek Koltunski
import java.io.ByteArrayOutputStream;
20
import java.io.IOException;
21
import java.io.InputStream;
22 bf5c802b Leszek Koltunski
import java.util.ArrayList;
23 3addecce Leszek Koltunski
import java.util.Random;
24 bf5c802b Leszek Koltunski
25 a110ebe1 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
26
27 1725b607 Leszek Koltunski
public abstract class TablebasesAbstract
28 a110ebe1 Leszek Koltunski
{
29
  private final Static3D[] mAxis;
30 c0266cb1 Leszek Koltunski
  private final int mSize, mMinScramble;
31 a110ebe1 Leszek Koltunski
  private final int[][] mAngles;
32
  private final int mNumAxis;
33
  private final int[] mNumLayers;
34
  private final int mNumQuats;
35
  private final Static4D[] mQuats;
36
  private final int[][] mRotRow;
37
  private final int mNumCubits;
38
  private final float[][] mPosition;
39
  private final float[][] mCuts;
40
  private final int[] mNumCuts;
41 b4111717 Leszek Koltunski
  private final boolean[][] mRotatable;
42 3addecce Leszek Koltunski
  private final int mScalingFactor;
43 b4111717 Leszek Koltunski
44 a110ebe1 Leszek Koltunski
  private int[][] mQuatMult;
45 352b3356 Leszek Koltunski
  private boolean mInitialized;
46 a110ebe1 Leszek Koltunski
47 15d1f6ad Leszek Koltunski
  Tablebase mTablebase;
48
49 b4111717 Leszek Koltunski
  private static final float[] mTmp = new float[4];
50
51 a110ebe1 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
52
53
  abstract int[][] getBasicAngles();
54
  abstract Static3D[] getRotationAxis();
55
  abstract float[][] getPosition();
56
  abstract float[][] getCuts();
57
58 b4111717 Leszek Koltunski
  abstract boolean[][] getRotatable();
59
60 c0266cb1 Leszek Koltunski
  abstract int getMinScramble();
61 b4111717 Leszek Koltunski
  abstract int getSize();
62
  abstract int[] getQuats(int index);
63
  abstract int getIndex(int[] quats);
64
65 a110ebe1 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
66
67 1725b607 Leszek Koltunski
  public TablebasesAbstract()
68 a110ebe1 Leszek Koltunski
    {
69
    mSize = getSize();
70 c0266cb1 Leszek Koltunski
    mMinScramble = getMinScramble();
71 a110ebe1 Leszek Koltunski
    mAngles = getBasicAngles();
72
    mAxis = getRotationAxis();
73
    mNumAxis = mAxis.length;
74
    mNumLayers = new int[mNumAxis];
75
    for(int i=0; i<mNumAxis; i++) mNumLayers[i] = mAngles[i].length;
76
    mQuats = QuatGroupGenerator.computeGroup(mAxis,mAngles);
77
    mNumQuats = mQuats.length;
78
    mPosition = getPosition();
79
    mNumCubits = mPosition.length;
80 b4111717 Leszek Koltunski
    mRotatable = getRotatable();
81 a110ebe1 Leszek Koltunski
    mCuts = getCuts();
82
    mNumCuts = new int[mNumAxis];
83
84 3addecce Leszek Koltunski
    int scaling = 0;
85
86 a110ebe1 Leszek Koltunski
    for(int i=0; i<mNumAxis; i++)
87
      {
88
      mNumCuts[i] = (mCuts==null || mCuts[i]==null ? 0 : mCuts[i].length);
89 3addecce Leszek Koltunski
      int numLayers = mNumLayers[i];
90
      for(int j=0; j<numLayers; j++) scaling+=(mAngles[i][j]-1);
91 a110ebe1 Leszek Koltunski
      }
92
93 3addecce Leszek Koltunski
    mScalingFactor = scaling;
94 a110ebe1 Leszek Koltunski
    mRotRow = new int[mNumCubits][mNumAxis];
95 5e501d98 Leszek Koltunski
    mInitialized = false;
96 352b3356 Leszek Koltunski
    }
97
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99
100 1725b607 Leszek Koltunski
  public TablebasesAbstract(Resources res, int resource)
101 352b3356 Leszek Koltunski
    {
102
    this();
103
104 f9980f6a Leszek Koltunski
    mInitialized = true;
105 352b3356 Leszek Koltunski
    InputStream stream = res.openRawResource(resource);
106
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
107
108
    int nRead;
109
    byte[] tmp = new byte[16384];
110
111
    try
112
      {
113
      while ((nRead = stream.read(tmp, 0, tmp.length)) != -1)
114
        {
115
        buffer.write(tmp, 0, nRead);
116
        }
117 1725b607 Leszek Koltunski
      stream.close();
118 352b3356 Leszek Koltunski
      byte[] data = buffer.toByteArray();
119 1725b607 Leszek Koltunski
      buffer.close();
120 352b3356 Leszek Koltunski
      mTablebase = new Tablebase(data);
121
      }
122
    catch(IOException ex)
123
      {
124
      mInitialized = false;
125
      }
126 a110ebe1 Leszek Koltunski
    }
127
128
///////////////////////////////////////////////////////////////////////////////////////////////////
129
130 b4111717 Leszek Koltunski
  private int computeRow(float[] pos, int quat, int axisIndex)
131 a110ebe1 Leszek Koltunski
    {
132
    int ret=0;
133
    int len = pos.length/3;
134
    Static3D axis = mAxis[axisIndex];
135
    float axisX = axis.get0();
136
    float axisY = axis.get1();
137
    float axisZ = axis.get2();
138
    float casted, xoff=0, yoff=0, zoff=0;
139 b4111717 Leszek Koltunski
    Static4D q = mQuats[quat];
140 a110ebe1 Leszek Koltunski
141
    for(int i=0; i<len; i++)
142
      {
143 b4111717 Leszek Koltunski
      QuatHelper.rotateVectorByQuat(mTmp,pos[3*i],pos[3*i+1],pos[3*i+2],1.0f,q);
144
      casted = (mTmp[0]+xoff)*axisX + (mTmp[1]+yoff)*axisY + (mTmp[2]+zoff)*axisZ;
145 a110ebe1 Leszek Koltunski
      ret |= computeSingleRow(axisIndex,casted);
146
      }
147
148
    return ret;
149
    }
150
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152
153
  private int computeSingleRow(int axisIndex,float casted)
154
    {
155
    int num = mNumCuts[axisIndex];
156
157
    for(int i=0; i<num; i++)
158
      {
159
      if( casted<mCuts[axisIndex][i] ) return (1<<i);
160
      }
161
162
    return (1<<num);
163
    }
164
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166
// remember about the double cover or unit quaternions!
167
168
  private int mulQuat(int q1, int q2)
169
    {
170
    Static4D result = QuatHelper.quatMultiply(mQuats[q1],mQuats[q2]);
171
172
    float rX = result.get0();
173
    float rY = result.get1();
174
    float rZ = result.get2();
175
    float rW = result.get3();
176
177
    final float MAX_ERROR = 0.1f;
178
    float dX,dY,dZ,dW;
179
180
    for(int i=0; i<mNumQuats; i++)
181
      {
182
      dX = mQuats[i].get0() - rX;
183
      dY = mQuats[i].get1() - rY;
184
      dZ = mQuats[i].get2() - rZ;
185
      dW = mQuats[i].get3() - rW;
186
187
      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
188
          dY<MAX_ERROR && dY>-MAX_ERROR &&
189
          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
190
          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
191
192
      dX = mQuats[i].get0() + rX;
193
      dY = mQuats[i].get1() + rY;
194
      dZ = mQuats[i].get2() + rZ;
195
      dW = mQuats[i].get3() + rW;
196
197
      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
198
          dY<MAX_ERROR && dY>-MAX_ERROR &&
199
          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
200
          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
201
      }
202
203
    return -1;
204
    }
205
206
///////////////////////////////////////////////////////////////////////////////////////////////////
207
208
  private int getMultQuat(int index1, int index2)
209
    {
210
    if( mQuatMult==null )
211
      {
212
      mQuatMult = new int[mNumQuats][mNumQuats];
213
214
      for(int i=0; i<mNumQuats; i++)
215
        for(int j=0; j<mNumQuats; j++) mQuatMult[i][j] = -1;
216
      }
217
218
    if( index1<mNumQuats && index2<mNumQuats )
219
      {
220
      if( mQuatMult[index1][index2]==-1 ) mQuatMult[index1][index2] = mulQuat(index1,index2);
221
      return mQuatMult[index1][index2];
222
      }
223
224
    return -2;
225
    }
226
227
///////////////////////////////////////////////////////////////////////////////////////////////////
228
// assumption: all layers have the same basicAngles!
229
230
  private int insertAllChildren(int index, byte level)
231
    {
232
    int ret = 0;
233
    int[] quats = getQuats(index);
234
    int numQuats = quats.length;
235
    int[] tmpQuats = new int[numQuats];
236
    byte newLevel = (byte)(level+1);
237
    int quatBasis = 0;
238
239 ce7202ef Leszek Koltunski
    for(int ax=0; ax<mNumAxis; ax++)
240
      for(int cubit=0; cubit<mNumCubits; cubit++)
241
        mRotRow[cubit][ax] = computeRow(mPosition[cubit],quats[cubit],ax);
242
243 a110ebe1 Leszek Koltunski
    for(int ax=0; ax<mNumAxis; ax++)
244
      {
245
      for(int layer=0; layer<mNumLayers[ax]; layer++)
246
        {
247 b4111717 Leszek Koltunski
        if( !mRotatable[ax][layer] ) continue;
248
        int bitLayer = (1<<layer);
249 a110ebe1 Leszek Koltunski
        int maxAngle = mAngles[ax][layer];
250
251
        for(int angle=1; angle<maxAngle; angle++ )
252
          {
253
          System.arraycopy(quats, 0, tmpQuats, 0, numQuats);
254
          int quat = quatBasis + angle;
255
256
          for(int cubit=0; cubit<mNumCubits; cubit++)
257 ce7202ef Leszek Koltunski
            if( mRotRow[cubit][ax]==bitLayer )
258 a110ebe1 Leszek Koltunski
              {
259
              int currQuat = tmpQuats[cubit];
260 b4111717 Leszek Koltunski
              int newQuat = getMultQuat(quat,currQuat);
261 a110ebe1 Leszek Koltunski
              tmpQuats[cubit] = newQuat;
262
              }
263
264
          int childIndex = getIndex(tmpQuats);
265
          if( mTablebase.insertUnpacked(childIndex,newLevel) ) ret++;
266
          }
267
        }
268
269
      quatBasis += (mAngles[ax][0]-1);
270
      }
271
272
    return ret;
273
    }
274
275
///////////////////////////////////////////////////////////////////////////////////////////////////
276
277 5e30b196 Leszek Koltunski
  public void createTablebase(int maxLevel)
278 a110ebe1 Leszek Koltunski
    {
279
    mTablebase = new Tablebase(mSize);
280
    mTablebase.insertUnpacked(0,(byte)0);
281
282 f9980f6a Leszek Koltunski
    int numInserted, totalInserted=1;
283 a110ebe1 Leszek Koltunski
    byte insertingLevel = 0;
284
285 462911fd Leszek Koltunski
    android.util.Log.e("D", "creating tablebase of size "+mSize);
286
287 a110ebe1 Leszek Koltunski
    do
288
      {
289
      numInserted = 0;
290
291
      for(int i=0; i<mSize; i++)
292
        {
293
        byte level = mTablebase.retrieveUnpacked(i);
294
        if( level==insertingLevel ) numInserted += insertAllChildren(i,level);
295
        }
296
297
      insertingLevel++;
298 f9980f6a Leszek Koltunski
      totalInserted += numInserted;
299 bf5c802b Leszek Koltunski
      android.util.Log.e("D", "inserted "+numInserted+" positions at level "+insertingLevel);
300 a110ebe1 Leszek Koltunski
      }
301 5e30b196 Leszek Koltunski
    while( numInserted>0 && insertingLevel!=maxLevel );
302 bf5c802b Leszek Koltunski
303 f9980f6a Leszek Koltunski
    android.util.Log.e("D", "total Inserted: "+totalInserted);
304 5e30b196 Leszek Koltunski
    }
305
306
///////////////////////////////////////////////////////////////////////////////////////////////////
307
308
  public void pack()
309
    {
310 462911fd Leszek Koltunski
    android.util.Log.e("D", "packing...");
311 bf5c802b Leszek Koltunski
    mTablebase.pack();
312 462911fd Leszek Koltunski
    android.util.Log.e("D", "all done");
313 5e501d98 Leszek Koltunski
    mInitialized = true;
314 462911fd Leszek Koltunski
    }
315
316
///////////////////////////////////////////////////////////////////////////////////////////////////
317
318 15d1f6ad Leszek Koltunski
  public byte[][] getPacked()
319 462911fd Leszek Koltunski
    {
320 15d1f6ad Leszek Koltunski
    if( !mInitialized ) createTablebase(-1);
321
    byte[] data = mTablebase.getPacked();
322
323
    return new byte[][] { data };
324 a110ebe1 Leszek Koltunski
    }
325 3ee79c9c Leszek Koltunski
326
///////////////////////////////////////////////////////////////////////////////////////////////////
327
328 bf5c802b Leszek Koltunski
  private void addMove(ArrayList<int[]> moves, int axis, int layer, int angle)
329 3ee79c9c Leszek Koltunski
    {
330
    int maxAngle = mAngles[axis][layer];
331
    angle = maxAngle-angle;
332
    if( angle> 0.5f*maxAngle ) angle -= maxAngle;
333
334 bf5c802b Leszek Koltunski
    int[] move = new int[] { axis, (1<<layer), angle };
335
    moves.add(move);
336
    }
337
338
///////////////////////////////////////////////////////////////////////////////////////////////////
339
340
  private int[][] convertMoves(ArrayList<int[]> moves)
341
    {
342
    int len = moves.size();
343
    int[][] ret = new int[len][];
344
    for(int i=0; i<len; i++) ret[i] = moves.get(i);
345
    return ret;
346 3ee79c9c Leszek Koltunski
    }
347
348 3addecce Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
349
350 971a184e Leszek Koltunski
  private void getNextAxisLayerAngleQuat(int[] data)
351 3addecce Leszek Koltunski
    {
352
    int axis = data[0];
353
    int layer= data[1];
354
    int angle= data[2];
355
356
    if( angle< mAngles[axis][layer]-1 ) data[2]++;
357
    else
358
      {
359
      data[2] = 1;
360
361
      if( layer< mNumLayers[axis]-1 ) data[1]++;
362
      else
363
        {
364
        data[1] = 0;
365
        data[0] = (axis<mNumAxis-1) ? axis+1 : 0;
366
        }
367
      }
368 971a184e Leszek Koltunski
369
    data[3] = data[2];
370
    for(int i=0; i<data[0]; i++) data[3] += (mAngles[i][0]-1);
371 3addecce Leszek Koltunski
    }
372
373 3ee79c9c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
374
375 6d637f71 Leszek Koltunski
  int[][] extraInfo(int[][] moves, int[] extra)
376
    {
377
    return moves;
378
    }
379
380 618f3d75 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
381
382
  Static4D[] getQuats()
383
    {
384
    return mQuats;
385
    }
386
387 6d637f71 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
388
389
  public int[][] solution(int index, int[] extra)
390 3ee79c9c Leszek Koltunski
    {
391 352b3356 Leszek Koltunski
    if( !mInitialized ) return null;
392
393 971a184e Leszek Koltunski
    int[] data = new int[4];
394 431ee33b Leszek Koltunski
    byte level = mTablebase.retrievePacked(index);
395 bf5c802b Leszek Koltunski
    ArrayList<int[]> moves = new ArrayList<>();
396 3ee79c9c Leszek Koltunski
    int[] quats = getQuats(index);
397
    int numQuats = quats.length;
398
    int[] tmpQuats = new int[numQuats];
399
400 bf5c802b Leszek Koltunski
    while(index!=0)
401 3ee79c9c Leszek Koltunski
      {
402 7c1a110c Leszek Koltunski
      boolean found = false;
403
404 3addecce Leszek Koltunski
      data[0]=0;
405
      data[1]=0;
406
      data[2]=1;
407 971a184e Leszek Koltunski
      data[3]=1;
408 3addecce Leszek Koltunski
409 ce7202ef Leszek Koltunski
      for(int ax=0; ax<mNumAxis; ax++)
410
        for(int cubit=0; cubit<mNumCubits; cubit++)
411
          mRotRow[cubit][ax] = computeRow(mPosition[cubit],quats[cubit],ax);
412
413 3addecce Leszek Koltunski
      for(int s=0; s<mScalingFactor && !found; s++)
414 3ee79c9c Leszek Koltunski
        {
415 3addecce Leszek Koltunski
        int ax    = data[0];
416
        int layer = data[1];
417
        int angle = data[2];
418 971a184e Leszek Koltunski
        int quat  = data[3];
419 3ee79c9c Leszek Koltunski
420 3addecce Leszek Koltunski
        if( mRotatable[ax][layer] )
421 3ee79c9c Leszek Koltunski
          {
422
          int bitLayer = (1<<layer);
423 3addecce Leszek Koltunski
          System.arraycopy(quats, 0, tmpQuats, 0, numQuats);
424 3ee79c9c Leszek Koltunski
425 3addecce Leszek Koltunski
          for(int cubit=0; cubit<mNumCubits; cubit++)
426
            if( mRotRow[cubit][ax]==bitLayer )
427 3ee79c9c Leszek Koltunski
              {
428 3addecce Leszek Koltunski
              int currQuat = tmpQuats[cubit];
429
              int newQuat = getMultQuat(quat,currQuat);
430
              tmpQuats[cubit] = newQuat;
431 3ee79c9c Leszek Koltunski
              }
432 3addecce Leszek Koltunski
433
          int childIndex = getIndex(tmpQuats);
434
          byte newLevel = mTablebase.retrievePacked(childIndex);
435
436
          if( ((newLevel-level+1)%3) == 0 )
437
            {
438
            addMove(moves,ax,layer,angle);
439
            index = childIndex;
440
            level = (level==0 ? 2 : (byte)(level-1));
441
            found = true;
442 3ee79c9c Leszek Koltunski
            }
443
          }
444
445 971a184e Leszek Koltunski
        getNextAxisLayerAngleQuat(data);
446 3ee79c9c Leszek Koltunski
        }
447
448
      quats = getQuats(index);
449 7c1a110c Leszek Koltunski
450
      if( !found )
451
        {
452 74cc695a Leszek Koltunski
        android.util.Log.e("D", "----> solution error: no move found!");
453 7c1a110c Leszek Koltunski
        return null;
454
        }
455 3ee79c9c Leszek Koltunski
      }
456
457 6d637f71 Leszek Koltunski
    int[][] ret = convertMoves(moves);
458
    return extraInfo(ret,extra);
459 3ee79c9c Leszek Koltunski
    }
460 462911fd Leszek Koltunski
461
///////////////////////////////////////////////////////////////////////////////////////////////////
462
463 c0266cb1 Leszek Koltunski
  public void scramble(Random rnd, int depth, int[][] scramble)
464 462911fd Leszek Koltunski
    {
465 c0266cb1 Leszek Koltunski
    if( !mInitialized ) return;
466 3addecce Leszek Koltunski
467 c0266cb1 Leszek Koltunski
    int solDepth = 0;
468
    int scraLen = scramble.length;
469
    if( depth>mMinScramble ) depth = mMinScramble;
470 462911fd Leszek Koltunski
471 6d637f71 Leszek Koltunski
    int[] cornerTwist = new int[4];
472
    for(int i=0; i<4; i++) cornerTwist[i] = (rnd.nextInt(3)-1);
473
474 c0266cb1 Leszek Koltunski
    while( solDepth<depth )
475 462911fd Leszek Koltunski
      {
476 c0266cb1 Leszek Koltunski
      int randomPosition = rnd.nextInt(mSize-1);
477 6d637f71 Leszek Koltunski
      int[][] sol = solution(randomPosition,cornerTwist);
478 c0266cb1 Leszek Koltunski
      solDepth = sol.length;
479 ce7202ef Leszek Koltunski
480 c0266cb1 Leszek Koltunski
      if( solDepth>=depth )
481 462911fd Leszek Koltunski
        {
482 c0266cb1 Leszek Koltunski
        int num = Math.min(scraLen,solDepth);
483 462911fd Leszek Koltunski
484 c0266cb1 Leszek Koltunski
        for(int i=0; i<num; i++)
485 462911fd Leszek Koltunski
          {
486 c0266cb1 Leszek Koltunski
          int[] source = sol[solDepth-1-i];
487
          scramble[i][0] = source[0];
488 00057bb1 Leszek Koltunski
          scramble[i][1] = source[1];
489 c0266cb1 Leszek Koltunski
          scramble[i][2] =-source[2];
490 462911fd Leszek Koltunski
          }
491
        }
492
      }
493
    }
494 74cc695a Leszek Koltunski
495
///////////////////////////////////////////////////////////////////////////////////////////////////
496
497
  public boolean test(int index)
498
    {
499
    if( !mInitialized ) return false;
500
501
    int[] data = new int[4];
502
    byte level = mTablebase.retrievePacked(index);
503
    int[] quats = getQuats(index);
504
    int numQuats = quats.length;
505
    int[] tmpQuats = new int[numQuats];
506
507
    data[0]=0;
508
    data[1]=0;
509
    data[2]=1;
510
    data[3]=1;
511
512
    for(int ax=0; ax<mNumAxis; ax++)
513
      for(int cubit=0; cubit<mNumCubits; cubit++)
514
        mRotRow[cubit][ax] = computeRow(mPosition[cubit],quats[cubit],ax);
515
516
    for(int s=0; s<mScalingFactor; s++)
517
      {
518
      int ax    = data[0];
519
      int layer = data[1];
520
      int quat  = data[3];
521
522
      if( mRotatable[ax][layer] )
523
        {
524
        int bitLayer = (1<<layer);
525
        System.arraycopy(quats, 0, tmpQuats, 0, numQuats);
526
527
        for(int cubit=0; cubit<mNumCubits; cubit++)
528
          if( mRotRow[cubit][ax]==bitLayer )
529
            {
530
            int currQuat = tmpQuats[cubit];
531
            int newQuat = getMultQuat(quat,currQuat);
532
            tmpQuats[cubit] = newQuat;
533
            }
534
535
        int childIndex = getIndex(tmpQuats);
536
        byte newLevel = mTablebase.retrievePacked(childIndex);
537
538
        if( ((newLevel-level+1)%3) == 0 ) return true;
539
        }
540
541
      getNextAxisLayerAngleQuat(data);
542
      }
543
544
    return false;
545
    }
546 5e30b196 Leszek Koltunski
547
///////////////////////////////////////////////////////////////////////////////////////////////////
548
549
    public void testPruning(int level)
550
      {
551 3798a303 Leszek Koltunski
      PruningTable table = new PruningTable(mTablebase,level);
552
      int size = mTablebase.getSize();
553 5e30b196 Leszek Koltunski
554 3798a303 Leszek Koltunski
      StringBuilder sb = new StringBuilder();
555
      int num=0;
556 5e30b196 Leszek Koltunski
557 3798a303 Leszek Koltunski
      for(int i=0; i<size; i++)
558
        {
559
        if( table.belongs(i) )
560 5e30b196 Leszek Koltunski
          {
561 3798a303 Leszek Koltunski
          if( (num%10)==0 ) sb.append("\n");
562
          num++;
563
          sb.append(i);
564
          sb.append(' ');
565 5e30b196 Leszek Koltunski
          }
566
        }
567 3798a303 Leszek Koltunski
568
      android.util.Log.e("D", "numbers: "+sb);
569 5e30b196 Leszek Koltunski
      }
570 a110ebe1 Leszek Koltunski
}