Project

General

Profile

« Previous | Next » 

Revision 60bed292

Added by Leszek Koltunski almost 2 years ago

Mixup Plus Cube: beginnings

View differences:

src/main/java/org/distorted/objectlib/main/ObjectSignatures.java
73 73
  public static final int STAR_3 = ObjectType.STAR_3.ordinal();
74 74
  public static final int PENT_2 = ObjectType.PENT_2.ordinal();
75 75
  public static final int MIXU_3 = ObjectType.MIXU_3.ordinal();
76
  public static final int MIXP_3 = ObjectType.MIXP_3.ordinal();
76 77
  }
src/main/java/org/distorted/objectlib/main/ObjectType.java
79 79
  SKEW_3 ( TwistySkewb.class         , new int[] {3,3,3,3}    , 21, R.drawable.skew_3, true),
80 80
  CONT_2 ( TwistyContainer.class     , new int[] {2,2,2,2}    , 12, R.drawable.cont_2, true),
81 81

  
82
  MIXU_3 ( TwistyMixup3x3.class      , new int[] {3,3,3}      , 24, R.drawable.mixu_3, true),
83
  MIXP_3 ( TwistyMixup3x3Plus.class  , new int[] {3,3,3}      , 28, R.drawable.mixu_3, true),
84

  
82 85
  VOID_3 ( TwistyVoid.class          , new int[] {3,3,3}      , 17, R.drawable.void_3, false),  // wasDownloadableButNowIsBuiltIn()
83 86
  CRYS_3 ( TwistyCrystal.class       , new int[] {3,3,3,3,3,3}, 27, R.drawable.crys_3, false),  // function!
84 87
  STAR_3 ( TwistyStarminx.class      , new int[] {3,3,3,3,3,3}, 27, R.drawable.star_3, false),
85 88
  PENT_2 ( TwistyPentultimate.class  , new int[] {2,2,2,2,2,2}, 21, R.drawable.pent_2, false),
86
  MIXU_3 ( TwistyMixup.class         , new int[] {3,3,3}      , 24, R.drawable.mixu_3, false),
89

  
87 90
  ;
88 91

  
89 92
  public static int NUM_OBJECTS;
src/main/java/org/distorted/objectlib/objects/TwistyMixup.java
21 21

  
22 22
import org.distorted.library.type.Static3D;
23 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 24
import org.distorted.objectlib.main.ShapeHexahedron;
29 25
import org.distorted.objectlib.scrambling.ScrambleState;
30 26
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
......
36 32

  
37 33
///////////////////////////////////////////////////////////////////////////////////////////////////
38 34

  
39
public class TwistyMixup extends ShapeHexahedron
35
abstract class TwistyMixup extends ShapeHexahedron
40 36
{
41 37
  static final Static3D[] ROT_AXIS = new Static3D[]
42 38
         {
......
45 41
           new Static3D(0,0,1)
46 42
         };
47 43

  
48
  private ScrambleState[] mStates;
49
  private int[][] mBasicAngle;
50
  private float[][] mCuts;
51
  private float[][] mPosition;
52
  private int[] mQuatIndex;
44
  ScrambleState[] mStates;
45
  int[][] mBasicAngle;
46
  float[][] mCuts;
47
  float[][] mPosition;
48
  int[] mQuatIndex;
53 49

  
54 50
///////////////////////////////////////////////////////////////////////////////////////////////////
55 51

  
......
368 364
    return mStates;
369 365
    }
370 366

  
371
///////////////////////////////////////////////////////////////////////////////////////////////////
372

  
373
  public float[][] getCuts(int[] numLayers)
374
    {
375
    if( mCuts==null )
376
      {
377
      float C = 1.5f*(SQ2-1);
378
      float[] cut = new float[] {-C,+C};
379
      mCuts = new float[][] { cut,cut,cut };
380
      }
381

  
382
    return mCuts;
383
    }
384

  
385 367
///////////////////////////////////////////////////////////////////////////////////////////////////
386 368

  
387 369
  public boolean[][] getLayerRotatable(int[] numLayers)
......
425 407
    return TouchControlHexahedron.FACE_AXIS;
426 408
    }
427 409

  
428
///////////////////////////////////////////////////////////////////////////////////////////////////
429

  
430
  public float[][] getCubitPositions(int[] numLayers)
431
    {
432
    if( mPosition==null )
433
      {
434
      float SHORT_EDGE = 1.5f-0.75f*SQ2;
435
      float LONG_EDGE  = 1.5f*(SQ2-1);
436

  
437
      final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
438
      final float DIST_EDGE   = LONG_EDGE+SHORT_EDGE;
439
      final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
440

  
441
      mPosition = new float[][]
442
         {
443
             { DIST_CORNER, DIST_CORNER, DIST_CORNER },
444
             { DIST_CORNER, DIST_CORNER,-DIST_CORNER },
445
             { DIST_CORNER,-DIST_CORNER, DIST_CORNER },
446
             { DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
447
             {-DIST_CORNER, DIST_CORNER, DIST_CORNER },
448
             {-DIST_CORNER, DIST_CORNER,-DIST_CORNER },
449
             {-DIST_CORNER,-DIST_CORNER, DIST_CORNER },
450
             {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
451

  
452
             {      0.0f, DIST_EDGE, DIST_EDGE },
453
             { DIST_EDGE,      0.0f, DIST_EDGE },
454
             {      0.0f,-DIST_EDGE, DIST_EDGE },
455
             {-DIST_EDGE,      0.0f, DIST_EDGE },
456
             { DIST_EDGE, DIST_EDGE,      0.0f },
457
             { DIST_EDGE,-DIST_EDGE,      0.0f },
458
             {-DIST_EDGE,-DIST_EDGE,      0.0f },
459
             {-DIST_EDGE, DIST_EDGE,      0.0f },
460
             {      0.0f, DIST_EDGE,-DIST_EDGE },
461
             { DIST_EDGE,      0.0f,-DIST_EDGE },
462
             {      0.0f,-DIST_EDGE,-DIST_EDGE },
463
             {-DIST_EDGE,      0.0f,-DIST_EDGE },
464

  
465
             {           0,           0, DIST_CENTER },
466
             {           0,           0,-DIST_CENTER },
467
             {           0, DIST_CENTER,           0 },
468
             {           0,-DIST_CENTER,           0 },
469
             { DIST_CENTER,           0,           0 },
470
             {-DIST_CENTER,           0,           0 },
471
         };
472
      }
473

  
474
    return mPosition;
475
    }
476

  
477
///////////////////////////////////////////////////////////////////////////////////////////////////
478

  
479
  public Static4D getCubitQuats(int cubit, int[] numLayers)
480
    {
481
    if( mQuatIndex==null )
482
      {
483
      mQuatIndex = new int[] { 0,10,11,3,6,2,1,8,
484
                               0,4,11,5,7,12,13,6,10,20,3,18,
485
                               0,3,10,11,7,6 };
486
      }
487

  
488
    return mObjectQuats[mQuatIndex[cubit]];
489
    }
490

  
491
///////////////////////////////////////////////////////////////////////////////////////////////////
492

  
493
  public ObjectShape getObjectShape(int variant)
494
    {
495
    float SHORT_EDGE = 1.5f-0.75f*SQ2;
496
    float LONG_EDGE  = 1.5f*(SQ2-1);
497
    float X = variant==0 ? SHORT_EDGE : LONG_EDGE;
498
    float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE;
499
    float Z = SHORT_EDGE;
500

  
501
    float[][] vertices =
502
          {
503
              { -X,-Y,-Z },
504
              { -X,-Y,+Z },
505
              { -X,+Y,-Z },
506
              { -X,+Y,+Z },
507
              { +X,-Y,-Z },
508
              { +X,-Y,+Z },
509
              { +X,+Y,-Z },
510
              { +X,+Y,+Z },
511
          };
512

  
513
    int[][] indices =
514
          {
515
              {1,5,7,3},
516
              {3,7,6,2},
517
              {5,4,6,7},
518
              {0,1,3,2},
519
              {4,0,2,6},
520
              {0,4,5,1}
521
          };
522

  
523
    return new ObjectShape(vertices, indices);
524
    }
525

  
526
///////////////////////////////////////////////////////////////////////////////////////////////////
527

  
528
  public ObjectFaceShape getObjectFaceShape(int variant)
529
    {
530
    float h1 = isInIconMode() ? 0.001f : 0.06f;
531
    float h2 = 0.001f;
532
    float[][] bands   = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
533
    float[][] centers = { { 0.0f, 0.0f, 0.0f} };
534
    float[][] corners = { {0.04f,0.10f} };
535

  
536
    if( variant==0 )
537
      {
538
      int[] bandIndices = { 0,0,0,1,1,1 };
539
      int[] indices     = { -1,0,0,0,0,0,0,0 };
540
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
541
      }
542
    if( variant==1 )
543
      {
544
      int[] bandIndices = { 0,0,1,1,1,1 };
545
      int[] indices     = { -1,0,0,0,-1,0,0,0 };
546
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
547
      }
548
    else
549
      {
550
      int[] bandIndices = { 0,1,1,1,1,1 };
551
      int[] indices     = { -1,0,-1,0,-1,0,-1,0 };
552
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
553
      }
554
    }
555

  
556
///////////////////////////////////////////////////////////////////////////////////////////////////
557

  
558
  public int getNumCubitVariants(int[] numLayers)
559
    {
560
    return 3;
561
    }
562

  
563
///////////////////////////////////////////////////////////////////////////////////////////////////
564

  
565
  public int getCubitVariant(int cubit, int[] numLayers)
566
    {
567
    return cubit<8 ? 0 : (cubit<20?1:2);
568
    }
569

  
570 410
///////////////////////////////////////////////////////////////////////////////////////////////////
571 411

  
572 412
  public float getStickerRadius()
......
608 448

  
609 449
    return mBasicAngle;
610 450
    }
611

  
612
///////////////////////////////////////////////////////////////////////////////////////////////////
613

  
614
  public String getShortName()
615
    {
616
    return ObjectType.MIXU_3.name();
617
    }
618

  
619
///////////////////////////////////////////////////////////////////////////////////////////////////
620

  
621
  public ObjectSignature getSignature()
622
    {
623
    return new ObjectSignature(ObjectType.MIXU_3);
624
    }
625

  
626
///////////////////////////////////////////////////////////////////////////////////////////////////
627

  
628
  public String getObjectName()
629
    {
630
    return "Mixup Cube";
631
    }
632

  
633
///////////////////////////////////////////////////////////////////////////////////////////////////
634

  
635
  public String getInventor()
636
    {
637
    return "Sergey Makarov";
638
    }
639

  
640
///////////////////////////////////////////////////////////////////////////////////////////////////
641

  
642
  public int getYearOfInvention()
643
    {
644
    return 1985;
645
    }
646

  
647
///////////////////////////////////////////////////////////////////////////////////////////////////
648

  
649
  public int getComplexity()
650
    {
651
    return 2;
652
    }
653

  
654
///////////////////////////////////////////////////////////////////////////////////////////////////
655

  
656
  public String[][] getTutorials()
657
    {
658
    return new String[][]{
659
                          {"gb","w0DmJYwNI3Q","How to Solve the Mixup Cube","Z3"},
660
                          {"es","wHyf1imdAi4","Resolver Mixup 3x3","Cuby"},
661
                          {"ru","PN2ntFP6sfs","Как собрать Mixup","Цель+Действие=Результат"},
662
                          {"fr","QWsFaw0zUJU","Résolution du Mixup Cube","skieur cubb"},
663
                          {"de","vvDPyByyLyQ","Lösung für den 3x3x3 Mixup Cube","rofrisch"},
664
                          {"pl","TpG6MzWmwLQ","Mixup 3x3x3 Cube Tutorial","MrUK"},
665
                          {"br","_63j3i4Xa78","3x3 Mixup cube Tutorial 1/3","Cubo vicio"},
666
                          {"br","qpTnQavPLEI","3x3 Mixup cube Tutorial 2/3","Cubo vicio"},
667
                          {"br","nrFEm1ygcV4","3x3 Mixup cube Tutorial 3/3","Cubo vicio"},
668
                          {"kr","Ag4XkmC2v6c","3x3x3 믹스업 (Mix-up) 큐브 해법","듀나메스 큐브 해법연구소"},
669
                          {"vn","mWW6HYbvvh8","Mixup 3x3 Tutorial","VĂN CÔNG TÙNG"},
670
                         };
671
    }
672 451
}
src/main/java/org/distorted/objectlib/objects/TwistyMixup3x3.java
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 TwistyMixup3x3 extends TwistyMixup
34
{
35
  public TwistyMixup3x3(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 = 1.5f*(SQ2-1);
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   = LONG_EDGE+SHORT_EDGE;
65
      final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
66

  
67
      mPosition = new float[][]
68
         {
69
             { DIST_CORNER, DIST_CORNER, DIST_CORNER },
70
             { DIST_CORNER, DIST_CORNER,-DIST_CORNER },
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

  
78
             {      0.0f, DIST_EDGE, DIST_EDGE },
79
             { DIST_EDGE,      0.0f, DIST_EDGE },
80
             {      0.0f,-DIST_EDGE, DIST_EDGE },
81
             {-DIST_EDGE,      0.0f, DIST_EDGE },
82
             { DIST_EDGE, DIST_EDGE,      0.0f },
83
             { DIST_EDGE,-DIST_EDGE,      0.0f },
84
             {-DIST_EDGE,-DIST_EDGE,      0.0f },
85
             {-DIST_EDGE, DIST_EDGE,      0.0f },
86
             {      0.0f, DIST_EDGE,-DIST_EDGE },
87
             { DIST_EDGE,      0.0f,-DIST_EDGE },
88
             {      0.0f,-DIST_EDGE,-DIST_EDGE },
89
             {-DIST_EDGE,      0.0f,-DIST_EDGE },
90

  
91
             {           0,           0, DIST_CENTER },
92
             {           0,           0,-DIST_CENTER },
93
             {           0, DIST_CENTER,           0 },
94
             {           0,-DIST_CENTER,           0 },
95
             { DIST_CENTER,           0,           0 },
96
             {-DIST_CENTER,           0,           0 },
97
         };
98
      }
99

  
100
    return mPosition;
101
    }
102

  
103
///////////////////////////////////////////////////////////////////////////////////////////////////
104

  
105
  public Static4D getCubitQuats(int cubit, int[] numLayers)
106
    {
107
    if( mQuatIndex==null )
108
      {
109
      mQuatIndex = new int[] { 0,10,11,3,6,2,1,8,
110
                               0,4,11,5,7,12,13,6,10,20,3,18,
111
                               0,3,10,11,7,6 };
112
      }
113

  
114
    return mObjectQuats[mQuatIndex[cubit]];
115
    }
116

  
117
///////////////////////////////////////////////////////////////////////////////////////////////////
118

  
119
  public ObjectShape getObjectShape(int variant)
120
    {
121
    float SHORT_EDGE = 1.5f-0.75f*SQ2;
122
    float LONG_EDGE  = 1.5f*(SQ2-1);
123
    float X = variant==0 ? SHORT_EDGE : LONG_EDGE;
124
    float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE;
125
    float Z = SHORT_EDGE;
126

  
127
    float[][] vertices =
128
          {
129
              { -X,-Y,-Z },
130
              { -X,-Y,+Z },
131
              { -X,+Y,-Z },
132
              { -X,+Y,+Z },
133
              { +X,-Y,-Z },
134
              { +X,-Y,+Z },
135
              { +X,+Y,-Z },
136
              { +X,+Y,+Z },
137
          };
138

  
139
    int[][] indices =
140
          {
141
              {1,5,7,3},
142
              {3,7,6,2},
143
              {5,4,6,7},
144
              {0,1,3,2},
145
              {4,0,2,6},
146
              {0,4,5,1}
147
          };
148

  
149
    return new ObjectShape(vertices, indices);
150
    }
151

  
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153

  
154
  public ObjectFaceShape getObjectFaceShape(int variant)
155
    {
156
    float h1 = isInIconMode() ? 0.001f : 0.06f;
157
    float h2 = 0.001f;
158
    float[][] bands   = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
159
    float[][] centers = { { 0.0f, 0.0f, 0.0f} };
160
    float[][] corners = { {0.04f,0.10f} };
161

  
162
    if( variant==0 )
163
      {
164
      int[] bandIndices = { 0,0,0,1,1,1 };
165
      int[] indices     = { -1,0,0,0,0,0,0,0 };
166
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
167
      }
168
    if( variant==1 )
169
      {
170
      int[] bandIndices = { 0,0,1,1,1,1 };
171
      int[] indices     = { -1,0,0,0,-1,0,0,0 };
172
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
173
      }
174
    else
175
      {
176
      int[] bandIndices = { 0,1,1,1,1,1 };
177
      int[] indices     = { -1,0,-1,0,-1,0,-1,0 };
178
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
179
      }
180
    }
181

  
182
///////////////////////////////////////////////////////////////////////////////////////////////////
183

  
184
  public int getNumCubitVariants(int[] numLayers)
185
    {
186
    return 3;
187
    }
188

  
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190

  
191
  public int getCubitVariant(int cubit, int[] numLayers)
192
    {
193
    return cubit<8 ? 0 : (cubit<20?1:2);
194
    }
195

  
196
///////////////////////////////////////////////////////////////////////////////////////////////////
197
// PUBLIC API
198

  
199
///////////////////////////////////////////////////////////////////////////////////////////////////
200

  
201
  public String getShortName()
202
    {
203
    return ObjectType.MIXU_3.name();
204
    }
205

  
206
///////////////////////////////////////////////////////////////////////////////////////////////////
207

  
208
  public ObjectSignature getSignature()
209
    {
210
    return new ObjectSignature(ObjectType.MIXU_3);
211
    }
212

  
213
///////////////////////////////////////////////////////////////////////////////////////////////////
214

  
215
  public String getObjectName()
216
    {
217
    return "Mixup Cube";
218
    }
219

  
220
///////////////////////////////////////////////////////////////////////////////////////////////////
221

  
222
  public String getInventor()
223
    {
224
    return "Sergey Makarov";
225
    }
226

  
227
///////////////////////////////////////////////////////////////////////////////////////////////////
228

  
229
  public int getYearOfInvention()
230
    {
231
    return 1985;
232
    }
233

  
234
///////////////////////////////////////////////////////////////////////////////////////////////////
235

  
236
  public int getComplexity()
237
    {
238
    return 2;
239
    }
240

  
241
///////////////////////////////////////////////////////////////////////////////////////////////////
242

  
243
  public String[][] getTutorials()
244
    {
245
    return new String[][]{
246
                          {"gb","w0DmJYwNI3Q","How to Solve the Mixup Cube","Z3"},
247
                          {"es","wHyf1imdAi4","Resolver Mixup 3x3","Cuby"},
248
                          {"ru","PN2ntFP6sfs","Как собрать Mixup","Цель+Действие=Результат"},
249
                          {"fr","QWsFaw0zUJU","Résolution du Mixup Cube","skieur cubb"},
250
                          {"de","vvDPyByyLyQ","Lösung für den 3x3x3 Mixup Cube","rofrisch"},
251
                          {"pl","TpG6MzWmwLQ","Mixup 3x3x3 Cube Tutorial","MrUK"},
252
                          {"br","_63j3i4Xa78","3x3 Mixup cube Tutorial 1/3","Cubo vicio"},
253
                          {"br","qpTnQavPLEI","3x3 Mixup cube Tutorial 2/3","Cubo vicio"},
254
                          {"br","nrFEm1ygcV4","3x3 Mixup cube Tutorial 3/3","Cubo vicio"},
255
                          {"kr","Ag4XkmC2v6c","3x3x3 믹스업 (Mix-up) 큐브 해법","듀나메스 큐브 해법연구소"},
256
                          {"vn","mWW6HYbvvh8","Mixup 3x3 Tutorial","VĂN CÔNG TÙNG"},
257
                         };
258
    }
259
}
src/main/java/org/distorted/objectlib/objects/TwistyMixup3x3Plus.java
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
}

Also available in: Unified diff