Revision 967c1d17
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/Movement.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public abstract class Movement |
29 | 29 |
{ |
30 |
// it doesn't matter where we touch a face - the list of enabled rotAxis will always be the same |
|
31 |
static final int TYPE_NOT_SPLIT = 0; |
|
32 |
// each face is split into several parts by lines coming from its center to the midpoints of each edge |
|
33 |
static final int TYPE_SPLIT_EDGE = 1; |
|
34 |
// each face is split into several parts by lines coming from its center to the vertices |
|
35 |
static final int TYPE_SPLIT_CORNER = 2; |
|
36 |
|
|
30 | 37 |
static final float SQ3 = (float)Math.sqrt(3); |
31 | 38 |
static final float SQ6 = (float)Math.sqrt(6); |
32 | 39 |
|
... | ... | |
42 | 49 |
private Static4D[][] mCastedRotAxis4D; |
43 | 50 |
private float[][] mTouchBorders, mA, mB; |
44 | 51 |
|
52 |
private final int mType; |
|
53 |
private final int[] mNumEnabled; |
|
54 |
private final int[][][] mEnabled; |
|
55 |
|
|
45 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 57 |
|
58 |
abstract int returnPart(int type, int face, float[] touchPoint); |
|
47 | 59 |
abstract boolean isInsideFace(int face, float[] point); |
48 |
abstract void computeEnabledAxis(int face, float[] touchPoint, int[] enabledAxis); |
|
49 | 60 |
public abstract float returnRotationFactor(int numLayers, int row); |
50 | 61 |
|
51 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 63 |
|
53 |
Movement(Static3D[] rotAxis, Static3D[] faceAxis, float[][] cuts, boolean[][] rotatable, float distance3D, int size) |
|
64 |
Movement(Static3D[] rotAxis, Static3D[] faceAxis, float[][] cuts, boolean[][] rotatable, |
|
65 |
float distance3D, int size, int type, int[] numEnabled, int[][][] enabled) |
|
54 | 66 |
{ |
55 | 67 |
mPoint = new float[3]; |
56 | 68 |
mCamera= new float[3]; |
... | ... | |
59 | 71 |
mPoint2D = new float[2]; |
60 | 72 |
mMove2D = new float[2]; |
61 | 73 |
|
74 |
mType = type; |
|
75 |
mNumEnabled = numEnabled; |
|
76 |
mEnabled = enabled; |
|
77 |
|
|
62 | 78 |
mFaceAxis = faceAxis; |
63 | 79 |
mNumFaceAxis= mFaceAxis.length; |
64 | 80 |
|
... | ... | |
380 | 396 |
return len; |
381 | 397 |
} |
382 | 398 |
|
399 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
400 |
|
|
401 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
|
402 |
{ |
|
403 |
int part = returnPart(mType,face,touchPoint); |
|
404 |
|
|
405 |
int num = mNumEnabled[face]; |
|
406 |
enabled[0] = num; |
|
407 |
System.arraycopy(mEnabled[face][part], 0, enabled, 1, num); |
|
408 |
} |
|
409 |
|
|
383 | 410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
384 | 411 |
// PUBLIC API |
385 | 412 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Do away with the last method in the object Movement classes. Remove the object Movement classes altogether.
From now on the implementation of a TwistyPuzzle is 100% data, no code at all.
Next step: make the implementation a (generated?) (XML?) file.