|
1 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
2 |
// Copyright 2020 Leszek Koltunski //
|
|
3 |
// //
|
|
4 |
// This file is part of Magic Cube. //
|
|
5 |
// //
|
|
6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
|
7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
|
8 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
9 |
|
|
10 |
package org.distorted.objectlib.objects;
|
|
11 |
|
|
12 |
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_TETRAHEDRON;
|
|
13 |
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_EDGE_COIN;
|
|
14 |
|
|
15 |
import org.distorted.library.type.Static3D;
|
|
16 |
import org.distorted.library.type.Static4D;
|
|
17 |
import org.distorted.objectlib.helpers.FactoryCubit;
|
|
18 |
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
|
19 |
import org.distorted.objectlib.helpers.ObjectShape;
|
|
20 |
import org.distorted.objectlib.helpers.ObjectSignature;
|
|
21 |
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
|
22 |
import org.distorted.objectlib.main.InitAssets;
|
|
23 |
import org.distorted.objectlib.main.InitData;
|
|
24 |
import org.distorted.objectlib.main.ObjectSignatures;
|
|
25 |
import org.distorted.objectlib.main.ObjectType;
|
|
26 |
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
|
|
27 |
import org.distorted.objectlib.shape.ShapeHexahedron;
|
|
28 |
import org.distorted.objectlib.touchcontrol.TouchControlTetrahedron;
|
|
29 |
|
|
30 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
31 |
|
|
32 |
public class TwistyCoinTetrahedron extends ShapeHexahedron
|
|
33 |
{
|
|
34 |
static final Static3D[] ROT_AXIS = new Static3D[]
|
|
35 |
{
|
|
36 |
new Static3D( 0,-SQ3/3,-SQ6/3),
|
|
37 |
new Static3D( 0,-SQ3/3, SQ6/3),
|
|
38 |
new Static3D( SQ6/3, SQ3/3, 0),
|
|
39 |
new Static3D(-SQ6/3, SQ3/3, 0),
|
|
40 |
};
|
|
41 |
|
|
42 |
private int[][] mEdges;
|
|
43 |
private int[][] mBasicAngle;
|
|
44 |
private float[][] mCuts;
|
|
45 |
private float[][] mPosition;
|
|
46 |
|
|
47 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
48 |
|
|
49 |
public TwistyCoinTetrahedron(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
|
|
50 |
{
|
|
51 |
super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
|
|
52 |
}
|
|
53 |
|
|
54 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
55 |
|
|
56 |
public int[][] getScrambleEdges()
|
|
57 |
{
|
|
58 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
|
|
59 |
return mEdges;
|
|
60 |
}
|
|
61 |
|
|
62 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
63 |
|
|
64 |
public float[][] getCuts(int[] numLayers)
|
|
65 |
{
|
|
66 |
if( mCuts==null )
|
|
67 |
{
|
|
68 |
float[] cut = new float[] {-0.95f*(SQ6/4),0};
|
|
69 |
mCuts = new float[][] { cut,cut,cut,cut };
|
|
70 |
}
|
|
71 |
|
|
72 |
return mCuts;
|
|
73 |
}
|
|
74 |
|
|
75 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
76 |
|
|
77 |
public boolean[][] getLayerRotatable(int[] numLayers)
|
|
78 |
{
|
|
79 |
boolean[] tmp = new boolean[] {true,false,true};
|
|
80 |
return new boolean[][] { tmp,tmp,tmp,tmp };
|
|
81 |
}
|
|
82 |
|
|
83 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
84 |
|
|
85 |
public int getTouchControlType()
|
|
86 |
{
|
|
87 |
return TC_TETRAHEDRON;
|
|
88 |
}
|
|
89 |
|
|
90 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
91 |
|
|
92 |
public int getTouchControlSplit()
|
|
93 |
{
|
|
94 |
return TYPE_SPLIT_EDGE_COIN;
|
|
95 |
}
|
|
96 |
|
|
97 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
98 |
|
|
99 |
public int[][][] getEnabled()
|
|
100 |
{
|
|
101 |
return new int[][][]
|
|
102 |
{
|
|
103 |
{{0},{0},{0},{1},{3},{2}},
|
|
104 |
{{1},{1},{1},{0},{2},{3}},
|
|
105 |
{{2},{2},{2},{3},{1},{0}},
|
|
106 |
{{3},{3},{3},{2},{0},{1}}
|
|
107 |
};
|
|
108 |
}
|
|
109 |
|
|
110 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
111 |
|
|
112 |
public float[] getDist3D(int[] numLayers)
|
|
113 |
{
|
|
114 |
return TouchControlTetrahedron.D3D;
|
|
115 |
}
|
|
116 |
|
|
117 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
118 |
|
|
119 |
public Static3D[] getFaceAxis()
|
|
120 |
{
|
|
121 |
return TouchControlTetrahedron.FACE_AXIS;
|
|
122 |
}
|
|
123 |
|
|
124 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
125 |
|
|
126 |
public float[][] getCubitPositions(int[] numLayers)
|
|
127 |
{
|
|
128 |
if( mPosition==null )
|
|
129 |
{
|
|
130 |
mPosition = new float[][]
|
|
131 |
{
|
|
132 |
// TODO
|
|
133 |
};
|
|
134 |
}
|
|
135 |
|
|
136 |
return mPosition;
|
|
137 |
}
|
|
138 |
|
|
139 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
140 |
|
|
141 |
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
|
142 |
{
|
|
143 |
switch(cubit)
|
|
144 |
{
|
|
145 |
// TODO
|
|
146 |
}
|
|
147 |
|
|
148 |
return null;
|
|
149 |
}
|
|
150 |
|
|
151 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
152 |
|
|
153 |
private float[][] getVertices(int variant)
|
|
154 |
{
|
|
155 |
if( variant==0 )
|
|
156 |
{
|
|
157 |
return new float[][]
|
|
158 |
{
|
|
159 |
// TODO
|
|
160 |
};
|
|
161 |
}
|
|
162 |
else if( variant==1 )
|
|
163 |
{
|
|
164 |
return new float[][]
|
|
165 |
{
|
|
166 |
// TODO
|
|
167 |
};
|
|
168 |
}
|
|
169 |
else
|
|
170 |
{
|
|
171 |
return new float[][]
|
|
172 |
{
|
|
173 |
// TODO
|
|
174 |
};
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
179 |
|
|
180 |
public ObjectShape getObjectShape(int variant)
|
|
181 |
{
|
|
182 |
if( variant==0 )
|
|
183 |
{
|
|
184 |
int[][] indices =
|
|
185 |
{
|
|
186 |
// TODO
|
|
187 |
};
|
|
188 |
|
|
189 |
return new ObjectShape(getVertices(variant), indices);
|
|
190 |
}
|
|
191 |
else if( variant==1 )
|
|
192 |
{
|
|
193 |
int[][] indices =
|
|
194 |
{
|
|
195 |
// TODO
|
|
196 |
};
|
|
197 |
|
|
198 |
return new ObjectShape(getVertices(variant), indices);
|
|
199 |
}
|
|
200 |
else
|
|
201 |
{
|
|
202 |
int[][] indices =
|
|
203 |
{
|
|
204 |
// TODO
|
|
205 |
};
|
|
206 |
|
|
207 |
return new ObjectShape(getVertices(variant), indices);
|
|
208 |
}
|
|
209 |
}
|
|
210 |
|
|
211 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
212 |
// TODO
|
|
213 |
|
|
214 |
public ObjectFaceShape getObjectFaceShape(int variant)
|
|
215 |
{
|
|
216 |
if( variant==0 )
|
|
217 |
{
|
|
218 |
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
|
219 |
float h2 = isInIconMode() ? 0.001f : 0.01f;
|
|
220 |
float[][] bands = { {h1,35,0.5f,0.7f,5,2,2}, {h2,35,0.2f,0.4f,5,2,2} };
|
|
221 |
int[] indices = { 0,0,0,1,1,1,1,1,1 };
|
|
222 |
return new ObjectFaceShape(bands,indices,null);
|
|
223 |
}
|
|
224 |
else if( variant==1 )
|
|
225 |
{
|
|
226 |
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
|
227 |
float h2 = isInIconMode() ? 0.001f : 0.01f;
|
|
228 |
float[][] bands = { {h1,35,0.5f,0.7f,5,2,2}, {h2,35,0.2f,0.4f,5,2,2} };
|
|
229 |
int[] indices = { 0,0,0,1,1,1,1,1,1 };
|
|
230 |
return new ObjectFaceShape(bands,indices,null);
|
|
231 |
}
|
|
232 |
else
|
|
233 |
{
|
|
234 |
float h1 = isInIconMode() ? 0.001f : 0.038f;
|
|
235 |
float h2 = isInIconMode() ? 0.001f : 0.020f;
|
|
236 |
float[][] bands = { {h1,35,0.250f,0.7f,7,2,2}, {h2,35,0.125f,0.2f,3,1,2}, {h2,35,0.125f,0.2f,3,1,1} };
|
|
237 |
int[] indices = { 0,0,1,1,2,2 };
|
|
238 |
return new ObjectFaceShape(bands,indices,null);
|
|
239 |
}
|
|
240 |
}
|
|
241 |
|
|
242 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
243 |
|
|
244 |
public ObjectVertexEffects getVertexEffects(int variant)
|
|
245 |
{
|
|
246 |
if( variant==0 )
|
|
247 |
{
|
|
248 |
float[][] corners = { {0.06f,0.12f} };
|
|
249 |
int[] indices = { }; // TODO
|
|
250 |
float[][] centers = { { 0.0f, 0.0f, 0.0f} };
|
|
251 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
|
252 |
}
|
|
253 |
else if( variant==1 )
|
|
254 |
{
|
|
255 |
float[][] corners = { {0.06f,0.12f} };
|
|
256 |
int[] indices = { }; // TODO
|
|
257 |
float[][] centers = { { } }; // TODO
|
|
258 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
|
259 |
}
|
|
260 |
else
|
|
261 |
{
|
|
262 |
float[][] corners = { {0.06f,0.20f} };
|
|
263 |
int[] indices = { }; // TODO
|
|
264 |
float[][] centers = { { } }; // TODO
|
|
265 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
|
266 |
}
|
|
267 |
}
|
|
268 |
|
|
269 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
270 |
|
|
271 |
public int getNumCubitVariants(int[] numLayers)
|
|
272 |
{
|
|
273 |
return 3;
|
|
274 |
}
|
|
275 |
|
|
276 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
277 |
|
|
278 |
public int getCubitVariant(int cubit, int[] numLayers)
|
|
279 |
{
|
|
280 |
return cubit<4 ? 0 : (cubit<16 ? 1:2);
|
|
281 |
}
|
|
282 |
|
|
283 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
284 |
|
|
285 |
public float getStickerRadius()
|
|
286 |
{
|
|
287 |
return 0.09f;
|
|
288 |
}
|
|
289 |
|
|
290 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
291 |
|
|
292 |
public float getStickerStroke()
|
|
293 |
{
|
|
294 |
return isInIconMode() ? 0.20f : 0.09f;
|
|
295 |
}
|
|
296 |
|
|
297 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
298 |
|
|
299 |
public float[][] getStickerAngles()
|
|
300 |
{
|
|
301 |
return null; // TODO
|
|
302 |
}
|
|
303 |
|
|
304 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
305 |
// PUBLIC API
|
|
306 |
|
|
307 |
public Static3D[] getRotationAxis()
|
|
308 |
{
|
|
309 |
return ROT_AXIS;
|
|
310 |
}
|
|
311 |
|
|
312 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
313 |
|
|
314 |
public int[][] getBasicAngles()
|
|
315 |
{
|
|
316 |
if( mBasicAngle ==null )
|
|
317 |
{
|
|
318 |
int[] tmp = {3,3,3};
|
|
319 |
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
|
|
320 |
}
|
|
321 |
|
|
322 |
return mBasicAngle;
|
|
323 |
}
|
|
324 |
|
|
325 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
326 |
|
|
327 |
public String getShortName()
|
|
328 |
{
|
|
329 |
return ObjectType.COIN_3.name();
|
|
330 |
}
|
|
331 |
|
|
332 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
333 |
|
|
334 |
public ObjectSignature getSignature()
|
|
335 |
{
|
|
336 |
return new ObjectSignature(ObjectSignatures.COIN_3);
|
|
337 |
}
|
|
338 |
|
|
339 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
340 |
|
|
341 |
public String getObjectName()
|
|
342 |
{
|
|
343 |
return "Coin Tetrahedron";
|
|
344 |
}
|
|
345 |
|
|
346 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
347 |
|
|
348 |
public String getInventor()
|
|
349 |
{
|
|
350 |
return "Kevin Uhrik";
|
|
351 |
}
|
|
352 |
|
|
353 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
354 |
|
|
355 |
public int getYearOfInvention()
|
|
356 |
{
|
|
357 |
return 2019;
|
|
358 |
}
|
|
359 |
|
|
360 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
361 |
|
|
362 |
public int getComplexity()
|
|
363 |
{
|
|
364 |
return 0;
|
|
365 |
}
|
|
366 |
|
|
367 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
368 |
|
|
369 |
public String[][] getTutorials()
|
|
370 |
{
|
|
371 |
return new String[][] {
|
|
372 |
{"gb","2WrDNfcfpAg","Coin Pyraminx Tutorial","Brent Richter"},
|
|
373 |
{"es","5pTfSCsHPWs","Tutorial Coin Pyraminx","Kubekings"},
|
|
374 |
{"ru","qUMQsn8kg1A","Как собрать Коин Пираминкс","Алексей Ярыгин"},
|
|
375 |
{"vn","TOaiOcEE0lk","Hướng Dẫn Giải Pyraminx Coin","Rubik Cube"},
|
|
376 |
};
|
|
377 |
}
|
|
378 |
}
|
Coin Tetrahedron: initial commit