35 |
35 |
private final float[] mTmp;
|
36 |
36 |
private final float[] mOrigPosition;
|
37 |
37 |
private final float[] mCurrentPosition;
|
|
38 |
private final float[] mRowOffset;
|
|
39 |
private final float mOrigOffsetX, mOrigOffsetY, mOrigOffsetZ;
|
38 |
40 |
private final int mNumAxis;
|
39 |
41 |
private final int mLen;
|
40 |
42 |
private final int[] mRotationRow;
|
41 |
43 |
private final int mCubitType;
|
42 |
|
private final float[] mRowOffset;
|
43 |
|
private final float[] mTrackingPoint;
|
44 |
44 |
private final int mOrigPuzzleFace;
|
|
45 |
private final int mCubitIndex;
|
45 |
46 |
|
|
47 |
private float[] mTrackingPoint;
|
46 |
48 |
private int mCurrentPuzzleFace;
|
47 |
49 |
private TwistyObject mParent;
|
48 |
50 |
|
... | ... | |
61 |
63 |
mTrackingPoint= mParent.getTrackingPoint(cubitIndex,mCubitType);
|
62 |
64 |
int face = mParent.computeCurrentPuzzleFace(mCubitType,mTrackingPoint);
|
63 |
65 |
|
|
66 |
mOrigOffsetX = mRowOffset[0];
|
|
67 |
mOrigOffsetY = mRowOffset[1];
|
|
68 |
mOrigOffsetZ = mRowOffset[2];
|
|
69 |
|
64 |
70 |
if( mCubitType==TYPE_DECIDER ) mParent.setRotationRowOffset(face,mRowOffset);
|
65 |
71 |
|
|
72 |
mCubitIndex = cubitIndex;
|
66 |
73 |
mOrigPuzzleFace = face;
|
67 |
74 |
mCurrentPuzzleFace= face;
|
68 |
75 |
mOrigPosition = new float[mLen];
|
... | ... | |
193 |
200 |
for(int i=0; i<len; i++)
|
194 |
201 |
{
|
195 |
202 |
QuatHelper.rotateVectorByQuat( mTmp, mCurrentPosition[3*i], mCurrentPosition[3*i+1], mCurrentPosition[3*i+2], 0, quat);
|
196 |
|
|
197 |
203 |
mCurrentPosition[3*i ] = mTmp[0];
|
198 |
204 |
mCurrentPosition[3*i+1] = mTmp[1];
|
199 |
205 |
mCurrentPosition[3*i+2] = mTmp[2];
|
200 |
|
|
201 |
206 |
mParent.clampPos(mCurrentPosition, 3*i);
|
202 |
207 |
}
|
203 |
208 |
|
... | ... | |
229 |
234 |
return mQuatIndex;
|
230 |
235 |
}
|
231 |
236 |
|
232 |
|
|
233 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
234 |
|
// a DECIDER cubit (e.g. Crazy 3x3 Planet face center) has just moved. We need to re-adjust the
|
235 |
|
// RotRows of all the Follower cubits, even those that do not belong to the rotation.
|
236 |
|
|
237 |
|
void adjustRotRowPostRotateADecider()
|
238 |
|
{
|
239 |
|
computeRotationRow();
|
240 |
|
}
|
241 |
|
|
242 |
237 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
243 |
238 |
|
244 |
239 |
void solve()
|
... | ... | |
246 |
241 |
mQuatIndex = 0;
|
247 |
242 |
mCurrentPuzzleFace = mOrigPuzzleFace;
|
248 |
243 |
System.arraycopy(mOrigPosition, 0, mCurrentPosition, 0, mCurrentPosition.length);
|
249 |
|
computeRotationRow();
|
|
244 |
|
|
245 |
if( mCubitType!=TYPE_NORMAL )
|
|
246 |
{
|
|
247 |
mTrackingPoint = mParent.getTrackingPoint(mCubitIndex,mCubitType);
|
|
248 |
if( mCubitType==TYPE_DECIDER )
|
|
249 |
{
|
|
250 |
mRowOffset[0] = mOrigOffsetX;
|
|
251 |
mRowOffset[1] = mOrigOffsetY;
|
|
252 |
mRowOffset[2] = mOrigOffsetZ;
|
|
253 |
}
|
|
254 |
}
|
250 |
255 |
}
|
251 |
256 |
|
252 |
257 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Decider&Follower cubits: fix solving the whole puzzle.