Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyBandagedGeneric.java @ efeca8ef

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 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.ObjectSignature;
25
import org.distorted.objectlib.scrambling.ScrambleState;
26

    
27
import java.io.InputStream;
28

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

    
31
public class TwistyBandagedGeneric extends TwistyBandagedAbstract
32
{
33
  public static final String OBJECT_NAME = "LOCAL_BANDAGED";
34
  private static float[][] POS;
35
  private static ObjectSignature mSignature;
36

    
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

    
39
  public TwistyBandagedGeneric(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
40
    {
41
    super(numL, meshState, iconMode, quat, move, scale, stream);
42
    }
43

    
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
46
// Return null here and turn to construction of scramble tables just-in-time.
47

    
48
  @Override
49
  public ScrambleState[] getScrambleStates()
50
    {
51
    return null;
52
    }
53

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

    
56
  @Override
57
  public int getScrambleType()
58
    {
59
    return 2;
60
    }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
  public static void setPositions(float[][] positions)
65
    {
66
    POS = positions;
67
    mSignature = null;
68
    }
69

    
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71

    
72
  float[][] getPositions()
73
    {
74
    if( POS==null )
75
      {
76
      POS = new float[][]
77
        {
78
          {-1.0f, +1.0f, +1.0f},
79
          {-1.0f, +1.0f, -1.0f},
80
          {-1.0f, -1.0f, +1.0f},
81
          {-1.0f, -1.0f, -1.0f},
82
          { 1.0f, +1.0f, -1.0f},
83
          { 1.0f,  1.0f,  1.0f},
84
          { 1.0f, -1.0f, +1.0f},
85
          { 1.0f, -1.0f, -1.0f},
86

    
87
          {-1.0f, +1.0f, +0.0f,
88
           -1.0f,  0.0f, +1.0f,
89
           -1.0f,  0.0f, +0.0f,
90
           -1.0f,  0.0f, -1.0f,
91
           -1.0f, -1.0f, +0.0f,
92
            0.0f, -1.0f, +1.0f,
93
            0.0f, -1.0f, +0.0f,
94
            0.0f, +1.0f, +1.0f,
95
            0.0f, +1.0f, +0.0f,
96
            0.0f, +1.0f, -1.0f,
97
            0.0f,  0.0f, +1.0f,
98
            0.0f,  0.0f, -1.0f,
99
            1.0f, +1.0f, +0.0f,
100
            1.0f, +0.0f, +1.0f,
101
            1.0f,  0.0f, +0.0f,
102
            1.0f,  0.0f, -1.0f,
103
            1.0f, -1.0f, +0.0f,
104
            0.0f, -1.0f, -1.0f},
105
        };
106
      }
107
    return POS;
108
    }
109

    
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111
// PUBLIC APi
112

    
113
  public String getShortName()
114
    {
115
    if( mSignature==null ) mSignature = getSignature();
116
    int[] numLayers = getNumLayers();
117
    int number = 100*numLayers[0]+10*numLayers[1]+numLayers[0];
118

    
119
    return number+"_"+mSignature.getString();
120
    }
121

    
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123

    
124
  public ObjectSignature getSignature()
125
    {
126
    if( mSignature==null )
127
      {
128
      int[] numLayers = getNumLayers();
129
      mSignature = new ObjectSignature(numLayers[0],numLayers[1],numLayers[2],POS);
130
      }
131
    return mSignature;
132
    }
133

    
134
///////////////////////////////////////////////////////////////////////////////////////////////////
135

    
136
  public String getObjectName()
137
    {
138
    return OBJECT_NAME;
139
    }
140

    
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142

    
143
  public String getInventor()
144
    {
145
    return "??";
146
    }
147

    
148
///////////////////////////////////////////////////////////////////////////////////////////////////
149

    
150
  public int getYearOfInvention()
151
    {
152
    return 0;
153
    }
154

    
155
///////////////////////////////////////////////////////////////////////////////////////////////////
156

    
157
  public int getComplexity()
158
    {
159
    return 4;
160
    }
161

    
162
///////////////////////////////////////////////////////////////////////////////////////////////////
163

    
164
  public String[][] getTutorials()
165
    {
166
    return null;
167
    }
168
}
(7-7/36)