Project

General

Profile

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

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

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.scrambling.ScrambleState;
25

    
26
import java.io.InputStream;
27

    
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

    
30
public class TwistyBandagedGeneric extends TwistyBandagedAbstract
31
{
32
  private static float[][] POS;
33
  private static long mSignature;
34

    
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

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

    
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

    
44
  public TwistyBandagedGeneric(Static4D quat, float scale, int iconMode)
45
    {
46
    super( new int[] {3,3,3}, MESH_NICE, iconMode, quat, new Static3D(0,0,0), scale, null);
47
    }
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50
// Computing scramble states of many a bandaged 3x3 takes way too long time and too much space.
51
// Return null here and turn to construction of scramble tables just-in-time.
52

    
53
  @Override
54
  public ScrambleState[] getScrambleStates()
55
    {
56
    return null;
57
    }
58

    
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

    
61
  @Override
62
  public int getScrambleType()
63
    {
64
    return 2;
65
    }
66

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

    
69
  public static void setPositions(float[][] positions)
70
    {
71
    POS = positions;
72
    mSignature = -1;
73
    }
74

    
75
///////////////////////////////////////////////////////////////////////////////////////////////////
76

    
77
  float[][] getPositions()
78
    {
79
    if( POS==null )
80
      {
81
      POS = new float[][]
82
        {
83
          {-1.0f, +1.0f, +1.0f},
84
          {-1.0f, +1.0f, +0.0f},
85
          {-1.0f, +1.0f, -1.0f},
86
          {-1.0f,  0.0f, +1.0f},
87
          {-1.0f,  0.0f, +0.0f},
88
          {-1.0f,  0.0f, -1.0f},
89
          {-1.0f, -1.0f, +1.0f},
90
          {-1.0f, -1.0f, +0.0f},
91
          {-1.0f, -1.0f, -1.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

    
100
          { 1.0f, +1.0f, +0.0f ,
101
            1.0f, +0.0f, +1.0f ,
102
            1.0f,  0.0f, +0.0f},
103

    
104
          { 1.0f, +1.0f, -1.0f},
105
          { 1.0f,  1.0f,  1.0f},
106

    
107
          { 1.0f, -1.0f, +1.0f},
108
          { 1.0f,  0.0f, -1.0f},
109
          { 1.0f, -1.0f, -1.0f},
110
          { 1.0f, -1.0f, +0.0f},
111
          { 0.0f, -1.0f, -1.0f},
112
        };
113
      }
114
    return POS;
115
    }
116

    
117
///////////////////////////////////////////////////////////////////////////////////////////////////
118
// PUBLIC APi
119

    
120
  public String getShortName()
121
    {
122
    if( mSignature<0 ) mSignature = getSignature();
123
    return ""+mSignature;
124
    }
125

    
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127

    
128
  public long getSignature()
129
    {
130
    if( mSignature<0 )
131
      {
132
      mSignature = 0;
133
      for(float[] pos : POS ) mSignature = markConnections(mSignature,pos);
134
      }
135

    
136
    return mSignature;
137
    }
138

    
139
///////////////////////////////////////////////////////////////////////////////////////////////////
140

    
141
  public String getObjectName()
142
    {
143
    return "";
144
    }
145

    
146
///////////////////////////////////////////////////////////////////////////////////////////////////
147

    
148
  public String getInventor()
149
    {
150
    return "??";
151
    }
152

    
153
///////////////////////////////////////////////////////////////////////////////////////////////////
154

    
155
  public int getYearOfInvention()
156
    {
157
    return 0;
158
    }
159

    
160
///////////////////////////////////////////////////////////////////////////////////////////////////
161

    
162
  public int getComplexity()
163
    {
164
    return 4;
165
    }
166

    
167
///////////////////////////////////////////////////////////////////////////////////////////////////
168

    
169
  public String[][] getTutorials()
170
    {
171
    return null;
172
    }
173
}
(7-7/35)