Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyMixup3x3.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 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
}
(24-24/39)