Revision 4946b635
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/Movement4.java | ||
---|---|---|
39 | 39 |
new Static3D(+SQ6/3,-SQ3/3, 0), |
40 | 40 |
}; |
41 | 41 |
|
42 |
private final float[][] mTouchBorders; |
|
43 |
|
|
44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
45 |
|
|
46 |
Movement4(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable,int numLayers) |
|
47 |
{ |
|
48 |
super(rotAxis, FACE_AXIS, DIST3D, DIST2D); |
|
49 |
float scale = (3*SQ2/4)/numLayers; // 3*SQ2/4 is height(face)/height(tetra) |
|
50 |
mTouchBorders = computeBorders(scale,cuts,rotatable); |
|
51 |
} |
|
52 |
|
|
53 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 43 |
|
55 |
int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
|
|
44 |
Movement4(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
|
|
56 | 45 |
{ |
57 |
float[] borders = mTouchBorders[axisIndex]; |
|
58 |
int len = borders.length; |
|
59 |
|
|
60 |
for(int i=0; i<len; i++) |
|
61 |
{ |
|
62 |
if( offset<borders[i] ) return i; |
|
63 |
} |
|
64 |
|
|
65 |
return len; |
|
46 |
super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size); |
|
66 | 47 |
} |
67 | 48 |
|
68 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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.