Project

General

Profile

Download (12.7 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyMixup3x3Plus.java @ 60bed292

1
///////////////////////////////////////////////////////////////////////////////////////////////////
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
import org.distorted.library.type.Static3D;
23
import org.distorted.library.type.Static4D;
24
import org.distorted.objectlib.helpers.ObjectFaceShape;
25
import org.distorted.objectlib.helpers.ObjectShape;
26
import org.distorted.objectlib.helpers.ObjectSignature;
27
import org.distorted.objectlib.main.ObjectType;
28

    
29
import java.io.InputStream;
30

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

    
33
public class TwistyMixup3x3Plus extends TwistyMixup
34
{
35
  public TwistyMixup3x3Plus(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
36
    {
37
    super(numL, meshState, iconMode, quat, move, scale, stream);
38
    }
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

    
42
  public float[][] getCuts(int[] numLayers)
43
    {
44
    if( mCuts==null )
45
      {
46
      float C = (6*SQ2-3)/14;
47
      float[] cut = new float[] {-C,+C};
48
      mCuts = new float[][] { cut,cut,cut };
49
      }
50

    
51
    return mCuts;
52
    }
53

    
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

    
56
  public float[][] getCubitPositions(int[] numLayers)
57
    {
58
    if( mPosition==null )
59
      {
60
      float SHORT_EDGE = 1.5f-0.75f*SQ2;
61
      float LONG_EDGE  = 1.5f*(SQ2-1);
62

    
63
      final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
64
      final float DIST_EDGE   = 1.5f*LONG_EDGE+SHORT_EDGE;
65
      final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
66
      final float DIST_SMALL  = 2.0f*LONG_EDGE+SHORT_EDGE;
67
      final float DIST        = 0.5f*LONG_EDGE+SHORT_EDGE;
68

    
69
      mPosition = new float[][]
70
         {
71
             { DIST_CORNER, DIST_CORNER, DIST_CORNER },
72
             { DIST_CORNER, DIST_CORNER,-DIST_CORNER },
73
             { DIST_CORNER,-DIST_CORNER, DIST_CORNER },
74
             { DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
75
             {-DIST_CORNER, DIST_CORNER, DIST_CORNER },
76
             {-DIST_CORNER, DIST_CORNER,-DIST_CORNER },
77
             {-DIST_CORNER,-DIST_CORNER, DIST_CORNER },
78
             {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
79

    
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
             { DIST_EDGE, DIST_EDGE,      0.0f },
85
             { DIST_EDGE,-DIST_EDGE,      0.0f },
86
             {-DIST_EDGE,-DIST_EDGE,      0.0f },
87
             {-DIST_EDGE, DIST_EDGE,      0.0f },
88
             {      0.0f, DIST_EDGE,-DIST_EDGE },
89
             { DIST_EDGE,      0.0f,-DIST_EDGE },
90
             {      0.0f,-DIST_EDGE,-DIST_EDGE },
91
             {-DIST_EDGE,      0.0f,-DIST_EDGE },
92

    
93
             {           0,        DIST,  DIST_SMALL },
94
             {        DIST,           0,  DIST_SMALL },
95
             {           0,       -DIST,  DIST_SMALL },
96
             {       -DIST,           0,  DIST_SMALL },
97
             {           0,        DIST, -DIST_SMALL },
98
             {        DIST,           0, -DIST_SMALL },
99
             {           0,       -DIST, -DIST_SMALL },
100
             {       -DIST,           0, -DIST_SMALL },
101
             {           0,  DIST_SMALL,       -DIST },
102
             {        DIST,  DIST_SMALL,           0 },
103
             {           0,  DIST_SMALL,        DIST },
104
             {       -DIST,  DIST_SMALL,           0 },
105
             {           0, -DIST_SMALL,       -DIST },
106
             {        DIST, -DIST_SMALL,           0 },
107
             {           0, -DIST_SMALL,        DIST },
108
             {       -DIST, -DIST_SMALL,           0 },
109
             {  DIST_SMALL,        DIST,           0 },
110
             {  DIST_SMALL,           0,       -DIST },
111
             {  DIST_SMALL,       -DIST,           0 },
112
             {  DIST_SMALL,           0,        DIST },
113
             { -DIST_SMALL,        DIST,           0 },
114
             { -DIST_SMALL,           0,       -DIST },
115
             { -DIST_SMALL,       -DIST,           0 },
116
             { -DIST_SMALL,           0,        DIST },
117

    
118
             {           0,           0, DIST_CENTER },
119
             {           0,           0,-DIST_CENTER },
120
             {           0, DIST_CENTER,           0 },
121
             {           0,-DIST_CENTER,           0 },
122
             { DIST_CENTER,           0,           0 },
123
             {-DIST_CENTER,           0,           0 },
124
         };
125
      }
126

    
127
    return mPosition;
128
    }
129

    
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

    
132
  public Static4D getCubitQuats(int cubit, int[] numLayers)
133
    {
134
    if( mQuatIndex==null )
135
      {
136
      mQuatIndex = new int[] { 0,10,11,3,6,2,1,8,
137
                               0,4,11,5,7,12,13,6,10,20,3,18,
138
                               0,4,0,4, 3,15,3,15, 10,16,10,16, 11,19,11,19, 7,17,7,17, 6,18,6,18,
139
                               0,3,10,11,7,6 };
140
      }
141

    
142
    return mObjectQuats[mQuatIndex[cubit]];
143
    }
144

    
145
///////////////////////////////////////////////////////////////////////////////////////////////////
146

    
147
  public ObjectShape getObjectShape(int variant)
148
    {
149
    float SHORT_EDGE = 1.5f-0.75f*SQ2;
150
    float LONG_EDGE  = 1.5f*(SQ2-1);
151

    
152
    if( variant==0 || variant==3 )
153
      {
154
      float X = variant==0 ? LONG_EDGE : SHORT_EDGE;
155
      float Y = variant==0 ? LONG_EDGE : SHORT_EDGE;
156
      float Z = LONG_EDGE;
157

    
158
      float[][] vertices =
159
          {
160
              { -X,-Y,-Z },
161
              { -X,-Y,+Z },
162
              { -X,+Y,-Z },
163
              { -X,+Y,+Z },
164
              { +X,-Y,-Z },
165
              { +X,-Y,+Z },
166
              { +X,+Y,-Z },
167
              { +X,+Y,+Z },
168
          };
169

    
170
      int[][] indices =
171
          {
172
              {1,5,7,3},
173
              {3,7,6,2},
174
              {5,4,6,7},
175
              {0,1,3,2},
176
              {4,0,2,6},
177
              {0,4,5,1}
178
          };
179

    
180
      return new ObjectShape(vertices, indices);
181
      }
182
    else if( variant==1 )
183
      {
184
      float X = SHORT_EDGE;
185
      float Y = LONG_EDGE/2;
186
      float Z = LONG_EDGE/2;
187

    
188
      float[][] vertices =
189
          {
190
              { -X,+Y,+Z },
191
              { -X,+Y,-Z },
192
              { +X,+Y,-Z },
193
              { +X,+Y,+Z },
194
              { -X,-Y,+Z },
195
              { +X,-Y,+Z },
196
              { -X,-Y,-3*Z },
197
              { +X,-Y,-3*Z },
198
              { +X,-3*Y,-Z },
199
              { -X,-3*Y,-Z },
200
          };
201

    
202
      int[][] indices =
203
          {
204
              {0,3,2,1},
205
              {4,5,3,0},
206
              {8,7,2,3,5},
207
              {6,9,4,0,1},
208
              {9,8,5,4},
209
              {7,6,1,2},
210
              {6,7,8,9}
211
          };
212

    
213
      return new ObjectShape(vertices, indices);
214
      }
215
    else
216
      {
217
      float X = SHORT_EDGE;
218
      float Y = LONG_EDGE/2;
219

    
220
      float[][] vertices =
221
          {
222
              { -X,-Y, 0 },
223
              { -X,+Y, 0 },
224
              { +X,-Y, 0 },
225
              { +X,+Y, 0 },
226
              { -X, 0,-Y },
227
              { +X, 0,-Y }
228
          };
229

    
230
      int[][] indices =
231
          {
232
              {0,2,3,1},
233
              {2,5,3},
234
              {1,4,0},
235
              {0,4,5,2},
236
              {3,5,4,1}
237
          };
238

    
239
      return new ObjectShape(vertices, indices);
240
      }
241
    }
242

    
243
///////////////////////////////////////////////////////////////////////////////////////////////////
244

    
245
  public ObjectFaceShape getObjectFaceShape(int variant)
246
    {
247
    float h1 = isInIconMode() ? 0.001f : 0.06f;
248
    float h2 = 0.001f;
249
    float[][] bands   = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
250
    float[][] centers = { { 0.0f, 0.0f, 0.0f} };
251
    float[][] corners = { {0.04f,0.10f} };
252

    
253
    if( variant==0 )
254
      {
255
      int[] bandIndices = { 0,0,0,1,1,1 };
256
      int[] indices     = { -1,0,0,0,0,0,0,0 };
257
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
258
      }
259
    if( variant==1 )
260
      {
261
      int[] bandIndices = { 0,0,1,1,1,1,1 };
262
      int[] indices     = { 0,0,0,0,0,0,-1,-1,-1,-1 };
263
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
264
      }
265
    if( variant==2 )
266
      {
267
      int[] bandIndices = { 0,1,1,1,1 };
268
      int[] indices     = { 0,0,0,0,-1,-1 };
269
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
270
      }
271
    else
272
      {
273
      int[] bandIndices = { 0,1,1,1,1,1 };
274
      int[] indices     = { -1,0,-1,0,-1,0,-1,0 };
275
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
276
      }
277
    }
278

    
279
///////////////////////////////////////////////////////////////////////////////////////////////////
280

    
281
  public int getNumCubitVariants(int[] numLayers)
282
    {
283
    return 4;
284
    }
285

    
286
///////////////////////////////////////////////////////////////////////////////////////////////////
287

    
288
  public int getCubitVariant(int cubit, int[] numLayers)
289
    {
290
    return cubit<8 ? 0 : (cubit<20 ? 1 : (cubit<44?2:3));
291
    }
292

    
293
///////////////////////////////////////////////////////////////////////////////////////////////////
294
// PUBLIC API
295

    
296
///////////////////////////////////////////////////////////////////////////////////////////////////
297

    
298
  public String getShortName()
299
    {
300
    return ObjectType.MIXP_3.name();
301
    }
302

    
303
///////////////////////////////////////////////////////////////////////////////////////////////////
304

    
305
  public ObjectSignature getSignature()
306
    {
307
    return new ObjectSignature(ObjectType.MIXP_3);
308
    }
309

    
310
///////////////////////////////////////////////////////////////////////////////////////////////////
311

    
312
  public String getObjectName()
313
    {
314
    return "Mixup Plus Cube";
315
    }
316

    
317
///////////////////////////////////////////////////////////////////////////////////////////////////
318

    
319
  public String getInventor()
320
    {
321
    return "Guan Yang";
322
    }
323

    
324
///////////////////////////////////////////////////////////////////////////////////////////////////
325

    
326
  public int getYearOfInvention()
327
    {
328
    return 2012;
329
    }
330

    
331
///////////////////////////////////////////////////////////////////////////////////////////////////
332

    
333
  public int getComplexity()
334
    {
335
    return 2;
336
    }
337

    
338
///////////////////////////////////////////////////////////////////////////////////////////////////
339

    
340
  public String[][] getTutorials()
341
    {
342
    return new String[][]{
343
                          {"gb","0ABxlmD6AYQ","3x3 Mixup Plus Tutorial","Superantoniovivaldi"},
344
                          {"es","s19NAGbkbw4","Tutorial Mixup Plus 3x3x3","Kubekings"},
345
                          {"fr","QWsFaw0zUJU","Résolution du Mixup Plus","skieur cubb"},
346
                          {"ru","cdtK86ZeF2w","Как собрать Mixup plus 1/3","Иван Циков"},
347
                          {"ru","OHg0MfM2iEU","Как собрать Mixup plus 2/3","Иван Циков"},
348
                          {"ru","rtQoRAoMRS8","Как собрать Mixup plus 3/3","Иван Циков"},
349
                          {"pl","8Bm0LNsGfIs","Mixup 3x3x3 Plus TUTORIAL PL","MrUK"},
350
                          {"kr","80QKOZXGtBs","믹스업 플러스 (Mix-up Plus) 해법","듀나메스 큐브 해법연구소"},
351
                          {"vn","vuIfGk1Asmc","Tutorial N.206 - Mixup Plus","Duy Thích Rubik"},
352
                         };
353
    }
354
}
(25-25/39)