Revision ef018c1b
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 |
|
|
54 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
55 | 57 |
|
56 |
Movement12(Static3D[] rotAxis) |
|
58 |
Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int numLayers)
|
|
57 | 59 |
{ |
58 | 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 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
66 |
|
|
67 |
int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset) |
|
68 |
{ |
|
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; |
|
59 | 78 |
} |
60 | 79 |
|
61 | 80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Abstract the next function, computeRowFromOffset(), out of the individual Movement classes.
Still two issues:
1) mysterious 1.5 multiplier in Movement12
2) in Movement8, moving the offset works only if the rotAxis are face-turning, i.e. they connect the centers of the opposing faces of the octahedron.