Project

General

Profile

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

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

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
  private static float[][] POS;
34
  private static ObjectSignature mSignature;
35

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

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

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

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

    
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

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

    
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62

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

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  float[][] getPositions()
72
    {
73
    if( POS==null )
74
      {
75
      POS = new float[][]
76
        {
77
          {-1.0f, +1.0f, +1.0f},
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

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

    
109
///////////////////////////////////////////////////////////////////////////////////////////////////
110
// PUBLIC APi
111

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

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

    
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122

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

    
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

    
135
  public String getObjectName()
136
    {
137
    return "";
138
    }
139

    
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141

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

    
147
///////////////////////////////////////////////////////////////////////////////////////////////////
148

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

    
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155

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

    
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162

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