Revision 4b4c217e
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/objects/TwistyMinx.java | ||
---|---|---|
45 | 45 |
static final float C0 = (SQ5-1)/4; // cos(72 deg) |
46 | 46 |
static final float C1 = (SQ5+1)/4; // cos(36 deg) |
47 | 47 |
static final float C2 = (SQ5+3)/4; |
48 |
static final float C3 = (float)(Math.sqrt(10-2*SQ5)/4); // cos(54 deg)
|
|
48 |
static final float LEN= (float)(Math.sqrt(1.25f+0.5f*SQ5));
|
|
49 | 49 |
|
50 | 50 |
// the six rotation axis of a RubikMegaminx. Must be normalized. |
51 | 51 |
static final Static3D[] ROT_AXIS = new Static3D[] |
52 | 52 |
{ |
53 |
new Static3D( C1/(2*C3), 1/(2*C3) , 0 ),
|
|
54 |
new Static3D(-C1/(2*C3), 1/(2*C3) , 0 ),
|
|
55 |
new Static3D( 0 , C1/(2*C3), 1/(2*C3) ),
|
|
56 |
new Static3D( 0 ,-C1/(2*C3), 1/(2*C3) ),
|
|
57 |
new Static3D( 1/(2*C3) , 0 , C1/(2*C3)),
|
|
58 |
new Static3D( 1/(2*C3) , 0 ,-C1/(2*C3))
|
|
53 |
new Static3D( C2/LEN, C1/LEN, 0 ),
|
|
54 |
new Static3D(-C2/LEN, C1/LEN, 0 ),
|
|
55 |
new Static3D( 0 , C2/LEN, C1/LEN ),
|
|
56 |
new Static3D( 0 ,-C2/LEN, C1/LEN ),
|
|
57 |
new Static3D( C1/LEN, 0 , C2/LEN ),
|
|
58 |
new Static3D( C1/LEN, 0 ,-C2/LEN )
|
|
59 | 59 |
}; |
60 | 60 |
|
61 | 61 |
private static final int MINX_LGREEN = 0xff53aa00; |
... | ... | |
319 | 319 |
float S = 0.07f; |
320 | 320 |
float R = 0.09f; |
321 | 321 |
|
322 |
float A = 0.86f; |
|
322 | 323 |
float X1= (SQ5+1)/8; |
323 | 324 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
324 | 325 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8); |
325 | 326 |
|
326 |
float[] vertices = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 }; |
|
327 |
float[] vertices = { -X1, Y2, 0, -A*Y1, X1, Y2, 0, Y1 };
|
|
327 | 328 |
|
328 | 329 |
FactorySticker factory = FactorySticker.getInstance(); |
329 | 330 |
factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face], R); |
331 |
|
|
332 |
float MID = TEXTURE_HEIGHT*0.5f; |
|
333 |
float WID = TEXTURE_HEIGHT*0.1f; |
|
334 |
float HEI = TEXTURE_HEIGHT*(0.47f+Y1); |
|
335 |
canvas.drawLine(left+MID-WID,top+HEI,left+MID+WID,top+HEI,paint); |
|
330 | 336 |
} |
331 | 337 |
|
332 | 338 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with the Kilominx - rotations.