Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyMixup3x3.java @ 5d09301e

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 org.distorted.library.type.Static3D;
13
import org.distorted.library.type.Static4D;
14
import org.distorted.objectlib.helpers.ObjectFaceShape;
15
import org.distorted.objectlib.helpers.ObjectShape;
16
import org.distorted.objectlib.helpers.ObjectSignature;
17
import org.distorted.objectlib.main.InitData;
18
import org.distorted.objectlib.main.ObjectType;
19

    
20
import java.io.InputStream;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

    
24
public class TwistyMixup3x3 extends TwistyMixup
25
{
26
  private static final float SHORT_EDGE = 1.5f-0.75f*SQ2;
27
  private static final float LONG_EDGE  = 1.5f*(SQ2-1);
28

    
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

    
31
  public TwistyMixup3x3(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
32
    {
33
    super(data, meshState, iconMode, quat, move, scale, stream);
34
    }
35

    
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

    
38
  public float[][] getCuts(int[] numLayers)
39
    {
40
    if( mCuts==null )
41
      {
42
      float[] cut = new float[] {-LONG_EDGE,+LONG_EDGE};
43
      mCuts = new float[][] { cut,cut,cut };
44
      }
45

    
46
    return mCuts;
47
    }
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

    
51
  public float[][] getCubitPositions(int[] numLayers)
52
    {
53
    if( mPosition==null )
54
      {
55
      final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
56
      final float DIST_EDGE   = LONG_EDGE+SHORT_EDGE;
57
      final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
58

    
59
      mPosition = new float[][]
60
         {
61
             { DIST_CORNER, DIST_CORNER, DIST_CORNER },
62
             { DIST_CORNER, DIST_CORNER,-DIST_CORNER },
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

    
70
             {      0.0f, DIST_EDGE, DIST_EDGE },
71
             { DIST_EDGE,      0.0f, DIST_EDGE },
72
             {      0.0f,-DIST_EDGE, DIST_EDGE },
73
             {-DIST_EDGE,      0.0f, DIST_EDGE },
74
             { DIST_EDGE, DIST_EDGE,      0.0f },
75
             { DIST_EDGE,-DIST_EDGE,      0.0f },
76
             {-DIST_EDGE,-DIST_EDGE,      0.0f },
77
             {-DIST_EDGE, DIST_EDGE,      0.0f },
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

    
83
             {           0,           0, DIST_CENTER },
84
             {           0,           0,-DIST_CENTER },
85
             {           0, DIST_CENTER,           0 },
86
             {           0,-DIST_CENTER,           0 },
87
             { DIST_CENTER,           0,           0 },
88
             {-DIST_CENTER,           0,           0 },
89
         };
90
      }
91

    
92
    return mPosition;
93
    }
94

    
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96

    
97
  public Static4D getCubitQuats(int cubit, int[] numLayers)
98
    {
99
    if( mQuatIndex==null )
100
      {
101
      mQuatIndex = new int[] { 0,10,11,3,6,2,1,8,
102
                               0,4,11,5,7,12,13,6,10,20,3,18,
103
                               0,3,10,11,7,6 };
104
      }
105

    
106
    return mObjectQuats[mQuatIndex[cubit]];
107
    }
108

    
109
///////////////////////////////////////////////////////////////////////////////////////////////////
110

    
111
  public ObjectShape getObjectShape(int variant)
112
    {
113
    float X = variant==0 ? SHORT_EDGE : LONG_EDGE;
114
    float Y = variant<=1 ? SHORT_EDGE : LONG_EDGE;
115
    float Z = SHORT_EDGE;
116

    
117
    float[][] vertices =
118
          {
119
              { -X,-Y,-Z },
120
              { -X,-Y,+Z },
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
          };
128

    
129
    int[][] indices =
130
          {
131
              {1,5,7,3},
132
              {3,7,6,2},
133
              {5,4,6,7},
134
              {0,1,3,2},
135
              {4,0,2,6},
136
              {0,4,5,1}
137
          };
138

    
139
    return new ObjectShape(vertices, indices);
140
    }
141

    
142
///////////////////////////////////////////////////////////////////////////////////////////////////
143

    
144
  public ObjectFaceShape getObjectFaceShape(int variant)
145
    {
146
    float h1 = isInIconMode() ? 0.001f : 0.06f;
147
    float h2 = 0.001f;
148
    float[][] bands   = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
149
    float[][] centers = { { 0.0f, 0.0f, 0.0f} };
150
    float[][] corners = { {0.04f,0.10f} };
151

    
152
    if( variant==0 )
153
      {
154
      int[] bandIndices = { 0,0,0,1,1,1 };
155
      int[] indices     = { -1,0,0,0,0,0,0,0 };
156
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
157
      }
158
    if( variant==1 )
159
      {
160
      int[] bandIndices = { 0,0,1,1,1,1 };
161
      int[] indices     = { -1,0,0,0,-1,0,0,0 };
162
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
163
      }
164
    else
165
      {
166
      int[] bandIndices = { 0,1,1,1,1,1 };
167
      int[] indices     = { -1,0,-1,0,-1,0,-1,0 };
168
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
169
      }
170
    }
171

    
172
///////////////////////////////////////////////////////////////////////////////////////////////////
173

    
174
  public int getNumCubitVariants(int[] numLayers)
175
    {
176
    return 3;
177
    }
178

    
179
///////////////////////////////////////////////////////////////////////////////////////////////////
180

    
181
  public int getCubitVariant(int cubit, int[] numLayers)
182
    {
183
    return cubit<8 ? 0 : (cubit<20?1:2);
184
    }
185

    
186
///////////////////////////////////////////////////////////////////////////////////////////////////
187
// PUBLIC API
188

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

    
191
  public String getShortName()
192
    {
193
    return ObjectType.MIXU_3.name();
194
    }
195

    
196
///////////////////////////////////////////////////////////////////////////////////////////////////
197

    
198
  public ObjectSignature getSignature()
199
    {
200
    return new ObjectSignature(ObjectType.MIXU_3);
201
    }
202

    
203
///////////////////////////////////////////////////////////////////////////////////////////////////
204

    
205
  public String getObjectName()
206
    {
207
    return "Mixup Cube";
208
    }
209

    
210
///////////////////////////////////////////////////////////////////////////////////////////////////
211

    
212
  public String getInventor()
213
    {
214
    return "Sergey Makarov";
215
    }
216

    
217
///////////////////////////////////////////////////////////////////////////////////////////////////
218

    
219
  public int getYearOfInvention()
220
    {
221
    return 1985;
222
    }
223

    
224
///////////////////////////////////////////////////////////////////////////////////////////////////
225

    
226
  public int getComplexity()
227
    {
228
    return 2;
229
    }
230

    
231
///////////////////////////////////////////////////////////////////////////////////////////////////
232

    
233
  public String[][] getTutorials()
234
    {
235
    return new String[][]{
236
                          {"gb","w0DmJYwNI3Q","How to Solve the Mixup Cube","Z3"},
237
                          {"es","wHyf1imdAi4","Resolver Mixup 3x3","Cuby"},
238
                          {"ru","PN2ntFP6sfs","Как собрать Mixup","Цель+Действие=Результат"},
239
                          {"fr","QWsFaw0zUJU","Résolution du Mixup Cube","skieur cubb"},
240
                          {"de","vvDPyByyLyQ","Lösung für den 3x3x3 Mixup Cube","rofrisch"},
241
                          {"pl","TpG6MzWmwLQ","Mixup 3x3x3 Cube Tutorial","MrUK"},
242
                          {"br","_63j3i4Xa78","3x3 Mixup cube Tutorial 1/3","Cubo vicio"},
243
                          {"br","qpTnQavPLEI","3x3 Mixup cube Tutorial 2/3","Cubo vicio"},
244
                          {"br","nrFEm1ygcV4","3x3 Mixup cube Tutorial 3/3","Cubo vicio"},
245
                          {"kr","Ag4XkmC2v6c","3x3x3 믹스업 (Mix-up) 큐브 해법","듀나메스 큐브 해법연구소"},
246
                          {"vn","mWW6HYbvvh8","Mixup 3x3 Tutorial","VĂN CÔNG TÙNG"},
247
                         };
248
    }
249
}
(21-21/36)