Revision 4f8cda80
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistyJing.java | ||
---|---|---|
37 | 37 |
|
38 | 38 |
public class TwistyJing extends TwistyObject |
39 | 39 |
{ |
40 |
static final float F = 0.24f; // length of the edge of the corner cubit divided by |
|
41 |
// the length of the edge of the whole tetrahedron. |
|
42 |
// keep < 0.25. |
|
43 |
|
|
44 | 40 |
static final Static3D[] ROT_AXIS = new Static3D[] |
45 | 41 |
{ |
46 | 42 |
new Static3D( 0,-SQ3/3,-SQ6/3), |
... | ... | |
49 | 45 |
new Static3D(-SQ6/3,+SQ3/3, 0), |
50 | 46 |
}; |
51 | 47 |
|
52 |
private static final int[] BASIC_ANGLE = new int[] { 3,3,3,3 }; |
|
53 |
|
|
54 | 48 |
private static final int[] FACE_COLORS = new int[] |
55 | 49 |
{ |
56 | 50 |
COLOR_GREEN , COLOR_YELLOW, |
57 | 51 |
COLOR_BLUE , COLOR_RED |
58 | 52 |
}; |
59 | 53 |
|
60 |
private static final int[] ROT_QUAT = {0,1,2,7,0,2,7,6,3,10,0,1,3,5}; |
|
61 |
|
|
62 |
// computed with res/raw/compute_quats.c |
|
63 |
private static final Static4D[] QUATS = new Static4D[] |
|
64 |
{ |
|
65 |
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f), |
|
66 |
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f), |
|
67 |
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f), |
|
68 |
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f), |
|
69 |
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f), |
|
70 |
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f), |
|
71 |
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f), |
|
72 |
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f), |
|
73 |
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f), |
|
74 |
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f), |
|
75 |
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f), |
|
76 |
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f) |
|
77 |
}; |
|
78 |
|
|
79 |
static final float[][] CENTERS = new float[][] |
|
80 |
{ |
|
81 |
{ 0.000f, -SQ2/4, 0.500f }, |
|
82 |
{ 0.000f, -SQ2/4,-0.500f }, |
|
83 |
{-0.500f, SQ2/4, 0.000f }, |
|
84 |
{ 0.500f, SQ2/4, 0.000f }, |
|
85 |
|
|
86 |
{ 0.000f, -SQ2/4, 0.000f }, |
|
87 |
{-0.250f, 0.000f, 0.250f }, |
|
88 |
{ 0.250f, 0.000f, 0.250f }, |
|
89 |
{-0.250f, 0.000f,-0.250f }, |
|
90 |
{ 0.250f, 0.000f,-0.250f }, |
|
91 |
{ 0.000f, SQ2/4, 0.000f }, |
|
92 |
|
|
93 |
{ 0.000f, SQ2/12, 1.0f/6 }, |
|
94 |
{ 0.000f, SQ2/12,-1.0f/6 }, |
|
95 |
{-1.0f/6,-SQ2/12, 0.000f }, |
|
96 |
{ 1.0f/6,-SQ2/12, 0.000f }, |
|
97 |
}; |
|
98 |
|
|
99 |
// Colors of the faces of cubits. |
|
100 |
// GREEN 0 YELLOW 1 BLUE 2 RED 3 |
|
101 |
// GREEN 4 YELLOW 5 BLUE 6 RED 7 |
|
102 |
// GREEN 8 YELLOW 9 BLUE 10 RED 11 |
|
103 |
private static final int[][] mFaceMap = new int[][] |
|
104 |
{ |
|
105 |
{ 0, 3, 2, 12, 12, 12 }, |
|
106 |
{ 1, 2, 3, 12, 12, 12 }, |
|
107 |
{ 1, 0, 2, 12, 12, 12 }, |
|
108 |
{ 1, 3, 0, 12, 12, 12 }, |
|
109 |
|
|
110 |
{ 7, 6, 12, 12, 12, 12 }, |
|
111 |
{ 4, 6, 12, 12, 12, 12 }, |
|
112 |
{ 7, 4, 12, 12, 12, 12 }, |
|
113 |
{ 5, 6, 12, 12, 12, 12 }, |
|
114 |
{ 7, 5, 12, 12, 12, 12 }, |
|
115 |
{ 4, 5, 12, 12, 12, 12 }, |
|
116 |
|
|
117 |
{ 8, 12, 12, 12, 12, 12 }, |
|
118 |
{ 9, 12, 12, 12, 12, 12 }, |
|
119 |
{ 10, 12, 12, 12, 12, 12 }, |
|
120 |
{ 11, 12, 12, 12, 12, 12 }, |
|
121 |
}; |
|
122 |
|
|
123 |
private static final float X = F/2; |
|
124 |
private static final float Y = F*SQ2/2; |
|
125 |
private static final float Z =-F/2; |
|
126 |
private static final float L = (1-3*F); |
|
127 |
private static final float X2= L/2; |
|
128 |
private static final float Y2= L*SQ2/2; |
|
129 |
private static final float Z2=-L/2; |
|
130 |
private static final float D = F/L; |
|
131 |
|
|
132 |
private static final double[][] VERTICES_CORNER = new double[][] |
|
133 |
{ |
|
134 |
{ 0.0, 0.0, 0.0 }, |
|
135 |
{ X, Y, Z }, |
|
136 |
{ 0.0, 2*Y, 2*Z }, |
|
137 |
{ -X, Y, Z }, |
|
138 |
{ 0.0, 0.0, -F }, |
|
139 |
{ X, Y, Z-F }, |
|
140 |
{ 0.0, 2*Y, 2*Z-F }, |
|
141 |
{ -X, Y, Z-F }, |
|
142 |
}; |
|
143 |
|
|
144 |
private static final int[][] VERT_INDEXES_CORNER = new int[][] |
|
145 |
{ |
|
146 |
{0,1,2,3}, |
|
147 |
{1,0,4,5}, |
|
148 |
{7,4,0,3}, |
|
149 |
{1,5,6,2}, |
|
150 |
{7,3,2,6}, |
|
151 |
{4,7,6,5} |
|
152 |
}; |
|
153 |
|
|
154 |
private static final double[][] VERTICES_EDGE = new double[][] |
|
155 |
{ |
|
156 |
{ 0.0, 0.0, 0.5-F }, |
|
157 |
{ X, Y, Z+0.5-F }, |
|
158 |
{ 0.0, 2*Y, 2*Z+0.5-F }, |
|
159 |
{ -X, Y, Z+0.5-F }, |
|
160 |
{ 0.0, 0.0, -0.5+F }, |
|
161 |
{ X, Y, -Z-0.5+F }, |
|
162 |
{ 0.0, 2*Y,-2*Z-0.5+F }, |
|
163 |
{ -X, Y, -Z-0.5+F }, |
|
164 |
}; |
|
165 |
|
|
166 |
private static final int[][] VERT_INDEXES_EDGE = new int[][] |
|
167 |
{ |
|
168 |
{0,4,5,1}, |
|
169 |
{3,7,4,0}, |
|
170 |
{0,1,2,3}, |
|
171 |
{4,7,6,5}, |
|
172 |
{1,5,6,2}, |
|
173 |
{2,6,7,3} |
|
174 |
}; |
|
175 |
|
|
176 |
private static final double[][] VERTICES_FACE = new double[][] |
|
177 |
{ |
|
178 |
{ 0.0, -2*Y2/3, -2*Z2/3 }, |
|
179 |
{ X2, Y2/3, Z2/3 }, |
|
180 |
{ -X2, Y2/3, Z2/3 }, |
|
181 |
{ 0.0, -2*Y2/3,-2*Z2/3+2*D*Z2 }, |
|
182 |
{ X2-D*X2, Y2/3-D*Y2, Z2/3+D*Z2 }, |
|
183 |
{ -X2+D*X2, Y2/3-D*Y2, Z2/3+D*Z2 }, |
|
184 |
}; |
|
185 |
|
|
186 |
private static final int[][] VERT_INDEXES_FACE = new int[][] |
|
187 |
{ |
|
188 |
{0,1,2}, |
|
189 |
{3,5,4}, |
|
190 |
{0,3,4,1}, |
|
191 |
{5,3,0,2}, |
|
192 |
{4,5,2,1} |
|
193 |
}; |
|
194 |
|
|
195 |
private static final float[][] STICKERS = new float[][] |
|
196 |
{ |
|
197 |
{ 0.0f, -0.5f, 0.28867516f, 0.0f, 0.0f, 0.5f, -0.28867516f, 0.0f }, |
|
198 |
{ -0.5f, 0.11983269f, 0.27964598f, -0.43146032f, 0.3200817f, 0.007388768f, -0.09972769f, 0.30423886f }, |
|
199 |
{ 0.0f, -0.5f, 0.43301272f, 0.25f, -0.43301272f, 0.25f }, |
|
200 |
}; |
|
201 |
|
|
202 |
private static final ObjectSticker[] mStickers; |
|
203 |
|
|
204 |
static |
|
205 |
{ |
|
206 |
mStickers = new ObjectSticker[STICKERS.length]; |
|
207 |
final float R1 = 0.05f; |
|
208 |
final float R2 = 0.10f; |
|
209 |
final float R3 = 0.03f; |
|
210 |
final float[][] radii = { { R1,R1,R1,R1 },{ R3,R3,R2,R2 },{ R1,R1,R1 } }; |
|
211 |
final float[] strokes = { 0.06f, 0.03f, 0.05f }; |
|
212 |
|
|
213 |
for(int s=0; s<STICKERS.length; s++) |
|
214 |
{ |
|
215 |
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]); |
|
216 |
} |
|
217 |
} |
|
54 |
static final float F = 0.24f; // length of the edge of the corner cubit divided by |
|
55 |
// the length of the edge of the whole tetrahedron. |
|
56 |
// keep < 0.25. |
|
218 | 57 |
|
219 | 58 |
private int mCurrState; |
220 | 59 |
private int mIndexExcluded; |
221 | 60 |
private final ScrambleState[] mStates; |
222 | 61 |
private int[][] mScrambleTable; |
223 | 62 |
private int[] mNumOccurences; |
63 |
private int[] mBasicAngle; |
|
64 |
private int[] mRotQuat; |
|
65 |
private Static4D[] mQuats; |
|
66 |
private float[][] mCenters; |
|
67 |
private int[][] mFaceMap; |
|
68 |
private ObjectSticker[] mStickers; |
|
224 | 69 |
|
225 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
226 | 71 |
|
... | ... | |
237 | 82 |
}; |
238 | 83 |
} |
239 | 84 |
|
85 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
86 |
|
|
87 |
private void initializeQuats() |
|
88 |
{ |
|
89 |
mQuats = new Static4D[] |
|
90 |
{ |
|
91 |
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f), |
|
92 |
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f), |
|
93 |
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f), |
|
94 |
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f), |
|
95 |
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f), |
|
96 |
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f), |
|
97 |
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f), |
|
98 |
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f), |
|
99 |
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f), |
|
100 |
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f), |
|
101 |
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f), |
|
102 |
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f) |
|
103 |
}; |
|
104 |
} |
|
105 |
|
|
240 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
241 | 107 |
|
242 | 108 |
int[] getSolvedQuats(int cubit, int numLayers) |
243 | 109 |
{ |
110 |
if( mQuats==null ) initializeQuats(); |
|
244 | 111 |
int status = retCubitSolvedStatus(cubit,numLayers); |
245 |
return status<0 ? null : buildSolvedQuats(MovementJing.FACE_AXIS[status],QUATS);
|
|
112 |
return status<0 ? null : buildSolvedQuats(MovementJing.FACE_AXIS[status],mQuats);
|
|
246 | 113 |
} |
247 | 114 |
|
248 | 115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
249 | 116 |
|
250 | 117 |
float[][] getCubitPositions(int size) |
251 | 118 |
{ |
252 |
return CENTERS; |
|
119 |
if( mCenters==null ) |
|
120 |
{ |
|
121 |
mCenters = new float[][] |
|
122 |
{ |
|
123 |
{ 0.000f, -SQ2/4, 0.500f }, |
|
124 |
{ 0.000f, -SQ2/4,-0.500f }, |
|
125 |
{-0.500f, SQ2/4, 0.000f }, |
|
126 |
{ 0.500f, SQ2/4, 0.000f }, |
|
127 |
|
|
128 |
{ 0.000f, -SQ2/4, 0.000f }, |
|
129 |
{-0.250f, 0.000f, 0.250f }, |
|
130 |
{ 0.250f, 0.000f, 0.250f }, |
|
131 |
{-0.250f, 0.000f,-0.250f }, |
|
132 |
{ 0.250f, 0.000f,-0.250f }, |
|
133 |
{ 0.000f, SQ2/4, 0.000f }, |
|
134 |
|
|
135 |
{ 0.000f, SQ2/12, 1.0f/6 }, |
|
136 |
{ 0.000f, SQ2/12,-1.0f/6 }, |
|
137 |
{-1.0f/6,-SQ2/12, 0.000f }, |
|
138 |
{ 1.0f/6,-SQ2/12, 0.000f }, |
|
139 |
}; |
|
140 |
} |
|
141 |
|
|
142 |
return mCenters; |
|
253 | 143 |
} |
254 | 144 |
|
255 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
256 | 146 |
|
257 | 147 |
Static4D[] getQuats() |
258 | 148 |
{ |
259 |
return QUATS; |
|
149 |
if( mQuats==null ) initializeQuats(); |
|
150 |
return mQuats; |
|
260 | 151 |
} |
261 | 152 |
|
262 | 153 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
277 | 168 |
|
278 | 169 |
int getNumStickerTypes(int numLayers) |
279 | 170 |
{ |
280 |
return STICKERS.length;
|
|
171 |
return 3;
|
|
281 | 172 |
} |
282 | 173 |
|
283 | 174 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
313 | 204 |
|
314 | 205 |
int getFaceColor(int cubit, int cubitface, int size) |
315 | 206 |
{ |
207 |
if( mFaceMap==null ) |
|
208 |
{ |
|
209 |
// Colors of the faces of cubits. |
|
210 |
// GREEN 0 YELLOW 1 BLUE 2 RED 3 |
|
211 |
// GREEN 4 YELLOW 5 BLUE 6 RED 7 |
|
212 |
// GREEN 8 YELLOW 9 BLUE 10 RED 11 |
|
213 |
mFaceMap = new int[][] |
|
214 |
{ |
|
215 |
{ 0, 3, 2, 12, 12, 12 }, |
|
216 |
{ 1, 2, 3, 12, 12, 12 }, |
|
217 |
{ 1, 0, 2, 12, 12, 12 }, |
|
218 |
{ 1, 3, 0, 12, 12, 12 }, |
|
219 |
|
|
220 |
{ 7, 6, 12, 12, 12, 12 }, |
|
221 |
{ 4, 6, 12, 12, 12, 12 }, |
|
222 |
{ 7, 4, 12, 12, 12, 12 }, |
|
223 |
{ 5, 6, 12, 12, 12, 12 }, |
|
224 |
{ 7, 5, 12, 12, 12, 12 }, |
|
225 |
{ 4, 5, 12, 12, 12, 12 }, |
|
226 |
|
|
227 |
{ 8, 12, 12, 12, 12, 12 }, |
|
228 |
{ 9, 12, 12, 12, 12, 12 }, |
|
229 |
{ 10, 12, 12, 12, 12, 12 }, |
|
230 |
{ 11, 12, 12, 12, 12, 12 }, |
|
231 |
}; |
|
232 |
} |
|
233 |
|
|
316 | 234 |
return mFaceMap[cubit][cubitface]; |
317 | 235 |
} |
318 | 236 |
|
... | ... | |
322 | 240 |
{ |
323 | 241 |
int variant = getCubitVariant(cubit,numLayers); |
324 | 242 |
|
243 |
final float X = F/2; |
|
244 |
final float Y = F*SQ2/2; |
|
245 |
final float Z =-F/2; |
|
246 |
final float L = (1-3*F); |
|
247 |
final float X2= L/2; |
|
248 |
final float Y2= L*SQ2/2; |
|
249 |
final float Z2=-L/2; |
|
250 |
final float D = F/L; |
|
251 |
|
|
325 | 252 |
if( variant==0 ) |
326 | 253 |
{ |
254 |
double[][] vertices = new double[][] |
|
255 |
{ |
|
256 |
{ 0.0, 0.0, 0.0 }, |
|
257 |
{ X, Y, Z }, |
|
258 |
{ 0.0, 2*Y, 2*Z }, |
|
259 |
{ -X, Y, Z }, |
|
260 |
{ 0.0, 0.0, -F }, |
|
261 |
{ X, Y, Z-F }, |
|
262 |
{ 0.0, 2*Y, 2*Z-F }, |
|
263 |
{ -X, Y, Z-F }, |
|
264 |
}; |
|
265 |
int[][] vert_indices = new int[][] |
|
266 |
{ |
|
267 |
{0,1,2,3}, |
|
268 |
{1,0,4,5}, |
|
269 |
{7,4,0,3}, |
|
270 |
{1,5,6,2}, |
|
271 |
{7,3,2,6}, |
|
272 |
{4,7,6,5} |
|
273 |
}; |
|
274 |
|
|
327 | 275 |
float[][] bands = new float[][] { {0.015f,35,0.5f*F,F,5,1,1},{0.001f,35,0.5f*F,F,5,1,1} }; |
328 | 276 |
int[] bandIndices = new int[] { 0,0,0,1,1,1 }; |
329 | 277 |
float[][] corners = new float[][] { {0.08f,0.20f*F},{0.07f,0.20f*F} }; |
330 | 278 |
int[] cornerIndices = new int[] { 0,1,1,-1,1,-1,-1,-1 }; |
331 | 279 |
float[][] centers = new float[][] { { 0.0f, F*SQ2/2, -F} }; |
332 | 280 |
int[] centerIndices = new int[] { 0,0,0,-1,0,-1,-1,-1 }; |
333 |
return new ObjectShape(VERTICES_CORNER,VERT_INDEXES_CORNER,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
|
281 |
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
|
334 | 282 |
} |
335 | 283 |
else if( variant==1 ) |
336 | 284 |
{ |
285 |
double[][] vertices = new double[][] |
|
286 |
{ |
|
287 |
{ 0.0, 0.0, 0.5-F }, |
|
288 |
{ X, Y, Z+0.5-F }, |
|
289 |
{ 0.0, 2*Y, 2*Z+0.5-F }, |
|
290 |
{ -X, Y, Z+0.5-F }, |
|
291 |
{ 0.0, 0.0, -0.5+F }, |
|
292 |
{ X, Y, -Z-0.5+F }, |
|
293 |
{ 0.0, 2*Y,-2*Z-0.5+F }, |
|
294 |
{ -X, Y, -Z-0.5+F }, |
|
295 |
}; |
|
296 |
int[][] vert_indices = new int[][] |
|
297 |
{ |
|
298 |
{0,4,5,1}, |
|
299 |
{3,7,4,0}, |
|
300 |
{0,1,2,3}, |
|
301 |
{4,7,6,5}, |
|
302 |
{1,5,6,2}, |
|
303 |
{2,6,7,3} |
|
304 |
}; |
|
305 |
|
|
337 | 306 |
float[][] bands = new float[][] { {0.015f,35,0.5f*F,F,5,1,1},{0.001f,35,0.5f*F,F,5,1,1} }; |
338 | 307 |
int[] bandIndices = new int[] { 0,0,1,1,1,1 }; |
339 | 308 |
float[][] corners = new float[][] { {0.07f,0.20f*F} }; |
340 | 309 |
int[] cornerIndices = new int[] { 0,0,-1,0,0,0,-1,0 }; |
341 | 310 |
float[][] centers = new float[][] { { 0, F*SQ2/2, 0 } }; |
342 | 311 |
int[] centerIndices = new int[] { 0,0,-1,0,0,0,-1,0 }; |
343 |
return new ObjectShape(VERTICES_EDGE,VERT_INDEXES_EDGE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
|
312 |
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
|
344 | 313 |
} |
345 | 314 |
else |
346 | 315 |
{ |
316 |
double[][] vertices = new double[][] |
|
317 |
{ |
|
318 |
{ 0.0, -2*Y2/3, -2*Z2/3 }, |
|
319 |
{ X2, Y2/3, Z2/3 }, |
|
320 |
{ -X2, Y2/3, Z2/3 }, |
|
321 |
{ 0.0, -2*Y2/3,-2*Z2/3+2*D*Z2 }, |
|
322 |
{ X2-D*X2, Y2/3-D*Y2, Z2/3+D*Z2 }, |
|
323 |
{ -X2+D*X2, Y2/3-D*Y2, Z2/3+D*Z2 }, |
|
324 |
}; |
|
325 |
int[][] vert_indices = new int[][] |
|
326 |
{ |
|
327 |
{0,1,2}, |
|
328 |
{3,5,4}, |
|
329 |
{0,3,4,1}, |
|
330 |
{5,3,0,2}, |
|
331 |
{4,5,2,1} |
|
332 |
}; |
|
333 |
|
|
347 | 334 |
float[][] bands = new float[][] { {0.020f,35,0.20f*(1-3*F),0.6f*(1-3*F),5,1,1}, {0.001f,35,0.05f*(1-3*F),0.1f*(1-3*F),5,1,1} }; |
348 | 335 |
int[] bandIndices = new int[] { 0,1,1,1,1,1 }; |
349 | 336 |
float[][] corners = new float[][] { {0.04f,0.15f} }; |
350 | 337 |
int[] cornerIndices = new int[] { 0,0,0,-1,-1,-1 }; |
351 | 338 |
float[][] centers = new float[][] { { 0, -2*Y/3, 4*Z/3 } }; |
352 | 339 |
int[] centerIndices = new int[] { 0,0,0,-1,-1,-1 }; |
353 |
return new ObjectShape(VERTICES_FACE,VERT_INDEXES_FACE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
|
340 |
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
|
354 | 341 |
} |
355 | 342 |
} |
356 | 343 |
|
... | ... | |
358 | 345 |
|
359 | 346 |
Static4D getQuat(int cubit, int numLayers) |
360 | 347 |
{ |
361 |
return QUATS[ROT_QUAT[cubit]]; |
|
348 |
if( mQuats==null ) initializeQuats(); |
|
349 |
if( mRotQuat ==null ) mRotQuat = new int[] {0,1,2,7,0,2,7,6,3,10,0,1,3,5}; |
|
350 |
return mQuats[mRotQuat[cubit]]; |
|
362 | 351 |
} |
363 | 352 |
|
364 | 353 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
386 | 375 |
|
387 | 376 |
ObjectSticker retSticker(int face) |
388 | 377 |
{ |
378 |
if( mStickers==null ) |
|
379 |
{ |
|
380 |
float[][] STICKERS = new float[][] |
|
381 |
{ |
|
382 |
{ 0.0f, -0.5f, 0.28867516f, 0.0f, 0.0f, 0.5f, -0.28867516f, 0.0f }, |
|
383 |
{ -0.5f, 0.11983269f, 0.27964598f, -0.43146032f, 0.3200817f, 0.007388768f, -0.09972769f, 0.30423886f }, |
|
384 |
{ 0.0f, -0.5f, 0.43301272f, 0.25f, -0.43301272f, 0.25f }, |
|
385 |
}; |
|
386 |
|
|
387 |
mStickers = new ObjectSticker[STICKERS.length]; |
|
388 |
final float R1 = 0.05f; |
|
389 |
final float R2 = 0.10f; |
|
390 |
final float R3 = 0.03f; |
|
391 |
final float[][] radii = { { R1,R1,R1,R1 },{ R3,R3,R2,R2 },{ R1,R1,R1 } }; |
|
392 |
final float[] strokes = { 0.06f, 0.03f, 0.05f }; |
|
393 |
|
|
394 |
for(int s=0; s<STICKERS.length; s++) |
|
395 |
{ |
|
396 |
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]); |
|
397 |
} |
|
398 |
} |
|
399 |
|
|
389 | 400 |
return mStickers[face/NUM_FACES]; |
390 | 401 |
} |
391 | 402 |
|
... | ... | |
457 | 468 |
|
458 | 469 |
public int[] getBasicAngle() |
459 | 470 |
{ |
460 |
return BASIC_ANGLE; |
|
471 |
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 }; |
|
472 |
return mBasicAngle; |
|
461 | 473 |
} |
462 | 474 |
|
463 | 475 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Remove statics from the Jing class.