Revision 4946b635
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/Movement12.java | ||
---|---|---|
51 | 51 |
new Static3D(-SIN54/LEN, 0 , -C2/LEN ) |
52 | 52 |
}; |
53 | 53 |
|
54 |
private final float[][] mTouchBorders; |
|
55 |
|
|
56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
57 |
|
|
58 |
Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int numLayers) |
|
59 |
{ |
|
60 |
super(rotAxis, FACE_AXIS, DIST3D, DIST2D); |
|
61 |
float scale = (DIST2D*(1.5f)/(2*DIST3D))/numLayers; // SQ5/2 is 1/cos(dihedral-90) |
|
62 |
mTouchBorders = computeBorders(scale,cuts,rotatable); |
|
63 |
} |
|
64 |
|
|
65 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
66 | 55 |
|
67 |
int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
|
|
56 |
Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
|
|
68 | 57 |
{ |
69 |
float[] borders = mTouchBorders[axisIndex]; |
|
70 |
int len = borders.length; |
|
71 |
|
|
72 |
for(int i=0; i<len; i++) |
|
73 |
{ |
|
74 |
if( offset<borders[i] ) return i; |
|
75 |
} |
|
76 |
|
|
77 |
return len; |
|
58 |
super(rotAxis, FACE_AXIS, cuts,rotatable,DIST3D, size); |
|
78 | 59 |
} |
79 | 60 |
|
80 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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.