1 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 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.objectlib.objects;
|
21 |
|
|
|
22 |
c9c71c3f
|
Leszek Koltunski
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
|
23 |
|
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_CORNER;
|
24 |
29b82486
|
Leszek Koltunski
|
|
25 |
82eb152a
|
Leszek Koltunski
|
import java.io.InputStream;
|
26 |
29b82486
|
Leszek Koltunski
|
|
27 |
|
|
import org.distorted.library.type.Static3D;
|
28 |
|
|
import org.distorted.library.type.Static4D;
|
29 |
|
|
|
30 |
c9c71c3f
|
Leszek Koltunski
|
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
|
31 |
8592461c
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectControl;
|
32 |
8005e762
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
33 |
198c5bf0
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectShape;
|
34 |
|
|
import org.distorted.objectlib.helpers.ObjectSticker;
|
35 |
|
|
import org.distorted.objectlib.helpers.ScrambleState;
|
36 |
386af988
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ShapeHexahedron;
|
37 |
29b82486
|
Leszek Koltunski
|
|
38 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39 |
|
|
|
40 |
386af988
|
Leszek Koltunski
|
public class TwistyRedi extends ShapeHexahedron
|
41 |
29b82486
|
Leszek Koltunski
|
{
|
42 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
43 |
|
|
{
|
44 |
|
|
new Static3D(+SQ3/3,+SQ3/3,+SQ3/3),
|
45 |
|
|
new Static3D(+SQ3/3,+SQ3/3,-SQ3/3),
|
46 |
|
|
new Static3D(+SQ3/3,-SQ3/3,+SQ3/3),
|
47 |
|
|
new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
|
48 |
|
|
};
|
49 |
|
|
|
50 |
|
|
private ScrambleState[] mStates;
|
51 |
|
|
private int[] mBasicAngle;
|
52 |
|
|
private Static4D[] mQuats;
|
53 |
|
|
private float[][] mCuts;
|
54 |
|
|
private float[][] mCenters;
|
55 |
|
|
private int[][] mFaceMap;
|
56 |
|
|
private ObjectSticker[] mStickers;
|
57 |
|
|
|
58 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
59 |
|
|
|
60 |
64c209f5
|
Leszek Koltunski
|
public TwistyRedi(int[] numL, Static4D quat, Static3D move, float scale, InputStream stream)
|
61 |
29b82486
|
Leszek Koltunski
|
{
|
62 |
64c209f5
|
Leszek Koltunski
|
super(numL, numL[0], quat, move, scale, stream);
|
63 |
29b82486
|
Leszek Koltunski
|
}
|
64 |
|
|
|
65 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66 |
|
|
|
67 |
f9a81f52
|
Leszek Koltunski
|
public ScrambleState[] getScrambleStates()
|
68 |
29b82486
|
Leszek Koltunski
|
{
|
69 |
|
|
if( mStates==null )
|
70 |
|
|
{
|
71 |
|
|
mStates = new ScrambleState[]
|
72 |
|
|
{
|
73 |
|
|
new ScrambleState( new int[][] { {0,1,1,0,-1,1, 2,1,2,2,-1,2},{0,1,3,0,-1,3, 2,1,4,2,-1,4},{0,1,5,0,-1,5, 2,1,6,2,-1,6},{0,1,7,0,-1,7, 2,1,8,2,-1,8} } ),
|
74 |
|
|
new ScrambleState( new int[][] { { },{0,1,3,0,-1,3 },{0,1,5,0,-1,5, },{ 2,1,8,2,-1,8} } ),
|
75 |
|
|
new ScrambleState( new int[][] { { },{ 2,1,4,2,-1,4},{ 2,1,6,2,-1,6},{0,1,7,0,-1,7 } } ),
|
76 |
|
|
new ScrambleState( new int[][] { {0,1,1,0,-1,1 },{ },{ 2,1,6,2,-1,6},{0,1,7,0,-1,7 } } ),
|
77 |
|
|
new ScrambleState( new int[][] { { 2,1,2,2,-1,2},{ },{0,1,5,0,-1,5, },{ 2,1,8,2,-1,8} } ),
|
78 |
|
|
new ScrambleState( new int[][] { {0,1,1,0,-1,1 },{ 2,1,4,2,-1,4},{ },{0,1,7,0,-1,7 } } ),
|
79 |
|
|
new ScrambleState( new int[][] { { 2,1,2,2,-1,2},{0,1,3,0,-1,3 },{ },{ 2,1,8,2,-1,8} } ),
|
80 |
|
|
new ScrambleState( new int[][] { { 2,1,2,2,-1,2},{0,1,3,0,-1,3 },{0,1,5,0,-1,5, },{ } } ),
|
81 |
|
|
new ScrambleState( new int[][] { {0,1,1,0,-1,1 },{ 2,1,4,2,-1,4},{ 2,1,6,2,-1,6},{ } } ),
|
82 |
|
|
};
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
return mStates;
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
89 |
|
|
|
90 |
|
|
private void initializeQuats()
|
91 |
|
|
{
|
92 |
|
|
mQuats = new Static4D[]
|
93 |
|
|
{
|
94 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ),
|
95 |
|
|
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f ),
|
96 |
|
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f ),
|
97 |
|
|
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f ),
|
98 |
|
|
|
99 |
|
|
new Static4D( 0.5f, 0.5f, 0.5f, 0.5f ),
|
100 |
|
|
new Static4D( 0.5f, 0.5f, 0.5f, -0.5f ),
|
101 |
|
|
new Static4D( 0.5f, 0.5f, -0.5f, 0.5f ),
|
102 |
|
|
new Static4D( 0.5f, 0.5f, -0.5f, -0.5f ),
|
103 |
|
|
new Static4D( 0.5f, -0.5f, 0.5f, 0.5f ),
|
104 |
|
|
new Static4D( 0.5f, -0.5f, 0.5f, -0.5f ),
|
105 |
|
|
new Static4D( 0.5f, -0.5f, -0.5f, 0.5f ),
|
106 |
|
|
new Static4D( 0.5f, -0.5f, -0.5f, -0.5f )
|
107 |
|
|
};
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
111 |
|
|
|
112 |
7b832206
|
Leszek Koltunski
|
public int[] getSolvedQuats(int cubit, int[] numLayers)
|
113 |
29b82486
|
Leszek Koltunski
|
{
|
114 |
|
|
if( mQuats==null ) initializeQuats();
|
115 |
|
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
116 |
c9c71c3f
|
Leszek Koltunski
|
return status<0 ? null : buildSolvedQuats(TouchControlHexahedron.FACE_AXIS[status],mQuats);
|
117 |
29b82486
|
Leszek Koltunski
|
}
|
118 |
|
|
|
119 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
120 |
|
|
|
121 |
1bb09f88
|
Leszek Koltunski
|
public Static4D[] getQuats()
|
122 |
29b82486
|
Leszek Koltunski
|
{
|
123 |
|
|
if( mQuats==null ) initializeQuats();
|
124 |
|
|
return mQuats;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
128 |
|
|
|
129 |
59c20632
|
Leszek Koltunski
|
public int getSolvedFunctionIndex()
|
130 |
29b82486
|
Leszek Koltunski
|
{
|
131 |
|
|
return 0;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
135 |
|
|
|
136 |
1bb09f88
|
Leszek Koltunski
|
public int getNumStickerTypes(int[] numLayers)
|
137 |
29b82486
|
Leszek Koltunski
|
{
|
138 |
|
|
return 2;
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
142 |
|
|
|
143 |
7bbfc84f
|
Leszek Koltunski
|
public float[][] getCuts(int[] numLayers)
|
144 |
29b82486
|
Leszek Koltunski
|
{
|
145 |
|
|
if( mCuts==null )
|
146 |
|
|
{
|
147 |
|
|
float C = +SQ3/3 +0.05f;
|
148 |
|
|
float[] cut = new float[] {-C,+C};
|
149 |
|
|
mCuts = new float[][] { cut,cut,cut,cut };
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
return mCuts;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
156 |
|
|
|
157 |
59c20632
|
Leszek Koltunski
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
158 |
|
|
{
|
159 |
|
|
int numAxis = ROT_AXIS.length;
|
160 |
|
|
boolean[] tmp = new boolean[] {true,false,true};
|
161 |
|
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
162 |
|
|
for(int i=0; i<numAxis; i++) layerRotatable[i] = tmp;
|
163 |
|
|
|
164 |
|
|
return layerRotatable;
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
168 |
|
|
|
169 |
11fa413d
|
Leszek Koltunski
|
public int getTouchControlType()
|
170 |
59c20632
|
Leszek Koltunski
|
{
|
171 |
c9c71c3f
|
Leszek Koltunski
|
return TC_HEXAHEDRON;
|
172 |
59c20632
|
Leszek Koltunski
|
}
|
173 |
|
|
|
174 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
175 |
|
|
|
176 |
11fa413d
|
Leszek Koltunski
|
public int getTouchControlSplit()
|
177 |
29b82486
|
Leszek Koltunski
|
{
|
178 |
59c20632
|
Leszek Koltunski
|
return TYPE_SPLIT_CORNER;
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
182 |
|
|
|
183 |
|
|
public int[][][] getEnabled()
|
184 |
|
|
{
|
185 |
|
|
return new int[][][]
|
186 |
29b82486
|
Leszek Koltunski
|
{
|
187 |
59c20632
|
Leszek Koltunski
|
{{0,1},{3,1},{2,3},{0,2}},
|
188 |
|
|
{{2,3},{3,1},{0,1},{0,2}},
|
189 |
|
|
{{1,2},{0,1},{0,3},{2,3}},
|
190 |
|
|
{{1,2},{2,3},{0,3},{0,1}},
|
191 |
|
|
{{0,3},{0,2},{1,2},{1,3}},
|
192 |
|
|
{{1,2},{0,2},{0,3},{1,3}},
|
193 |
|
|
};
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
197 |
|
|
|
198 |
|
|
public float[] getDist3D(int[] numLayers)
|
199 |
|
|
{
|
200 |
|
|
return null;
|
201 |
29b82486
|
Leszek Koltunski
|
}
|
202 |
|
|
|
203 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
204 |
|
|
|
205 |
a75ae1ee
|
Leszek Koltunski
|
public int getNumCubitFaces()
|
206 |
29b82486
|
Leszek Koltunski
|
{
|
207 |
|
|
return 9;
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
211 |
|
|
|
212 |
7b832206
|
Leszek Koltunski
|
public float[][] getCubitPositions(int[] numLayers)
|
213 |
29b82486
|
Leszek Koltunski
|
{
|
214 |
|
|
if( mCenters==null )
|
215 |
|
|
{
|
216 |
|
|
final float DIST_CORNER = 1.0f;
|
217 |
|
|
final float DIST_EDGE = 1.5f;
|
218 |
|
|
|
219 |
|
|
mCenters = new float[][]
|
220 |
|
|
{
|
221 |
|
|
{ DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
222 |
|
|
{ DIST_CORNER, DIST_CORNER,-DIST_CORNER },
|
223 |
|
|
{ DIST_CORNER,-DIST_CORNER, DIST_CORNER },
|
224 |
|
|
{ DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
|
225 |
|
|
{-DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
226 |
|
|
{-DIST_CORNER, DIST_CORNER,-DIST_CORNER },
|
227 |
|
|
{-DIST_CORNER,-DIST_CORNER, DIST_CORNER },
|
228 |
|
|
{-DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
|
229 |
|
|
|
230 |
|
|
{ 0.0f, DIST_EDGE, DIST_EDGE },
|
231 |
|
|
{ DIST_EDGE, 0.0f, DIST_EDGE },
|
232 |
|
|
{ 0.0f,-DIST_EDGE, DIST_EDGE },
|
233 |
|
|
{-DIST_EDGE, 0.0f, DIST_EDGE },
|
234 |
|
|
{ DIST_EDGE, DIST_EDGE, 0.0f },
|
235 |
|
|
{ DIST_EDGE,-DIST_EDGE, 0.0f },
|
236 |
|
|
{-DIST_EDGE,-DIST_EDGE, 0.0f },
|
237 |
|
|
{-DIST_EDGE, DIST_EDGE, 0.0f },
|
238 |
|
|
{ 0.0f, DIST_EDGE,-DIST_EDGE },
|
239 |
|
|
{ DIST_EDGE, 0.0f,-DIST_EDGE },
|
240 |
|
|
{ 0.0f,-DIST_EDGE,-DIST_EDGE },
|
241 |
|
|
{-DIST_EDGE, 0.0f,-DIST_EDGE }
|
242 |
|
|
};
|
243 |
|
|
}
|
244 |
|
|
|
245 |
|
|
return mCenters;
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
249 |
|
|
|
250 |
e30c522a
|
Leszek Koltunski
|
public ObjectShape getObjectShape(int variant)
|
251 |
29b82486
|
Leszek Koltunski
|
{
|
252 |
|
|
if( variant==0 )
|
253 |
|
|
{
|
254 |
57ef6378
|
Leszek Koltunski
|
float[][] vertices = new float[][]
|
255 |
29b82486
|
Leszek Koltunski
|
{
|
256 |
|
|
{ 0.0f, 0.0f, 0.0f },
|
257 |
|
|
{-0.5f, 0.5f, 0.5f },
|
258 |
|
|
{-0.5f,-0.5f, 0.5f },
|
259 |
|
|
{ 0.5f, 0.5f, 0.5f },
|
260 |
|
|
{ 0.5f,-0.5f, 0.5f },
|
261 |
|
|
{ 0.5f, 0.5f,-0.5f },
|
262 |
|
|
{ 0.5f,-0.5f,-0.5f },
|
263 |
|
|
{-0.5f, 0.5f,-0.5f },
|
264 |
|
|
};
|
265 |
|
|
|
266 |
|
|
int[][] vert_indices = new int[][]
|
267 |
|
|
{
|
268 |
|
|
{ 2,4,3,1 },
|
269 |
|
|
{ 1,3,5,7 },
|
270 |
|
|
{ 4,6,5,3 },
|
271 |
|
|
|
272 |
|
|
{ 2,4,0 },
|
273 |
|
|
{ 5,7,0 },
|
274 |
|
|
{ 4,6,0 },
|
275 |
|
|
{ 7,1,0 },
|
276 |
|
|
{ 1,2,0 },
|
277 |
|
|
{ 6,5,0 }
|
278 |
|
|
};
|
279 |
|
|
|
280 |
|
|
float[][] bands = new float[][] { {0.06f,35,0.5f,0.7f,5,2,2}, {0.01f,35,0.2f,0.4f,5,2,2} };
|
281 |
|
|
int[] bandIndices = new int[] { 0,0,0,1,1,1,1,1,1 };
|
282 |
|
|
float[][] corners = new float[][] { {0.06f,0.12f} };
|
283 |
|
|
int[] cornerIndices = new int[] { -1,0,-1,0,0,0,-1,-1 };
|
284 |
|
|
float[][] centers = new float[][] { { 0.0f, 0.0f, 0.0f} };
|
285 |
|
|
int[] centerIndices = new int[] { -1,0,-1,0,0,0,-1,-1 };
|
286 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
287 |
|
|
}
|
288 |
|
|
else
|
289 |
|
|
{
|
290 |
57ef6378
|
Leszek Koltunski
|
float[][] vertices = new float[][]
|
291 |
29b82486
|
Leszek Koltunski
|
{
|
292 |
|
|
{-0.5f, 0.0f, 0.0f},
|
293 |
|
|
{ 0.5f, 0.0f, 0.0f},
|
294 |
|
|
{-0.5f,-1.0f, 0.0f},
|
295 |
|
|
{ 0.5f,-1.0f, 0.0f},
|
296 |
|
|
{ 0.0f,-1.5f, 0.0f},
|
297 |
|
|
{-0.5f, 0.0f,-1.0f},
|
298 |
|
|
{ 0.5f, 0.0f,-1.0f},
|
299 |
|
|
{ 0.0f, 0.0f,-1.5f},
|
300 |
|
|
};
|
301 |
|
|
|
302 |
|
|
int[][] vert_indices = new int[][]
|
303 |
|
|
{
|
304 |
|
|
{ 0,2,4,3,1 },
|
305 |
|
|
{ 0,1,6,7,5 },
|
306 |
|
|
{ 1,3,6 },
|
307 |
|
|
{ 0,2,5 },
|
308 |
|
|
{ 4,7,6,3 },
|
309 |
|
|
{ 4,7,5,2 }
|
310 |
|
|
};
|
311 |
|
|
|
312 |
|
|
float[][] bands = new float[][] { {0.038f,35,0.250f,0.7f,7,2,2}, {0.020f,35,0.125f,0.2f,3,1,2}, {0.020f,35,0.125f,0.2f,3,1,1} };
|
313 |
|
|
int[] bandIndices = new int[] { 0,0,1,1,2,2 };
|
314 |
|
|
float[][] corners = new float[][] { {0.06f,0.20f} };
|
315 |
|
|
int[] cornerIndices = new int[] { 0,0,-1,-1,-1,-1,-1,-1 };
|
316 |
|
|
float[][] centers = new float[][] { { 0.0f,-0.75f,-0.75f} };
|
317 |
|
|
int[] centerIndices = new int[] { 0,0,-1,-1,-1,-1,-1,-1 };
|
318 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
319 |
|
|
}
|
320 |
|
|
}
|
321 |
|
|
|
322 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
323 |
|
|
|
324 |
7b832206
|
Leszek Koltunski
|
public Static4D getQuat(int cubit, int[] numLayers)
|
325 |
29b82486
|
Leszek Koltunski
|
{
|
326 |
|
|
if( mQuats==null ) initializeQuats();
|
327 |
|
|
|
328 |
|
|
switch(cubit)
|
329 |
|
|
{
|
330 |
|
|
case 0: return mQuats[0]; // unit quat
|
331 |
|
|
case 1: return new Static4D( SQ2/2,0,0,SQ2/2); // 90 along X
|
332 |
|
|
case 2: return new Static4D(-SQ2/2,0,0,SQ2/2); // -90 along X
|
333 |
|
|
case 3: return mQuats[1]; // 180 along X
|
334 |
|
|
case 4: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along Y
|
335 |
|
|
case 5: return mQuats[2]; // 180 along Y
|
336 |
|
|
case 6: return mQuats[3]; // 180 along Z
|
337 |
|
|
case 7: return new Static4D(SQ2/2,0,-SQ2/2,0); // 180 along (SQ2/2,0,-SQ2/2)
|
338 |
|
|
|
339 |
|
|
case 8: return mQuats[0];
|
340 |
|
|
case 9: return mQuats[5];
|
341 |
|
|
case 10: return mQuats[3];
|
342 |
|
|
case 11: return mQuats[11];
|
343 |
|
|
case 12: return mQuats[4];
|
344 |
|
|
case 13: return mQuats[7];
|
345 |
|
|
case 14: return mQuats[9];
|
346 |
|
|
case 15: return mQuats[10];
|
347 |
|
|
case 16: return mQuats[2];
|
348 |
|
|
case 17: return mQuats[8];
|
349 |
|
|
case 18: return mQuats[1];
|
350 |
|
|
case 19: return mQuats[6];
|
351 |
|
|
}
|
352 |
|
|
|
353 |
|
|
return null;
|
354 |
|
|
}
|
355 |
|
|
|
356 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
357 |
|
|
|
358 |
e30c522a
|
Leszek Koltunski
|
public int getNumCubitVariants(int[] numLayers)
|
359 |
29b82486
|
Leszek Koltunski
|
{
|
360 |
|
|
return 2;
|
361 |
|
|
}
|
362 |
|
|
|
363 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
364 |
|
|
|
365 |
e30c522a
|
Leszek Koltunski
|
public int getCubitVariant(int cubit, int[] numLayers)
|
366 |
29b82486
|
Leszek Koltunski
|
{
|
367 |
|
|
return cubit<8 ? 0:1;
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
371 |
|
|
|
372 |
a75ae1ee
|
Leszek Koltunski
|
public int getVariantFaceColor(int variant, int face, int[] numLayers)
|
373 |
|
|
{
|
374 |
|
|
return variant;
|
375 |
|
|
}
|
376 |
|
|
|
377 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
378 |
|
|
|
379 |
|
|
public int getCubitFaceColor(int cubit, int face, int[] numLayers)
|
380 |
29b82486
|
Leszek Koltunski
|
{
|
381 |
|
|
if( mFaceMap==null )
|
382 |
|
|
{
|
383 |
|
|
mFaceMap = new int[][]
|
384 |
|
|
{
|
385 |
a75ae1ee
|
Leszek Koltunski
|
{ 4, 2, 0 },
|
386 |
|
|
{ 2, 5, 0 },
|
387 |
|
|
{ 3, 4, 0 },
|
388 |
|
|
{ 5, 3, 0 },
|
389 |
|
|
{ 1, 2, 4 },
|
390 |
|
|
{ 5, 2, 1 },
|
391 |
|
|
{ 4, 3, 1 },
|
392 |
|
|
{ 1, 3, 5 },
|
393 |
|
|
|
394 |
|
|
{ 4, 2,-1 },
|
395 |
|
|
{ 0, 4,-1 },
|
396 |
|
|
{ 4, 3,-1 },
|
397 |
|
|
{ 1, 4,-1 },
|
398 |
|
|
{ 2, 0,-1 },
|
399 |
|
|
{ 3, 0,-1 },
|
400 |
|
|
{ 3, 1,-1 },
|
401 |
|
|
{ 2, 1,-1 },
|
402 |
|
|
{ 5, 2,-1 },
|
403 |
|
|
{ 0, 5,-1 },
|
404 |
|
|
{ 5, 3,-1 },
|
405 |
|
|
{ 1, 5,-1 },
|
406 |
29b82486
|
Leszek Koltunski
|
};
|
407 |
|
|
}
|
408 |
|
|
|
409 |
a75ae1ee
|
Leszek Koltunski
|
return face<3 ? mFaceMap[cubit][face] : -1;
|
410 |
29b82486
|
Leszek Koltunski
|
}
|
411 |
|
|
|
412 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
413 |
|
|
|
414 |
1bb09f88
|
Leszek Koltunski
|
public ObjectSticker retSticker(int sticker)
|
415 |
29b82486
|
Leszek Koltunski
|
{
|
416 |
|
|
if( mStickers==null )
|
417 |
|
|
{
|
418 |
|
|
float[][] STICKERS = new float[][]
|
419 |
|
|
{
|
420 |
|
|
{ -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f },
|
421 |
|
|
{ -0.3125f, 0.4375f, -0.3125f, -0.1875f, 0.0f, -0.5f, 0.3125f, -0.1875f, 0.3125f, 0.4375f }
|
422 |
|
|
};
|
423 |
|
|
|
424 |
|
|
final float R0 = 0.09f;
|
425 |
|
|
final float R1 = 0.06f;
|
426 |
|
|
final float[][] radii = { {R0,R0,R0,R0},{R1,R1,R1,R1,R1} };
|
427 |
8592461c
|
Leszek Koltunski
|
float[] strokes = { 0.09f,0.06f };
|
428 |
|
|
|
429 |
|
|
if( ObjectControl.isInIconMode() )
|
430 |
|
|
{
|
431 |
|
|
float mult = 2.2f;
|
432 |
|
|
strokes[0]*=mult;
|
433 |
|
|
strokes[1]*=mult;
|
434 |
|
|
}
|
435 |
29b82486
|
Leszek Koltunski
|
|
436 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
437 |
|
|
|
438 |
|
|
for(int s=0; s<STICKERS.length; s++)
|
439 |
|
|
{
|
440 |
|
|
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
|
441 |
|
|
}
|
442 |
|
|
}
|
443 |
|
|
|
444 |
1bb09f88
|
Leszek Koltunski
|
return mStickers[sticker];
|
445 |
|
|
}
|
446 |
|
|
|
447 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
448 |
|
|
// PUBLIC API
|
449 |
|
|
|
450 |
|
|
public Static3D[] getRotationAxis()
|
451 |
|
|
{
|
452 |
|
|
return ROT_AXIS;
|
453 |
|
|
}
|
454 |
|
|
|
455 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
456 |
|
|
|
457 |
|
|
public int[] getBasicAngle()
|
458 |
|
|
{
|
459 |
|
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
460 |
|
|
return mBasicAngle;
|
461 |
|
|
}
|
462 |
|
|
|
463 |
61aa85e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
464 |
|
|
|
465 |
a57e6870
|
Leszek Koltunski
|
public ObjectType intGetObjectType(int[] numLayers)
|
466 |
61aa85e4
|
Leszek Koltunski
|
{
|
467 |
8005e762
|
Leszek Koltunski
|
return ObjectType.REDI_3;
|
468 |
61aa85e4
|
Leszek Koltunski
|
}
|
469 |
|
|
|
470 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
471 |
|
|
|
472 |
e26eb4e7
|
Leszek Koltunski
|
public String getObjectName()
|
473 |
29b82486
|
Leszek Koltunski
|
{
|
474 |
e26eb4e7
|
Leszek Koltunski
|
return "Redi Cube";
|
475 |
29b82486
|
Leszek Koltunski
|
}
|
476 |
|
|
|
477 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
478 |
|
|
|
479 |
e26eb4e7
|
Leszek Koltunski
|
public String getInventor()
|
480 |
29b82486
|
Leszek Koltunski
|
{
|
481 |
e26eb4e7
|
Leszek Koltunski
|
return "Oskar van Deventer";
|
482 |
29b82486
|
Leszek Koltunski
|
}
|
483 |
|
|
|
484 |
59c20632
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
485 |
|
|
|
486 |
e26eb4e7
|
Leszek Koltunski
|
public int getYearOfInvention()
|
487 |
59c20632
|
Leszek Koltunski
|
{
|
488 |
|
|
return 2009;
|
489 |
|
|
}
|
490 |
|
|
|
491 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
492 |
|
|
|
493 |
e26eb4e7
|
Leszek Koltunski
|
public int getComplexity()
|
494 |
29b82486
|
Leszek Koltunski
|
{
|
495 |
b4223a92
|
Leszek Koltunski
|
return 1;
|
496 |
29b82486
|
Leszek Koltunski
|
}
|
497 |
|
|
}
|