|
1 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
2 |
// Copyright 2022 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 |
import java.io.InputStream;
|
|
23 |
|
|
24 |
import org.distorted.library.type.Static3D;
|
|
25 |
import org.distorted.library.type.Static4D;
|
|
26 |
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
|
27 |
import org.distorted.objectlib.helpers.ObjectShape;
|
|
28 |
import org.distorted.objectlib.helpers.ObjectSignature;
|
|
29 |
import org.distorted.objectlib.main.ObjectType;
|
|
30 |
import org.distorted.objectlib.main.ShapeHexahedron;
|
|
31 |
import org.distorted.objectlib.scrambling.ScrambleState;
|
|
32 |
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
|
|
33 |
|
|
34 |
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
|
|
35 |
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
|
|
36 |
|
|
37 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
38 |
|
|
39 |
public class TwistyCrazy extends ShapeHexahedron
|
|
40 |
{
|
|
41 |
private static final float DIAMETER_RATIO = 0.75f;
|
|
42 |
private static final int NUMBER_CORNER_SEGMENTS = 4;
|
|
43 |
private static final int NUMBER_EDGE_SEGMENTS = 4;
|
|
44 |
|
|
45 |
static final Static3D[] ROT_AXIS = new Static3D[]
|
|
46 |
{
|
|
47 |
new Static3D(1,0,0),
|
|
48 |
new Static3D(0,1,0),
|
|
49 |
new Static3D(0,0,1)
|
|
50 |
};
|
|
51 |
|
|
52 |
private ScrambleState[] mStates;
|
|
53 |
private int[][] mBasicAngle;
|
|
54 |
private float[][] mCuts;
|
|
55 |
private float[][] mPositions;
|
|
56 |
private int[] mQuatIndex;
|
|
57 |
|
|
58 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
59 |
|
|
60 |
public TwistyCrazy(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
|
61 |
{
|
|
62 |
super(numL, meshState, iconMode, numL[0], quat, move, scale, stream);
|
|
63 |
}
|
|
64 |
|
|
65 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
66 |
/*
|
|
67 |
@Override
|
|
68 |
public void adjustStickerCoords()
|
|
69 |
{
|
|
70 |
final float A = 0.497f;
|
|
71 |
final float B = 0.38950402f;
|
|
72 |
final float C = 0.25900806f;
|
|
73 |
final float D = 0.51f;
|
|
74 |
|
|
75 |
mStickerCoords = new float[][]
|
|
76 |
{
|
|
77 |
{ -0.5f, -0.5f, A, -0.5f, -0.5f, A },
|
|
78 |
{ -C, -B, D, -B, D, B, -C, B }
|
|
79 |
};
|
|
80 |
}
|
|
81 |
*/
|
|
82 |
|
|
83 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
84 |
// Normal 3x3
|
|
85 |
|
|
86 |
public ScrambleState[] getScrambleStates()
|
|
87 |
{
|
|
88 |
if( mStates==null )
|
|
89 |
{
|
|
90 |
int[][] m = new int[16][];
|
|
91 |
|
|
92 |
for(int i=0; i<16; i++) m[i] = new int[] { 0,-1,i,0,1,i,0,2,i, 1,-1,i,1,1,i,1,2,i, 2,-1,i,2,1,i,2,2,i};
|
|
93 |
|
|
94 |
mStates = new ScrambleState[]
|
|
95 |
{
|
|
96 |
new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ), // 0 0
|
|
97 |
new ScrambleState( new int[][] { null, m[ 4], m[ 5] } ), // 1 x
|
|
98 |
new ScrambleState( new int[][] { m[ 6], null, m[ 7] } ), // 2 y
|
|
99 |
new ScrambleState( new int[][] { m[ 8], m[ 9], null } ), // 3 z
|
|
100 |
new ScrambleState( new int[][] { m[10], null, m[ 7] } ), // 4 xy
|
|
101 |
new ScrambleState( new int[][] { m[11], m[ 9], null } ), // 5 xz
|
|
102 |
new ScrambleState( new int[][] { null, m[12], m[ 5] } ), // 6 yx
|
|
103 |
new ScrambleState( new int[][] { m[ 8], m[13], null } ), // 7 yz
|
|
104 |
new ScrambleState( new int[][] { null, m[ 4], m[14] } ), // 8 zx
|
|
105 |
new ScrambleState( new int[][] { m[ 6], null, m[15] } ), // 9 zy
|
|
106 |
new ScrambleState( new int[][] { null, null, m[ 5] } ), // 10 xyx
|
|
107 |
new ScrambleState( new int[][] { null, m[ 4], null } ), // 11 xzx
|
|
108 |
new ScrambleState( new int[][] { null, null, m[ 7] } ), // 12 yxy
|
|
109 |
new ScrambleState( new int[][] { m[ 6], null, null } ), // 13 yzy
|
|
110 |
new ScrambleState( new int[][] { null, m[ 9], null } ), // 14 zxz
|
|
111 |
new ScrambleState( new int[][] { m[ 8], null, null } ), // 15 zyz
|
|
112 |
};
|
|
113 |
}
|
|
114 |
|
|
115 |
return mStates;
|
|
116 |
}
|
|
117 |
|
|
118 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
119 |
|
|
120 |
public float[][] getCuts(int[] numLayers)
|
|
121 |
{
|
|
122 |
if( mCuts==null )
|
|
123 |
{
|
|
124 |
float C = 0.5f;
|
|
125 |
float[] cut = new float[] {-C,+C};
|
|
126 |
mCuts = new float[][] { cut,cut,cut };
|
|
127 |
}
|
|
128 |
|
|
129 |
return mCuts;
|
|
130 |
}
|
|
131 |
|
|
132 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
133 |
|
|
134 |
public boolean[][] getLayerRotatable(int[] numLayers)
|
|
135 |
{
|
|
136 |
boolean[] tmp = new boolean[] {true,true,true};
|
|
137 |
return new boolean[][] { tmp,tmp,tmp };
|
|
138 |
}
|
|
139 |
|
|
140 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
141 |
|
|
142 |
public int getTouchControlType()
|
|
143 |
{
|
|
144 |
return TC_HEXAHEDRON;
|
|
145 |
}
|
|
146 |
|
|
147 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
148 |
|
|
149 |
public int getTouchControlSplit()
|
|
150 |
{
|
|
151 |
return TYPE_NOT_SPLIT;
|
|
152 |
}
|
|
153 |
|
|
154 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
155 |
|
|
156 |
public int[][][] getEnabled()
|
|
157 |
{
|
|
158 |
return new int[][][] { {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}} };
|
|
159 |
}
|
|
160 |
|
|
161 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
162 |
|
|
163 |
public float[] getDist3D(int[] numLayers)
|
|
164 |
{
|
|
165 |
return TouchControlHexahedron.D3D;
|
|
166 |
}
|
|
167 |
|
|
168 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
169 |
|
|
170 |
public Static3D[] getFaceAxis()
|
|
171 |
{
|
|
172 |
return TouchControlHexahedron.FACE_AXIS;
|
|
173 |
}
|
|
174 |
|
|
175 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
176 |
|
|
177 |
public float[][] getCubitPositions(int[] numLayers)
|
|
178 |
{
|
|
179 |
if( mPositions==null )
|
|
180 |
{
|
|
181 |
mPositions = new float[][]
|
|
182 |
{
|
|
183 |
{ 1.0f, 1.0f, 1.0f},
|
|
184 |
{ 1.0f, 1.0f,-1.0f},
|
|
185 |
{ 1.0f,-1.0f, 1.0f},
|
|
186 |
{ 1.0f,-1.0f,-1.0f},
|
|
187 |
{-1.0f, 1.0f, 1.0f},
|
|
188 |
{-1.0f, 1.0f,-1.0f},
|
|
189 |
{-1.0f,-1.0f, 1.0f},
|
|
190 |
{-1.0f,-1.0f,-1.0f},
|
|
191 |
|
|
192 |
{ 1.0f, 1.0f, 0.0f},
|
|
193 |
{ 1.0f,-1.0f, 0.0f},
|
|
194 |
{ 1.0f, 0.0f, 1.0f},
|
|
195 |
{ 1.0f, 0.0f,-1.0f},
|
|
196 |
{-1.0f, 1.0f, 0.0f},
|
|
197 |
{-1.0f,-1.0f, 0.0f},
|
|
198 |
{-1.0f, 0.0f, 1.0f},
|
|
199 |
{-1.0f, 0.0f,-1.0f},
|
|
200 |
{ 0.0f, 1.0f, 1.0f},
|
|
201 |
{ 0.0f, 1.0f,-1.0f},
|
|
202 |
{ 0.0f,-1.0f, 1.0f},
|
|
203 |
{ 0.0f,-1.0f,-1.0f},
|
|
204 |
|
|
205 |
{ 0.0f, 0.0f, 0.0f},
|
|
206 |
{ 0.0f, 0.0f, 0.0f},
|
|
207 |
{ 0.0f, 0.0f, 0.0f},
|
|
208 |
{ 0.0f, 0.0f, 0.0f},
|
|
209 |
{ 0.0f, 0.0f, 0.0f},
|
|
210 |
{ 0.0f, 0.0f, 0.0f},
|
|
211 |
|
|
212 |
{ 0.0f, 1.0f, 0.0f},
|
|
213 |
{ 0.0f, 1.0f, 0.0f},
|
|
214 |
{ 0.0f, 1.0f, 0.0f},
|
|
215 |
{ 0.0f, 1.0f, 0.0f},
|
|
216 |
{ 0.0f,-1.0f, 0.0f},
|
|
217 |
{ 0.0f,-1.0f, 0.0f},
|
|
218 |
{ 0.0f,-1.0f, 0.0f},
|
|
219 |
{ 0.0f,-1.0f, 0.0f},
|
|
220 |
{ 0.0f, 0.0f, 1.0f},
|
|
221 |
{ 0.0f, 0.0f, 1.0f},
|
|
222 |
{ 0.0f, 0.0f, 1.0f},
|
|
223 |
{ 0.0f, 0.0f, 1.0f},
|
|
224 |
{ 0.0f, 0.0f,-1.0f},
|
|
225 |
{ 0.0f, 0.0f,-1.0f},
|
|
226 |
{ 0.0f, 0.0f,-1.0f},
|
|
227 |
{ 0.0f, 0.0f,-1.0f},
|
|
228 |
{ 1.0f, 0.0f, 0.0f},
|
|
229 |
{ 1.0f, 0.0f, 0.0f},
|
|
230 |
{ 1.0f, 0.0f, 0.0f},
|
|
231 |
{ 1.0f, 0.0f, 0.0f},
|
|
232 |
{-1.0f, 0.0f, 0.0f},
|
|
233 |
{-1.0f, 0.0f, 0.0f},
|
|
234 |
{-1.0f, 0.0f, 0.0f},
|
|
235 |
{-1.0f, 0.0f, 0.0f},
|
|
236 |
|
|
237 |
{ 1.0f, 1.0f, 0.0f},
|
|
238 |
{ 1.0f, 1.0f, 0.0f},
|
|
239 |
{ 1.0f,-1.0f, 0.0f},
|
|
240 |
{ 1.0f,-1.0f, 0.0f},
|
|
241 |
{ 1.0f, 0.0f, 1.0f},
|
|
242 |
{ 1.0f, 0.0f, 1.0f},
|
|
243 |
{ 1.0f, 0.0f,-1.0f},
|
|
244 |
{ 1.0f, 0.0f,-1.0f},
|
|
245 |
{-1.0f, 1.0f, 0.0f},
|
|
246 |
{-1.0f, 1.0f, 0.0f},
|
|
247 |
{-1.0f,-1.0f, 0.0f},
|
|
248 |
{-1.0f,-1.0f, 0.0f},
|
|
249 |
{-1.0f, 0.0f, 1.0f},
|
|
250 |
{-1.0f, 0.0f, 1.0f},
|
|
251 |
{-1.0f, 0.0f,-1.0f},
|
|
252 |
{-1.0f, 0.0f,-1.0f},
|
|
253 |
{ 0.0f, 1.0f, 1.0f},
|
|
254 |
{ 0.0f, 1.0f, 1.0f},
|
|
255 |
{ 0.0f, 1.0f,-1.0f},
|
|
256 |
{ 0.0f, 1.0f,-1.0f},
|
|
257 |
{ 0.0f,-1.0f, 1.0f},
|
|
258 |
{ 0.0f,-1.0f, 1.0f},
|
|
259 |
{ 0.0f,-1.0f,-1.0f},
|
|
260 |
{ 0.0f,-1.0f,-1.0f},
|
|
261 |
};
|
|
262 |
}
|
|
263 |
|
|
264 |
return mPositions;
|
|
265 |
}
|
|
266 |
|
|
267 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
268 |
|
|
269 |
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
|
270 |
{
|
|
271 |
if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
|
|
272 |
6,17,7,12,4,16,9,10,0,5,3,2,
|
|
273 |
0,2,1,3,6,4,
|
|
274 |
0,4,5,6, 2,8,16,17, 3,14,20,21, 1,10,11,12, 7,13,18,22, 9,15,19,23,
|
|
275 |
0,18,2,7, 3,13,1,22, 5,9,8,19, 14,23,11,15, 4,21,6,10, 17,20,12,16 };
|
|
276 |
return mObjectQuats[mQuatIndex[cubit]];
|
|
277 |
}
|
|
278 |
|
|
279 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
280 |
|
|
281 |
private ObjectShape getCornerShape()
|
|
282 |
{
|
|
283 |
final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
|
|
284 |
final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
|
|
285 |
final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
|
|
286 |
final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
|
|
287 |
final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
|
|
288 |
float[][] tmp = new float[SINGLE_ARC][2];
|
|
289 |
|
|
290 |
for(int i=0; i<SINGLE_ARC; i++)
|
|
291 |
{
|
|
292 |
float alpha = INIT_ALPHA + i*STEP_CORNER;
|
|
293 |
tmp[i][0] = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
|
|
294 |
tmp[i][1] = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
|
|
295 |
}
|
|
296 |
|
|
297 |
float[][] vertices = new float[NUM_VERTICES][];
|
|
298 |
|
|
299 |
vertices[0] = new float[] { +0.5f, +0.5f, +0.5f };
|
|
300 |
vertices[1] = new float[] { -0.5f, +0.5f, +0.5f };
|
|
301 |
vertices[2] = new float[] { +0.5f, -0.5f, +0.5f };
|
|
302 |
vertices[3] = new float[] { +0.5f, +0.5f, -0.5f };
|
|
303 |
|
|
304 |
for(int i=0; i<SINGLE_ARC; i++)
|
|
305 |
{
|
|
306 |
float s = tmp[i][0];
|
|
307 |
float c = tmp[i][1];
|
|
308 |
|
|
309 |
vertices[4 +i] = new float[] {0.5f,+s,+c};
|
|
310 |
vertices[4+ SINGLE_ARC+i] = new float[] {+c,0.5f,+s};
|
|
311 |
vertices[4+2*SINGLE_ARC+i] = new float[] {+s,+c,0.5f};
|
|
312 |
}
|
|
313 |
|
|
314 |
final float EXTRA = (NUMBER_CORNER_SEGMENTS%2)==0 ? 1.0f : (float)Math.cos((Math.PI/2-2*INIT_ALPHA)/(2*NUMBER_CORNER_SEGMENTS));
|
|
315 |
final float LEN = 1.5f*DIAMETER_RATIO*EXTRA;
|
|
316 |
final float M = (float)(LEN*Math.sin(Math.PI/4) - 1.0f);
|
|
317 |
vertices[4+3*SINGLE_ARC] = new float[] {M,M,M};
|
|
318 |
|
|
319 |
for(int i=0; i<SINGLE_INNER_ARC; i++)
|
|
320 |
{
|
|
321 |
float s = tmp[i][0];
|
|
322 |
float c = tmp[i][1];
|
|
323 |
|
|
324 |
vertices[4+3*SINGLE_ARC+1 +i] = new float[] {s,c,c};
|
|
325 |
vertices[4+3*SINGLE_ARC+1+ SINGLE_INNER_ARC+i] = new float[] {c,s,c};
|
|
326 |
vertices[4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+i] = new float[] {c,c,s};
|
|
327 |
}
|
|
328 |
|
|
329 |
final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
|
|
330 |
final int NUM_VERTS = 4 + NUMBER_CORNER_SEGMENTS;
|
|
331 |
|
|
332 |
int[][] indices = new int[NUM_FACES][];
|
|
333 |
|
|
334 |
indices[0] = new int[NUM_VERTS];
|
|
335 |
indices[1] = new int[NUM_VERTS];
|
|
336 |
indices[2] = new int[NUM_VERTS];
|
|
337 |
|
|
338 |
indices[0][0] = 3;
|
|
339 |
indices[0][1] = 0;
|
|
340 |
indices[0][2] = 2;
|
|
341 |
indices[1][0] = 1;
|
|
342 |
indices[1][1] = 0;
|
|
343 |
indices[1][2] = 3;
|
|
344 |
indices[2][0] = 2;
|
|
345 |
indices[2][1] = 0;
|
|
346 |
indices[2][2] = 1;
|
|
347 |
|
|
348 |
for(int i=0; i<SINGLE_ARC; i++)
|
|
349 |
{
|
|
350 |
indices[0][3+i] = 4+i;
|
|
351 |
indices[1][3+i] = 4+i+ SINGLE_ARC;
|
|
352 |
indices[2][3+i] = 4+i+2*SINGLE_ARC;
|
|
353 |
}
|
|
354 |
|
|
355 |
indices[3] = new int[] { 1, 4+2*SINGLE_ARC-1, 4+3*SINGLE_ARC+1 , 4+2*SINGLE_ARC};
|
|
356 |
indices[4] = new int[] { 2, 4+3*SINGLE_ARC-1, 4+3*SINGLE_ARC+1+ SINGLE_INNER_ARC, 4 };
|
|
357 |
indices[5] = new int[] { 3, 4+ SINGLE_ARC-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC, 4+ SINGLE_ARC};
|
|
358 |
|
|
359 |
int start,i0,i1,i2,i3;
|
|
360 |
int MID = (NUMBER_CORNER_SEGMENTS)/2;
|
|
361 |
int MID2= (NUMBER_CORNER_SEGMENTS+1)/2;
|
|
362 |
|
|
363 |
if( (NUMBER_CORNER_SEGMENTS%2) == 0 )
|
|
364 |
{
|
|
365 |
start = 12;
|
|
366 |
indices[ 6] = new int[] { 4+3*SINGLE_ARC, 4+SINGLE_ARC+MID, 4+SINGLE_ARC+MID-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1};
|
|
367 |
indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID-1, 4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID};
|
|
368 |
indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1, 4+MID+1, 4+MID };
|
|
369 |
indices[ 9] = new int[] { 4+3*SINGLE_ARC, 4+MID, 4+MID-1, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1 };
|
|
370 |
indices[10] = new int[] { 4+3*SINGLE_ARC, 4+2*SINGLE_ARC+MID, 4+2*SINGLE_ARC+MID-1, 4+3*SINGLE_ARC+1+MID-1 };
|
|
371 |
indices[11] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1, 4+2*SINGLE_ARC+MID+1, 4+2*SINGLE_ARC+MID };
|
|
372 |
}
|
|
373 |
else
|
|
374 |
{
|
|
375 |
start = 9;
|
|
376 |
indices[ 6] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID, 4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID};
|
|
377 |
indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID, 4+MID+1, 4+MID, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID};
|
|
378 |
indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID, 4+2*SINGLE_ARC+MID+1, 4+2*SINGLE_ARC+MID, 4+3*SINGLE_ARC+1+MID};
|
|
379 |
}
|
|
380 |
|
|
381 |
for(int j=0; j<MID2-1; j++)
|
|
382 |
{
|
|
383 |
i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
|
|
384 |
i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
|
|
385 |
i2 = 4+SINGLE_ARC+j+1;
|
|
386 |
i3 = 4+SINGLE_ARC+j;
|
|
387 |
|
|
388 |
indices[start+j] = new int[] {i0,i1,i2,i3};
|
|
389 |
|
|
390 |
i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
|
|
391 |
i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
|
|
392 |
i2 = 4+(SINGLE_ARC-1)-j;
|
|
393 |
i3 = 4+(SINGLE_ARC-1)-(j+1);
|
|
394 |
|
|
395 |
indices[start+j+(MID2-1)] = new int[] {i0,i1,i2,i3};
|
|
396 |
|
|
397 |
i0 = 4+3*SINGLE_ARC+1+j;
|
|
398 |
i1 = 4+3*SINGLE_ARC+1+j+1;
|
|
399 |
i2 = 4+2*SINGLE_ARC+j+1;
|
|
400 |
i3 = 4+2*SINGLE_ARC+j;
|
|
401 |
|
|
402 |
indices[start+j+2*(MID2-1)] = new int[] {i0,i1,i2,i3};
|
|
403 |
|
|
404 |
i0 = 4+3*SINGLE_ARC+1+j+1;
|
|
405 |
i1 = 4+3*SINGLE_ARC+1+j;
|
|
406 |
i2 = 4+(2*SINGLE_ARC-1)-j;
|
|
407 |
i3 = 4+(2*SINGLE_ARC-1)-(j+1);
|
|
408 |
|
|
409 |
indices[start+j+3*(MID2-1)] = new int[] {i0,i1,i2,i3};
|
|
410 |
|
|
411 |
i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
|
|
412 |
i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
|
|
413 |
i2 = 4+j+1;
|
|
414 |
i3 = 4+j;
|
|
415 |
|
|
416 |
indices[start+j+4*(MID2-1)] = new int[] {i0,i1,i2,i3};
|
|
417 |
|
|
418 |
i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
|
|
419 |
i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
|
|
420 |
i2 = 4+(3*SINGLE_ARC-1)-j;
|
|
421 |
i3 = 4+(3*SINGLE_ARC-1)-(j+1);
|
|
422 |
|
|
423 |
indices[start+j+5*(MID2-1)] = new int[] {i0,i1,i2,i3};
|
|
424 |
}
|
|
425 |
|
|
426 |
return new ObjectShape(vertices,indices);
|
|
427 |
}
|
|
428 |
|
|
429 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
430 |
|
|
431 |
private ObjectShape getEdgeShape()
|
|
432 |
{
|
|
433 |
final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
|
|
434 |
final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
|
|
435 |
final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
|
|
436 |
float[][] vertices = new float[NUM_VERTICES][];
|
|
437 |
|
|
438 |
vertices[0] = new float[] {-0.5f,+0.5f,+0.5f};
|
|
439 |
vertices[1] = new float[] {+0.5f,+0.5f,+0.5f};
|
|
440 |
vertices[2] = new float[] {-0.5f, H,+0.5f};
|
|
441 |
vertices[3] = new float[] {+0.5f, H,+0.5f};
|
|
442 |
vertices[4] = new float[] {-0.5f,+0.5f, H};
|
|
443 |
vertices[5] = new float[] {+0.5f,+0.5f, H};
|
|
444 |
vertices[6] = new float[] {-0.5f, H, H};
|
|
445 |
vertices[7] = new float[] {+0.5f, H, H};
|
|
446 |
|
|
447 |
final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
|
|
448 |
for(int i=0; i<NUM_VERTS; i++)
|
|
449 |
{
|
|
450 |
float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
|
|
451 |
float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
|
|
452 |
float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
|
|
453 |
vertices[8 +i] = new float[] {A,B,0.5f};
|
|
454 |
vertices[8+ NUM_VERTS+i] = new float[] {A,0.5f,B};
|
|
455 |
vertices[8+2*NUM_VERTS+i] = new float[] {A,B,B};
|
|
456 |
}
|
|
457 |
|
|
458 |
final int NUM_FACES = 4 + 2*NUMBER_EDGE_SEGMENTS;
|
|
459 |
int[][] indices = new int[NUM_FACES][];
|
|
460 |
|
|
461 |
int NUMV = 3+NUMBER_EDGE_SEGMENTS;
|
|
462 |
|
|
463 |
indices[0] = new int[NUMV];
|
|
464 |
indices[0][0] = 3;
|
|
465 |
indices[0][1] = 1;
|
|
466 |
indices[0][2] = 0;
|
|
467 |
indices[0][3] = 2;
|
|
468 |
for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 8+i;
|
|
469 |
|
|
470 |
indices[1] = new int[NUMV];
|
|
471 |
indices[1][0] = 4;
|
|
472 |
indices[1][1] = 0;
|
|
473 |
indices[1][2] = 1;
|
|
474 |
indices[1][3] = 5;
|
|
475 |
for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 7+2*NUM_VERTS-i;
|
|
476 |
|
|
477 |
indices[2] = new int[] {5,1,3,7};
|
|
478 |
indices[3] = new int[] {0,4,6,2};
|
|
479 |
indices[4] = new int[] {8,2,6,8+2*NUM_VERTS};
|
|
480 |
indices[5] = new int[] {3,7+NUM_VERTS,7+3*NUM_VERTS,7};
|
|
481 |
indices[6] = new int[] {6,4,8+NUM_VERTS,8+2*NUM_VERTS};
|
|
482 |
indices[7] = new int[] {5,7,7+3*NUM_VERTS,7+2*NUM_VERTS};
|
|
483 |
|
|
484 |
int i0,i1,i2,i3;
|
|
485 |
|
|
486 |
for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
|
|
487 |
{
|
|
488 |
i0 = 9+i;
|
|
489 |
i1 = 8+i;
|
|
490 |
i2 = 8+2*NUM_VERTS+i;
|
|
491 |
i3 = 9+2*NUM_VERTS+i;
|
|
492 |
|
|
493 |
indices[8+i] = new int[] {i0,i1,i2,i3};
|
|
494 |
|
|
495 |
i0 = 9+2*NUM_VERTS+i;
|
|
496 |
i1 = 8+2*NUM_VERTS+i;
|
|
497 |
i2 = 8+NUM_VERTS+i;
|
|
498 |
i3 = 9+NUM_VERTS+i;
|
|
499 |
|
|
500 |
indices[8+NUMBER_EDGE_SEGMENTS-2+i] = new int[] {i0,i1,i2,i3};
|
|
501 |
}
|
|
502 |
|
|
503 |
return new ObjectShape(vertices,indices);
|
|
504 |
}
|
|
505 |
|
|
506 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
507 |
|
|
508 |
private ObjectShape getCenterShape(float D)
|
|
509 |
{
|
|
510 |
float[][] vertices = new float[][]
|
|
511 |
{
|
|
512 |
{-0.5f,-0.5f,-0.5f+D},
|
|
513 |
{-0.5f,-0.5f,+0.5f+D},
|
|
514 |
{-0.5f,+0.5f,-0.5f+D},
|
|
515 |
{-0.5f,+0.5f,+0.5f+D},
|
|
516 |
{+0.5f,-0.5f,-0.5f+D},
|
|
517 |
{+0.5f,-0.5f,+0.5f+D},
|
|
518 |
{+0.5f,+0.5f,-0.5f+D},
|
|
519 |
{+0.5f,+0.5f,+0.5f+D},
|
|
520 |
};
|
|
521 |
|
|
522 |
int[][] indices = new int[][]
|
|
523 |
{
|
|
524 |
{1,5,7,3},
|
|
525 |
{5,4,6,7},
|
|
526 |
{0,1,3,2},
|
|
527 |
{3,7,6,2},
|
|
528 |
{0,4,5,1},
|
|
529 |
{4,0,2,6}
|
|
530 |
};
|
|
531 |
|
|
532 |
return new ObjectShape(vertices,indices);
|
|
533 |
}
|
|
534 |
|
|
535 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
536 |
|
|
537 |
private ObjectShape getBigCircleShape(float D)
|
|
538 |
{
|
|
539 |
final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
|
|
540 |
final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
|
|
541 |
final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
|
|
542 |
float[][] vertices = new float[NUM_VERTICES][];
|
|
543 |
|
|
544 |
vertices[0] = new float[] {-0.5f,-0.5f,+0.5f+D};
|
|
545 |
vertices[1] = new float[] {-0.5f,-0.5f,-0.5f+D};
|
|
546 |
vertices[2] = new float[] {+0.5f,-0.5f,+0.5f+D};
|
|
547 |
vertices[3] = new float[] {+0.5f,-0.5f,-0.5f+D};
|
|
548 |
vertices[4] = new float[] {-0.5f, H,+0.5f+D};
|
|
549 |
vertices[5] = new float[] {-0.5f, H,-0.5f+D};
|
|
550 |
vertices[6] = new float[] {+0.5f, H,+0.5f+D};
|
|
551 |
vertices[7] = new float[] {+0.5f, H,-0.5f+D};
|
|
552 |
|
|
553 |
final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
|
|
554 |
for(int i=0; i<NUM_VERTS; i++)
|
|
555 |
{
|
|
556 |
float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
|
|
557 |
float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
|
|
558 |
float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
|
|
559 |
vertices[8 +i] = new float[] {A,B,+0.5f+D};
|
|
560 |
vertices[8+NUM_VERTS+i] = new float[] {A,B,-0.5f+D};
|
|
561 |
}
|
|
562 |
|
|
563 |
final int NUM_FACES = 5 + NUMBER_EDGE_SEGMENTS;
|
|
564 |
int[][] indices = new int[NUM_FACES][];
|
|
565 |
|
|
566 |
int NUMV = 4+NUM_VERTS;
|
|
567 |
indices[0] = new int[NUMV];
|
|
568 |
indices[0][0] = 4;
|
|
569 |
indices[0][1] = 0;
|
|
570 |
indices[0][2] = 2;
|
|
571 |
indices[0][3] = 6;
|
|
572 |
for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 7+NUM_VERTS-i;
|
|
573 |
|
|
574 |
indices[1] = new int[NUMV];
|
|
575 |
indices[1][0] = 7;
|
|
576 |
indices[1][1] = 3;
|
|
577 |
indices[1][2] = 1;
|
|
578 |
indices[1][3] = 5;
|
|
579 |
for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 8+NUM_VERTS+i;
|
|
580 |
|
|
581 |
indices[2] = new int[] {7,3,2,6};
|
|
582 |
indices[3] = new int[] {4,0,1,5};
|
|
583 |
indices[4] = new int[] {1,3,2,0};
|
|
584 |
|
|
585 |
indices[5] = new int[] {5,4,8,8+NUM_VERTS};
|
|
586 |
indices[6] = new int[] {7+NUM_VERTS,6,7,7+2*NUM_VERTS};
|
|
587 |
|
|
588 |
for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
|
|
589 |
{
|
|
590 |
int i0 = 8+i;
|
|
591 |
int i1 = 9+i;
|
|
592 |
int i2 = 9+NUM_VERTS+i;
|
|
593 |
int i3 = 8+NUM_VERTS+i;
|
|
594 |
|
|
595 |
indices[7+i] = new int[] {i0,i1,i2,i3};
|
|
596 |
}
|
|
597 |
|
|
598 |
return new ObjectShape(vertices,indices);
|
|
599 |
}
|
|
600 |
|
|
601 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
602 |
|
|
603 |
private ObjectShape getSmallCircleShape(float D)
|
|
604 |
{
|
|
605 |
final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
|
|
606 |
final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
|
|
607 |
final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
|
|
608 |
final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
|
|
609 |
float[][] vertices = new float[NUM_VERTICES][];
|
|
610 |
|
|
611 |
vertices[0] = new float[] {-0.5f, H, 0.5f+D};
|
|
612 |
vertices[1] = new float[] { H,-0.5f, 0.5f+D};
|
|
613 |
vertices[2] = new float[] {-0.5f,-0.5f, 0.5f+D};
|
|
614 |
vertices[3] = new float[] {-0.5f, H,-0.5f+D};
|
|
615 |
vertices[4] = new float[] { H,-0.5f,-0.5f+D};
|
|
616 |
vertices[5] = new float[] {-0.5f,-0.5f,-0.5f+D};
|
|
617 |
|
|
618 |
for(int i=0; i<NUMBER_CORNER_SEGMENTS-1; i++)
|
|
619 |
{
|
|
620 |
float alpha = INIT_ALPHA + (i+1)*STEP_CORNER;
|
|
621 |
float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
|
|
622 |
float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
|
|
623 |
|
|
624 |
vertices[6 +i] = new float[] {A,B, 0.5f+D};
|
|
625 |
vertices[5+NUMBER_CORNER_SEGMENTS+i] = new float[] {A,B,-0.5f+D};
|
|
626 |
}
|
|
627 |
|
|
628 |
final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
|
|
629 |
int[][] indices = new int[NUM_FACES][];
|
|
630 |
|
|
631 |
int NUMV = 2+NUMBER_CORNER_SEGMENTS;
|
|
632 |
indices[0] = new int[NUMV];
|
|
633 |
indices[0][0] = 0;
|
|
634 |
indices[0][1] = 2;
|
|
635 |
indices[0][2] = 1;
|
|
636 |
for(int i=3; i<NUMV; i++) indices[0][i] = 5+(NUMBER_CORNER_SEGMENTS-1)-(i-3);
|
|
637 |
|
|
638 |
indices[1] = new int[NUMV];
|
|
639 |
indices[1][0] = 4;
|
|
640 |
indices[1][1] = 5;
|
|
641 |
indices[1][2] = 3;
|
|
642 |
for(int i=3; i<NUMV; i++) indices[1][i] = 5+NUMBER_CORNER_SEGMENTS+(i-3);
|
|
643 |
|
|
644 |
indices[2] = new int[] {0,3,5,2};
|
|
645 |
indices[3] = new int[] {1,2,5,4};
|
|
646 |
|
|
647 |
indices[4] = new int[] {5+NUMBER_CORNER_SEGMENTS,3,0,6};
|
|
648 |
indices[5] = new int[] {1,4,5+2*(NUMBER_CORNER_SEGMENTS-1),5+(NUMBER_CORNER_SEGMENTS-1)};
|
|
649 |
|
|
650 |
for(int i=0; i<NUMBER_CORNER_SEGMENTS-2; i++)
|
|
651 |
{
|
|
652 |
int i0 = 6+i;
|
|
653 |
int i1 = 7+i;
|
|
654 |
int i2 = 6+NUMBER_CORNER_SEGMENTS+i;
|
|
655 |
int i3 = 5+NUMBER_CORNER_SEGMENTS+i;
|
|
656 |
|
|
657 |
indices[6+i] = new int[] {i0,i1,i2,i3};
|
|
658 |
}
|
|
659 |
|
|
660 |
return new ObjectShape(vertices,indices);
|
|
661 |
}
|
|
662 |
|
|
663 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
664 |
|
|
665 |
public ObjectShape getObjectShape(int variant)
|
|
666 |
{
|
|
667 |
switch(variant)
|
|
668 |
{
|
|
669 |
case 0: return getCornerShape();
|
|
670 |
case 1: return getEdgeShape();
|
|
671 |
case 2: return getCenterShape(1.0f);
|
|
672 |
case 3: return getBigCircleShape(1.0f);
|
|
673 |
case 4: return getSmallCircleShape(1.02f);
|
|
674 |
}
|
|
675 |
|
|
676 |
return null;
|
|
677 |
}
|
|
678 |
|
|
679 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
680 |
|
|
681 |
public ObjectFaceShape getObjectFaceShape(int variant)
|
|
682 |
{
|
|
683 |
if( variant==0 )
|
|
684 |
{
|
|
685 |
float h1 = isInIconMode() ? 0.001f : 0.04f;
|
|
686 |
float h2 = 0.001f;
|
|
687 |
float[][] bands = { {h1,45,0.3f,0.7f,5,1,0}, {h2,5,0.3f,0.2f,2,0,0} };
|
|
688 |
final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
|
|
689 |
int[] bandIndices = new int[NUM_BANDS];
|
|
690 |
bandIndices[0] = bandIndices[1] = bandIndices[2] = 0;
|
|
691 |
for(int i=3; i<NUM_BANDS; i++) bandIndices[i] = 1;
|
|
692 |
float[][] corners = { {0.02f,0.09f} };
|
|
693 |
float[][] centers = { { 0.0f, 0.0f, 0.0f } };
|
|
694 |
final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
|
|
695 |
final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
|
|
696 |
final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
|
|
697 |
int[] indices = new int[NUM_VERTICES];
|
|
698 |
indices[0] = indices[1] = indices[2] = indices[3] = 0;
|
|
699 |
for(int i=4; i<NUM_VERTICES; i++) indices[i] = -1;
|
|
700 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
|
701 |
}
|
|
702 |
if( variant==1 )
|
|
703 |
{
|
|
704 |
float h1 = isInIconMode() ? 0.001f : 0.03f;
|
|
705 |
float[][] bands = { {h1,45,0.2f,0.4f,5,1,0}, {0.001f,1,0.3f,0.5f,5,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
|
|
706 |
final int NUM_BANDS = 4 + 2*NUMBER_EDGE_SEGMENTS;
|
|
707 |
int[] bandIndices = new int[NUM_BANDS];
|
|
708 |
bandIndices[0] = bandIndices[1] = 0;
|
|
709 |
bandIndices[2] = bandIndices[3] = 1;
|
|
710 |
for(int i=4; i<NUM_BANDS; i++) bandIndices[i] = 2;
|
|
711 |
float[][] corners = { {0.02f,0.09f} };
|
|
712 |
float[][] centers = { { 0.0f, 0.0f, 0.0f } };
|
|
713 |
final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
|
|
714 |
int[] indices = new int[NUM_VERTICES];
|
|
715 |
indices[0] = indices[1] = indices[2] = indices[3] = indices[4] = indices[5] = 0;
|
|
716 |
for(int i=6; i<NUM_VERTICES; i++) indices[i] = -1;
|
|
717 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
|
718 |
}
|
|
719 |
if( variant==2 )
|
|
720 |
{
|
|
721 |
float h1 = isInIconMode() ? 0.001f : 0.05f;
|
|
722 |
float[][] bands = { {h1,45,0.2f,0.4f,5,1,0}, {0.001f,1,0.3f,0.5f,5,0,0} };
|
|
723 |
int[] bandIndices = new int[] {0,1,1,1,1,1};
|
|
724 |
float[][] corners = { {0.02f,0.09f} };
|
|
725 |
float[][] centers = { { 0.0f, 0.0f, 1.0f } };
|
|
726 |
int[] indices = new int[] {0,0,0,0,-1,-1,-1,-1};
|
|
727 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
|
728 |
}
|
|
729 |
if( variant==3 )
|
|
730 |
{
|
|
731 |
float h1 = isInIconMode() ? 0.001f : 0.03f;
|
|
732 |
float[][] bands = { {h1,45,0.2f,0.4f,5,1,0}, {0.001f,1,0.3f,0.5f,5,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
|
|
733 |
final int NUM_BANDS = 5 + NUMBER_EDGE_SEGMENTS;
|
|
734 |
int[] bandIndices = new int[NUM_BANDS];
|
|
735 |
bandIndices[0] = 0;
|
|
736 |
bandIndices[1] = 2;
|
|
737 |
bandIndices[2] = bandIndices[3] = bandIndices[4] = 1;
|
|
738 |
for(int i=5; i<NUM_BANDS; i++) bandIndices[i] = 2;
|
|
739 |
float[][] corners = { {0.02f,0.09f} };
|
|
740 |
float[][] centers = { { 0.0f, 0.0f, 1.0f } };
|
|
741 |
final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
|
|
742 |
int[] indices = new int[NUM_VERTICES];
|
|
743 |
for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
|
|
744 |
indices[0] = indices[2] = indices[4] = indices[6] = 0;
|
|
745 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
|
746 |
}
|
|
747 |
else
|
|
748 |
{
|
|
749 |
float h1 = isInIconMode() ? 0.001f : 0.02f;
|
|
750 |
float[][] bands = { {h1,45,0.2f,0.4f,5,1,0}, {0.001f,1,0.3f,0.5f,5,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
|
|
751 |
final int NUM_BANDS = 4 + NUMBER_CORNER_SEGMENTS;
|
|
752 |
int[] bandIndices = new int[NUM_BANDS];
|
|
753 |
bandIndices[0] = 0;
|
|
754 |
bandIndices[1] = 2;
|
|
755 |
bandIndices[2] = bandIndices[3] = 1;
|
|
756 |
for(int i=4; i<NUM_BANDS; i++) bandIndices[i] = 2;
|
|
757 |
float[][] corners = { {0.02f,0.09f} };
|
|
758 |
float[][] centers = { { 0.0f, 0.0f, 1.0f } };
|
|
759 |
final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
|
|
760 |
int[] indices = new int[NUM_VERTICES];
|
|
761 |
for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
|
|
762 |
indices[0] = indices[1] = indices[2] = 0;
|
|
763 |
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
|
764 |
}
|
|
765 |
}
|
|
766 |
|
|
767 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
768 |
|
|
769 |
public int getNumCubitVariants(int[] numLayers)
|
|
770 |
{
|
|
771 |
return 5;
|
|
772 |
}
|
|
773 |
|
|
774 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
775 |
|
|
776 |
public int getCubitVariant(int cubit, int[] numLayers)
|
|
777 |
{
|
|
778 |
if( cubit< 8 ) return 0;
|
|
779 |
if( cubit<20 ) return 1;
|
|
780 |
if( cubit<26 ) return 2;
|
|
781 |
if( cubit<50 ) return 3;
|
|
782 |
|
|
783 |
return 4;
|
|
784 |
}
|
|
785 |
|
|
786 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
787 |
|
|
788 |
public float getStickerRadius()
|
|
789 |
{
|
|
790 |
return 0.05f;
|
|
791 |
}
|
|
792 |
|
|
793 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
794 |
|
|
795 |
public float getStickerStroke()
|
|
796 |
{
|
|
797 |
return isInIconMode() ? 0.22f : 0.12f;
|
|
798 |
}
|
|
799 |
|
|
800 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
801 |
// TODO
|
|
802 |
|
|
803 |
public float[][] getStickerAngles()
|
|
804 |
{
|
|
805 |
return null;
|
|
806 |
|
|
807 |
//float D = (float)(Math.PI/6);
|
|
808 |
//return new float[][] { { 0,D,0 },{ 0,0,0,-D } };
|
|
809 |
}
|
|
810 |
|
|
811 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
812 |
// PUBLIC API
|
|
813 |
|
|
814 |
public Static3D[] getRotationAxis()
|
|
815 |
{
|
|
816 |
return ROT_AXIS;
|
|
817 |
}
|
|
818 |
|
|
819 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
820 |
|
|
821 |
public int[][] getBasicAngles()
|
|
822 |
{
|
|
823 |
if( mBasicAngle==null )
|
|
824 |
{
|
|
825 |
int[] tmp = new int[] {4,4,4};
|
|
826 |
mBasicAngle = new int[][] { tmp,tmp,tmp };
|
|
827 |
}
|
|
828 |
|
|
829 |
return mBasicAngle;
|
|
830 |
}
|
|
831 |
|
|
832 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
833 |
|
|
834 |
public String getShortName()
|
|
835 |
{
|
|
836 |
return ObjectType.CRA1_3.name();
|
|
837 |
}
|
|
838 |
|
|
839 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
840 |
|
|
841 |
public ObjectSignature getSignature()
|
|
842 |
{
|
|
843 |
return new ObjectSignature(ObjectType.CRA1_3);
|
|
844 |
}
|
|
845 |
|
|
846 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
847 |
|
|
848 |
public String getObjectName()
|
|
849 |
{
|
|
850 |
return "Crazy 3x3";
|
|
851 |
}
|
|
852 |
|
|
853 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
854 |
|
|
855 |
public String getInventor()
|
|
856 |
{
|
|
857 |
return "Aleh Hladzilin";
|
|
858 |
}
|
|
859 |
|
|
860 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
861 |
|
|
862 |
public int getYearOfInvention()
|
|
863 |
{
|
|
864 |
return 2008;
|
|
865 |
}
|
|
866 |
|
|
867 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
868 |
|
|
869 |
public int getComplexity()
|
|
870 |
{
|
|
871 |
return 2;
|
|
872 |
}
|
|
873 |
|
|
874 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
875 |
|
|
876 |
public String[][] getTutorials()
|
|
877 |
{
|
|
878 |
return new String[][]{
|
|
879 |
{"gb","7xUE8ond_Mg","Crazy 3x3x3 Cube Tutorial","SuperAntoniovivaldi"},
|
|
880 |
};
|
|
881 |
}
|
|
882 |
}
|
Crazy 3x3: initial version. Still stickers need to be adjusted.