Revision 4946b635
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/Movement6.java | ||
---|---|---|
38 | 38 |
new Static3D(0,0,1), new Static3D(0,0,-1) |
39 | 39 |
}; |
40 | 40 |
|
41 |
private final float[][] mTouchBorders; |
|
42 |
|
|
43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
44 |
|
|
45 |
Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int numLayers) |
|
46 |
{ |
|
47 |
super(rotAxis, FACE_AXIS, DIST3D, DIST2D); |
|
48 |
float scale = 1.0f/numLayers; // 1.0 is (2*DIST3D)/(2*DIST2D) |
|
49 |
mTouchBorders = computeBorders(scale,cuts,rotatable); |
|
50 |
} |
|
51 |
|
|
52 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
53 | 42 |
|
54 |
int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
|
|
43 |
Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
|
|
55 | 44 |
{ |
56 |
float[] borders = mTouchBorders[axisIndex]; |
|
57 |
int len = borders.length; |
|
58 |
|
|
59 |
for(int i=0; i<len; i++) |
|
60 |
{ |
|
61 |
if( offset<borders[i] ) return i; |
|
62 |
} |
|
63 |
|
|
64 |
return len; |
|
45 |
super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size); |
|
65 | 46 |
} |
66 | 47 |
|
67 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Major abstraction - automatically compute the 'computeRowFromOffset()' function from CUTS.
Still one thing left: it appears like the CUTS of Mega/Kilominxes are not correct.