Project

General

Profile

« Previous | Next » 

Revision 20d7d940

Added by Leszek Koltunski 12 months ago

speedup

View differences:

src/main/java/org/distorted/objectlib/tablebases/TBCuboid323.java
9 9

  
10 10
package org.distorted.objectlib.tablebases;
11 11

  
12
import org.distorted.library.helpers.QuatHelper;
12 13
import org.distorted.library.type.Static3D;
13 14
import org.distorted.objectlib.R;
14 15
import org.distorted.objectlib.helpers.OperatingSystemInterface;
......
197 198
    return new boolean[][] { {true,false,true},{false,true},{true,true,false} };
198 199
    }
199 200

  
201
///////////////////////////////////////////////////////////////////////////////////////////////////
202
// purely for speedup
203

  
204
  @Override
205
  int computeRow(float[] pos, int quat, int axisIndex)
206
    {
207
    QuatHelper.rotateVectorByQuat(mTmp,pos[0],pos[1],pos[2],1.0f,mQuats[quat]);
208

  
209
    switch(axisIndex)
210
      {
211
      case 0: if( mTmp[0]<-0.5f ) return 1;
212
              if( mTmp[0]< 0.5f ) return 2;
213
              return 4;
214
      case 1: return (mTmp[1]<0 ? 1:2);
215
      case 2: if( mTmp[2]<-0.5f ) return 1;
216
              if( mTmp[2]< 0.5f ) return 2;
217
              return 4;
218
      }
219

  
220
    return 0;
221
    }
222

  
200 223
///////////////////////////////////////////////////////////////////////////////////////////////////
201 224
// we map the move (axis=2, middle layer) to move (axis=2,both middle and back layers).
202 225
// this way we can imitate move of the front layer (which we do not want to move because

Also available in: Unified diff