1 |
e844c116
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2019 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
|
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
package org.distorted.object;
|
21 |
|
|
|
22 |
|
|
import android.graphics.Canvas;
|
23 |
|
|
import android.graphics.Paint;
|
24 |
|
|
|
25 |
|
|
import org.distorted.library.main.DistortedEffects;
|
26 |
|
|
import org.distorted.library.main.DistortedTexture;
|
27 |
|
|
import org.distorted.library.mesh.MeshBase;
|
28 |
|
|
import org.distorted.library.mesh.MeshRectangles;
|
29 |
|
|
import org.distorted.library.type.Static3D;
|
30 |
|
|
import org.distorted.library.type.Static4D;
|
31 |
|
|
|
32 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
33 |
|
|
|
34 |
|
|
public class RubikPyraminx extends RubikObject
|
35 |
|
|
{
|
36 |
|
|
private static final Static3D[] AXIS = new Static3D[]
|
37 |
|
|
{
|
38 |
|
|
new Static3D( 0, 0, 1 ),
|
39 |
|
|
new Static3D( (float)Math.sqrt(6)/3, -(float)Math.sqrt(3)/3, -1.0f/3 ),
|
40 |
|
|
new Static3D(-(float)Math.sqrt(6)/3, -(float)Math.sqrt(3)/3, -1.0f/3 ),
|
41 |
|
|
new Static3D( 0, 2*(float)Math.sqrt(2)/3, -1.0f/3 )
|
42 |
|
|
};
|
43 |
|
|
|
44 |
|
|
private static final int[] FACE_COLORS = new int[]
|
45 |
|
|
{
|
46 |
|
|
0xffffff00, 0xff00ff00, // AXIS[0]right (YELLOW) AXIS[1]right (GREEN )
|
47 |
|
|
0xff0000ff, 0xffff0000 // AXIS[2]right (BLUE ) AXIS[3]right (RED )
|
48 |
|
|
};
|
49 |
|
|
|
50 |
|
|
private static final float[] LEGALQUATS = new float[]
|
51 |
|
|
{
|
52 |
|
|
// TODO;
|
53 |
|
|
};
|
54 |
|
|
|
55 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
56 |
|
|
|
57 |
|
|
RubikPyraminx(int size, Static4D quatCur, Static4D quatAcc, DistortedTexture texture, MeshRectangles mesh, DistortedEffects effects)
|
58 |
|
|
{
|
59 |
|
|
super(size,quatCur,quatAcc,texture,mesh,effects);
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63 |
|
|
// TODO
|
64 |
|
|
|
65 |
|
|
Static3D[] getCubitPositions(int size)
|
66 |
|
|
{
|
67 |
|
|
return null;
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
71 |
|
|
|
72 |
|
|
float[] getLegalQuats()
|
73 |
|
|
{
|
74 |
|
|
return LEGALQUATS;
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
78 |
|
|
|
79 |
|
|
int getNumFaces()
|
80 |
|
|
{
|
81 |
|
|
return FACE_COLORS.length;
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
85 |
|
|
|
86 |
|
|
Static3D[] getRotationAxis()
|
87 |
|
|
{
|
88 |
|
|
return AXIS;
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92 |
|
|
|
93 |
|
|
void createFaceTexture(Canvas canvas, Paint paint, int face)
|
94 |
|
|
{
|
95 |
|
|
// TODO
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
99 |
|
|
// TODO
|
100 |
|
|
|
101 |
|
|
MeshBase createCubitMesh(int vertices)
|
102 |
|
|
{
|
103 |
|
|
return null;
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
107 |
|
|
// PUBLIC API
|
108 |
|
|
|
109 |
|
|
public int getBasicAngle()
|
110 |
|
|
{
|
111 |
|
|
return 3;
|
112 |
|
|
}
|
113 |
|
|
}
|