Revision 9f4c44fe
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/object/RubikPyraminx.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
public class RubikPyraminx extends RubikObject |
42 | 42 |
{ |
43 |
private static final float SQ2 = (float)Math.sqrt(2); |
|
44 |
private static final float SQ3 = (float)Math.sqrt(3); |
|
45 |
|
|
43 | 46 |
private static final Static3D[] AXIS = new Static3D[] |
44 | 47 |
{ |
45 |
new Static3D( 0, 1, 0 ),
|
|
46 |
new Static3D( (float)Math.sqrt(6)/3, -1.0f/3, -(float)Math.sqrt(3)/3 ),
|
|
47 |
new Static3D(-(float)Math.sqrt(6)/3, -1.0f/3, -(float)Math.sqrt(3)/3 ),
|
|
48 |
new Static3D( 0, -1.0f/3, 2*(float)Math.sqrt(2)/3 )
|
|
48 |
new Static3D( 0, 1, 0 ),
|
|
49 |
new Static3D( SQ2*SQ3/3, -1.0f/3, -SQ2/3 ),
|
|
50 |
new Static3D(-SQ2*SQ3/3, -1.0f/3, -SQ2/3 ),
|
|
51 |
new Static3D( 0, -1.0f/3, 2*SQ2/3 )
|
|
49 | 52 |
}; |
50 | 53 |
|
51 | 54 |
private static final int[] FACE_COLORS = new int[] |
... | ... | |
54 | 57 |
0xff0000ff, 0xffff0000 // AXIS[2]right (BLUE ) AXIS[3]right (RED ) |
55 | 58 |
}; |
56 | 59 |
|
60 |
// computed with res/raw/compute_quats.c |
|
57 | 61 |
private static final float[] LEGALQUATS = new float[] |
58 | 62 |
{ |
59 |
// TODO; |
|
63 |
0.0f, 1.0f, -1.0f, 0.5f, -0.5f, SQ2/2, -SQ2/2, SQ3/2, -SQ3/2, |
|
64 |
SQ3/3, -SQ3/3, SQ3/6, -SQ3/6, SQ2*SQ3/3, -SQ2*SQ3/3, SQ2*SQ3/6, -SQ2*SQ3/6 |
|
60 | 65 |
}; |
61 | 66 |
|
62 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
106 | 111 |
|
107 | 112 |
MeshBase createCubitMesh(int vertices) |
108 | 113 |
{ |
109 |
final float SQ3 = (float)Math.sqrt(3); |
|
110 | 114 |
final float angleFaces = (float)((180/Math.PI)*(2*Math.asin(SQ3/3))); // angle between two faces of a tetrahedron |
111 | 115 |
final int MESHES=4; |
112 | 116 |
|
Also available in: Unified diff
Progress with the Pyraminx - computing all legal quaternions!