1 |
60bed292
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
6133be67
|
Leszek Koltunski
|
// 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 |
60bed292
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
package org.distorted.objectlib.objects;
|
11 |
|
|
|
12 |
|
|
import org.distorted.library.type.Static3D;
|
13 |
|
|
import org.distorted.library.type.Static4D;
|
14 |
84a17011
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
15 |
60bed292
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
16 |
|
|
import org.distorted.objectlib.helpers.ObjectShape;
|
17 |
|
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
18 |
84a17011
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
19 |
a8295031
|
Leszek Koltunski
|
import org.distorted.objectlib.main.InitData;
|
20 |
60bed292
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
21 |
|
|
|
22 |
|
|
import java.io.InputStream;
|
23 |
|
|
|
24 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
25 |
|
|
|
26 |
|
|
public class TwistyMixup3x3 extends TwistyMixup
|
27 |
|
|
{
|
28 |
c5de0343
|
Leszek Koltunski
|
private static final float SHORT_EDGE = 1.5f-0.75f*SQ2;
|
29 |
|
|
private static final float LONG_EDGE = 1.5f*(SQ2-1);
|
30 |
|
|
|
31 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32 |
|
|
|
33 |
a8295031
|
Leszek Koltunski
|
public TwistyMixup3x3(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
34 |
60bed292
|
Leszek Koltunski
|
{
|
35 |
a8295031
|
Leszek Koltunski
|
super(data, meshState, iconMode, quat, move, scale, stream);
|
36 |
60bed292
|
Leszek Koltunski
|
}
|
37 |
|
|
|
38 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39 |
|
|
|
40 |
|
|
public float[][] getCuts(int[] numLayers)
|
41 |
|
|
{
|
42 |
|
|
if( mCuts==null )
|
43 |
|
|
{
|
44 |
c5de0343
|
Leszek Koltunski
|
float[] cut = new float[] {-LONG_EDGE,+LONG_EDGE};
|
45 |
60bed292
|
Leszek Koltunski
|
mCuts = new float[][] { cut,cut,cut };
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
return mCuts;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
52 |
|
|
|
53 |
|
|
public float[][] getCubitPositions(int[] numLayers)
|
54 |
|
|
{
|
55 |
|
|
if( mPosition==null )
|
56 |
|
|
{
|
57 |
|
|
final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
|
58 |
|
|
final float DIST_EDGE = LONG_EDGE+SHORT_EDGE;
|
59 |
|
|
final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
|
60 |
|
|
|
61 |
|
|
mPosition = new float[][]
|
62 |
|
|
{
|
63 |
|
|
{ DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
64 |
|
|
{ DIST_CORNER, DIST_CORNER,-DIST_CORNER },
|
65 |
|
|
{ DIST_CORNER,-DIST_CORNER, DIST_CORNER },
|
66 |
|
|
{ DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
|
67 |
|
|
{-DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
68 |
|
|
{-DIST_CORNER, DIST_CORNER,-DIST_CORNER },
|
69 |
|
|
{-DIST_CORNER,-DIST_CORNER, DIST_CORNER },
|
70 |
|
|
{-DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
|
71 |
|
|
|
72 |
|
|
{ 0.0f, DIST_EDGE, DIST_EDGE },
|
73 |
|
|
{ DIST_EDGE, 0.0f, DIST_EDGE },
|
74 |
|
|
{ 0.0f,-DIST_EDGE, DIST_EDGE },
|
75 |
|
|
{-DIST_EDGE, 0.0f, DIST_EDGE },
|
76 |
|
|
{ DIST_EDGE, DIST_EDGE, 0.0f },
|
77 |
|
|
{ DIST_EDGE,-DIST_EDGE, 0.0f },
|
78 |
|
|
{-DIST_EDGE,-DIST_EDGE, 0.0f },
|
79 |
|
|
{-DIST_EDGE, DIST_EDGE, 0.0f },
|
80 |
|
|
{ 0.0f, DIST_EDGE,-DIST_EDGE },
|
81 |
|
|
{ DIST_EDGE, 0.0f,-DIST_EDGE },
|
82 |
|
|
{ 0.0f,-DIST_EDGE,-DIST_EDGE },
|
83 |
|
|
{-DIST_EDGE, 0.0f,-DIST_EDGE },
|
84 |
|
|
|
85 |
|
|
{ 0, 0, DIST_CENTER },
|
86 |
|
|
{ 0, 0,-DIST_CENTER },
|
87 |
|
|
{ 0, DIST_CENTER, 0 },
|
88 |
|
|
{ 0,-DIST_CENTER, 0 },
|
89 |
|
|
{ DIST_CENTER, 0, 0 },
|
90 |
|
|
{-DIST_CENTER, 0, 0 },
|
91 |
|
|
};
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
return mPosition;
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
98 |
|
|
|
99 |
|
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
100 |
|
|
{
|
101 |
|
|
if( mQuatIndex==null )
|
102 |
|
|
{
|
103 |
|
|
mQuatIndex = new int[] { 0,10,11,3,6,2,1,8,
|
104 |
|
|
0,4,11,5,7,12,13,6,10,20,3,18,
|
105 |
|
|
0,3,10,11,7,6 };
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
return mObjectQuats[mQuatIndex[cubit]];
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
112 |
|
|
|
113 |
84a17011
|
Leszek Koltunski
|
private float[][] getVertices(int variant)
|
114 |
60bed292
|
Leszek Koltunski
|
{
|
115 |
|
|
float X = variant==0 ? SHORT_EDGE : LONG_EDGE;
|
116 |
|
|
float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE;
|
117 |
|
|
float Z = SHORT_EDGE;
|
118 |
|
|
|
119 |
84a17011
|
Leszek Koltunski
|
return new float[][]
|
120 |
60bed292
|
Leszek Koltunski
|
{
|
121 |
|
|
{ -X,-Y,-Z },
|
122 |
|
|
{ -X,-Y,+Z },
|
123 |
|
|
{ -X,+Y,-Z },
|
124 |
|
|
{ -X,+Y,+Z },
|
125 |
|
|
{ +X,-Y,-Z },
|
126 |
|
|
{ +X,-Y,+Z },
|
127 |
|
|
{ +X,+Y,-Z },
|
128 |
|
|
{ +X,+Y,+Z },
|
129 |
|
|
};
|
130 |
84a17011
|
Leszek Koltunski
|
}
|
131 |
|
|
|
132 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
133 |
60bed292
|
Leszek Koltunski
|
|
134 |
84a17011
|
Leszek Koltunski
|
public ObjectShape getObjectShape(int variant)
|
135 |
|
|
{
|
136 |
60bed292
|
Leszek Koltunski
|
int[][] indices =
|
137 |
|
|
{
|
138 |
|
|
{1,5,7,3},
|
139 |
|
|
{3,7,6,2},
|
140 |
|
|
{5,4,6,7},
|
141 |
|
|
{0,1,3,2},
|
142 |
|
|
{4,0,2,6},
|
143 |
|
|
{0,4,5,1}
|
144 |
|
|
};
|
145 |
|
|
|
146 |
84a17011
|
Leszek Koltunski
|
return new ObjectShape(getVertices(variant), indices);
|
147 |
60bed292
|
Leszek Koltunski
|
}
|
148 |
|
|
|
149 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
150 |
|
|
|
151 |
|
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
152 |
|
|
{
|
153 |
|
|
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
154 |
|
|
float h2 = 0.001f;
|
155 |
84a17011
|
Leszek Koltunski
|
float[][] bands = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
|
156 |
|
|
|
157 |
|
|
if( variant==0 )
|
158 |
|
|
{
|
159 |
|
|
int[] indices = { 0,0,0,1,1,1 };
|
160 |
|
|
return new ObjectFaceShape(bands,indices,null);
|
161 |
|
|
}
|
162 |
|
|
if( variant==1 )
|
163 |
|
|
{
|
164 |
|
|
int[] indices = { 0,0,1,1,1,1 };
|
165 |
|
|
return new ObjectFaceShape(bands,indices,null);
|
166 |
|
|
}
|
167 |
|
|
else
|
168 |
|
|
{
|
169 |
|
|
int[] indices = { 0,1,1,1,1,1 };
|
170 |
|
|
return new ObjectFaceShape(bands,indices,null);
|
171 |
|
|
}
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
175 |
|
|
|
176 |
|
|
public ObjectVertexEffects getVertexEffects(int variant)
|
177 |
|
|
{
|
178 |
60bed292
|
Leszek Koltunski
|
float[][] centers = { { 0.0f, 0.0f, 0.0f} };
|
179 |
|
|
float[][] corners = { {0.04f,0.10f} };
|
180 |
|
|
|
181 |
|
|
if( variant==0 )
|
182 |
|
|
{
|
183 |
84a17011
|
Leszek Koltunski
|
int[] indices = { -1,0,0,0,0,0,0,0 };
|
184 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
185 |
60bed292
|
Leszek Koltunski
|
}
|
186 |
|
|
if( variant==1 )
|
187 |
|
|
{
|
188 |
84a17011
|
Leszek Koltunski
|
int[] indices = { -1,0,0,0,-1,0,0,0 };
|
189 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
190 |
60bed292
|
Leszek Koltunski
|
}
|
191 |
|
|
else
|
192 |
|
|
{
|
193 |
84a17011
|
Leszek Koltunski
|
int[] indices = { -1,0,-1,0,-1,0,-1,0 };
|
194 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
195 |
60bed292
|
Leszek Koltunski
|
}
|
196 |
|
|
}
|
197 |
|
|
|
198 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
199 |
|
|
|
200 |
|
|
public int getNumCubitVariants(int[] numLayers)
|
201 |
|
|
{
|
202 |
|
|
return 3;
|
203 |
|
|
}
|
204 |
|
|
|
205 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
206 |
|
|
|
207 |
|
|
public int getCubitVariant(int cubit, int[] numLayers)
|
208 |
|
|
{
|
209 |
|
|
return cubit<8 ? 0 : (cubit<20?1:2);
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
213 |
|
|
// PUBLIC API
|
214 |
|
|
|
215 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
216 |
|
|
|
217 |
|
|
public String getShortName()
|
218 |
|
|
{
|
219 |
|
|
return ObjectType.MIXU_3.name();
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
223 |
|
|
|
224 |
|
|
public ObjectSignature getSignature()
|
225 |
|
|
{
|
226 |
|
|
return new ObjectSignature(ObjectType.MIXU_3);
|
227 |
|
|
}
|
228 |
|
|
|
229 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
230 |
|
|
|
231 |
|
|
public String getObjectName()
|
232 |
|
|
{
|
233 |
|
|
return "Mixup Cube";
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
237 |
|
|
|
238 |
|
|
public String getInventor()
|
239 |
|
|
{
|
240 |
|
|
return "Sergey Makarov";
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
244 |
|
|
|
245 |
|
|
public int getYearOfInvention()
|
246 |
|
|
{
|
247 |
|
|
return 1985;
|
248 |
|
|
}
|
249 |
|
|
|
250 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
251 |
|
|
|
252 |
|
|
public int getComplexity()
|
253 |
|
|
{
|
254 |
|
|
return 2;
|
255 |
|
|
}
|
256 |
|
|
|
257 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
258 |
|
|
|
259 |
|
|
public String[][] getTutorials()
|
260 |
|
|
{
|
261 |
|
|
return new String[][]{
|
262 |
|
|
{"gb","w0DmJYwNI3Q","How to Solve the Mixup Cube","Z3"},
|
263 |
|
|
{"es","wHyf1imdAi4","Resolver Mixup 3x3","Cuby"},
|
264 |
|
|
{"ru","PN2ntFP6sfs","Как собрать Mixup","Цель+Действие=Результат"},
|
265 |
|
|
{"fr","QWsFaw0zUJU","Résolution du Mixup Cube","skieur cubb"},
|
266 |
|
|
{"de","vvDPyByyLyQ","Lösung für den 3x3x3 Mixup Cube","rofrisch"},
|
267 |
|
|
{"pl","TpG6MzWmwLQ","Mixup 3x3x3 Cube Tutorial","MrUK"},
|
268 |
|
|
{"br","_63j3i4Xa78","3x3 Mixup cube Tutorial 1/3","Cubo vicio"},
|
269 |
|
|
{"br","qpTnQavPLEI","3x3 Mixup cube Tutorial 2/3","Cubo vicio"},
|
270 |
|
|
{"br","nrFEm1ygcV4","3x3 Mixup cube Tutorial 3/3","Cubo vicio"},
|
271 |
|
|
{"kr","Ag4XkmC2v6c","3x3x3 믹스업 (Mix-up) 큐브 해법","듀나메스 큐브 해법연구소"},
|
272 |
|
|
{"vn","mWW6HYbvvh8","Mixup 3x3 Tutorial","VĂN CÔNG TÙNG"},
|
273 |
|
|
};
|
274 |
|
|
}
|
275 |
|
|
}
|