Project

General

Profile

« Previous | Next » 

Revision 386af988

Added by Leszek Koltunski almost 4 years ago

Minor.

View differences:

src/main/java/org/distorted/objectlib/main/ShapeDodecahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class ShapeDodecahedron extends TwistyObject
30
{
31
  static final int MINX_LGREEN = 0xff53aa00;
32
  static final int MINX_PINK   = 0xfffd7ab7;
33
  static final int MINX_SANDY  = 0xffefd48b;
34
  static final int MINX_LBLUE  = 0xff00a2d7;
35
  static final int MINX_ORANGE = 0xffff6200;
36
  static final int MINX_VIOLET = 0xff7d59a4;
37
  static final int MINX_DGREEN = 0xff007a47;
38
  static final int MINX_DRED   = 0xffbd0000;
39
  static final int MINX_DBLUE  = 0xff1a29b2;
40
  static final int MINX_DYELLOW= 0xffffc400;
41
  static final int MINX_WHITE  = 0xffffffff;
42
  static final int MINX_GREY   = 0xff727c7b;
43

  
44
  static final int[] FACE_COLORS = new int[]
45
         {
46
           MINX_LGREEN, MINX_PINK   , MINX_SANDY , MINX_LBLUE,
47
           MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED ,
48
           MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY
49
         };
50

  
51
  static final int NUM_FACES = 12;
52
  static final int FOV = 30;
53
  static final float RATIO = 0.35f;
54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
57
  public ShapeDodecahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
58
    {
59
    super(numLayers, realSize, quat, move, scale, stream);
60
    }
61

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

  
64
  public final int getNumFaces()
65
    {
66
    return NUM_FACES;
67
    }
68

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

  
71
  public int getNumFaceColors()
72
    {
73
    return FACE_COLORS.length;
74
    }
75

  
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

  
78
  public int getColor(int face)
79
    {
80
    return FACE_COLORS[face];
81
    }
82

  
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

  
85
  public int getFOV()
86
    {
87
    return FOV;
88
    }
89

  
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91

  
92
  public float getScreenRatio()
93
    {
94
    return RATIO;
95
    }
96
}
src/main/java/org/distorted/objectlib/main/ShapeHexahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class ShapeHexahedron extends TwistyObject
30
{
31
  static final int[] FACE_COLORS = new int[]
32
         {
33
           COLOR_YELLOW, COLOR_WHITE,
34
           COLOR_BLUE  , COLOR_GREEN,
35
           COLOR_RED   , COLOR_ORANGE
36
         };
37

  
38
  static final int NUM_FACES = 6;
39
  static final int FOV = 60;
40
  static final float RATIO = 0.50f;
41

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

  
44
  public ShapeHexahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
45
    {
46
    super(numLayers, realSize, quat, move, scale, stream);
47
    }
48

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

  
51
  public final int getNumFaces()
52
    {
53
    return NUM_FACES;
54
    }
55

  
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

  
58
  public int getNumFaceColors()
59
    {
60
    return FACE_COLORS.length;
61
    }
62

  
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64

  
65
  public int getColor(int face)
66
    {
67
    return FACE_COLORS[face];
68
    }
69

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

  
72
  public int getFOV()
73
    {
74
    return FOV;
75
    }
76

  
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
79
  public float getScreenRatio()
80
    {
81
    return RATIO;
82
    }
83
}
src/main/java/org/distorted/objectlib/main/ShapeOctahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class ShapeOctahedron extends TwistyObject
30
{
31
  static final int[] FACE_COLORS = new int[]
32
         {
33
           COLOR_ORANGE, COLOR_VIOLET,
34
           COLOR_WHITE , COLOR_BLUE  ,
35
           COLOR_YELLOW, COLOR_RED   ,
36
           COLOR_GREEN , COLOR_GREY
37
         };
38

  
39
  static final int NUM_FACES = 8;
40
  static final int FOV = 60;
41
  static final float RATIO = 0.68f;
42

  
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

  
45
  public ShapeOctahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
46
    {
47
    super(numLayers, realSize, quat, move, scale, stream);
48
    }
49

  
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

  
52
  public final int getNumFaces()
53
    {
54
    return NUM_FACES;
55
    }
56

  
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

  
59
  public int getNumFaceColors()
60
    {
61
    return FACE_COLORS.length;
62
    }
63

  
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

  
66
  public int getColor(int face)
67
    {
68
    return FACE_COLORS[face];
69
    }
70

  
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

  
73
  public int getFOV()
74
    {
75
    return FOV;
76
    }
77

  
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

  
80
  public float getScreenRatio()
81
    {
82
    return RATIO;
83
    }
84
}
src/main/java/org/distorted/objectlib/main/ShapeTetrahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class ShapeTetrahedron extends TwistyObject
30
{
31
  static final int[] FACE_COLORS = new int[]
32
         {
33
           COLOR_GREEN , COLOR_YELLOW,
34
           COLOR_BLUE  , COLOR_RED
35
         };
36

  
37
  static final int NUM_FACES = 4;
38
  static final int FOV = 60;
39
  static final float RATIO = 0.89f;
40

  
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

  
43
  public ShapeTetrahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
44
    {
45
    super(numLayers, realSize, quat, move, scale, stream);
46
    }
47

  
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

  
50
  public final int getNumFaces()
51
    {
52
    return NUM_FACES;
53
    }
54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
57
  public int getNumFaceColors()
58
    {
59
    return FACE_COLORS.length;
60
    }
61

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

  
64
  public int getColor(int face)
65
    {
66
    return FACE_COLORS[face];
67
    }
68

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

  
71
  public int getFOV()
72
    {
73
    return FOV;
74
    }
75

  
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

  
78
  public float getScreenRatio()
79
    {
80
    return RATIO;
81
    }
82
}
src/main/java/org/distorted/objectlib/main/TwistyDodecahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class TwistyDodecahedron extends TwistyObject
30
{
31
  static final int MINX_LGREEN = 0xff53aa00;
32
  static final int MINX_PINK   = 0xfffd7ab7;
33
  static final int MINX_SANDY  = 0xffefd48b;
34
  static final int MINX_LBLUE  = 0xff00a2d7;
35
  static final int MINX_ORANGE = 0xffff6200;
36
  static final int MINX_VIOLET = 0xff7d59a4;
37
  static final int MINX_DGREEN = 0xff007a47;
38
  static final int MINX_DRED   = 0xffbd0000;
39
  static final int MINX_DBLUE  = 0xff1a29b2;
40
  static final int MINX_DYELLOW= 0xffffc400;
41
  static final int MINX_WHITE  = 0xffffffff;
42
  static final int MINX_GREY   = 0xff727c7b;
43

  
44
  static final int[] FACE_COLORS = new int[]
45
         {
46
           MINX_LGREEN, MINX_PINK   , MINX_SANDY , MINX_LBLUE,
47
           MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED ,
48
           MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY
49
         };
50

  
51
  static final int NUM_FACES = 12;
52
  static final int FOV = 30;
53
  static final float RATIO = 0.35f;
54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
57
  public TwistyDodecahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
58
    {
59
    super(numLayers, realSize, quat, move, scale, stream);
60
    }
61

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

  
64
  public final int getNumFaces()
65
    {
66
    return NUM_FACES;
67
    }
68

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

  
71
  public int getNumFaceColors()
72
    {
73
    return FACE_COLORS.length;
74
    }
75

  
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

  
78
  public int getColor(int face)
79
    {
80
    return FACE_COLORS[face];
81
    }
82

  
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

  
85
  public int getFOV()
86
    {
87
    return FOV;
88
    }
89

  
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91

  
92
  public float getScreenRatio()
93
    {
94
    return RATIO;
95
    }
96
}
src/main/java/org/distorted/objectlib/main/TwistyHexahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class TwistyHexahedron extends TwistyObject
30
{
31
  static final int[] FACE_COLORS = new int[]
32
         {
33
           COLOR_YELLOW, COLOR_WHITE,
34
           COLOR_BLUE  , COLOR_GREEN,
35
           COLOR_RED   , COLOR_ORANGE
36
         };
37

  
38
  static final int NUM_FACES = 6;
39
  static final int FOV = 60;
40
  static final float RATIO = 0.50f;
41

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

  
44
  public TwistyHexahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
45
    {
46
    super(numLayers, realSize, quat, move, scale, stream);
47
    }
48

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

  
51
  public final int getNumFaces()
52
    {
53
    return NUM_FACES;
54
    }
55

  
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

  
58
  public int getNumFaceColors()
59
    {
60
    return FACE_COLORS.length;
61
    }
62

  
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64

  
65
  public int getColor(int face)
66
    {
67
    return FACE_COLORS[face];
68
    }
69

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

  
72
  public int getFOV()
73
    {
74
    return FOV;
75
    }
76

  
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
79
  public float getScreenRatio()
80
    {
81
    return RATIO;
82
    }
83
}
src/main/java/org/distorted/objectlib/main/TwistyJson.java
286 286
    {
287 287
    switch( mReader.getNumFaces() )
288 288
      {
289
      case  4: return TwistyTetrahedron.FOV;
290
      case  6: return TwistyHexahedron.FOV;
291
      case  8: return TwistyOctahedron.FOV;
292
      case 12: return TwistyDodecahedron.FOV;
289
      case  4: return ShapeTetrahedron.FOV;
290
      case  6: return ShapeHexahedron.FOV;
291
      case  8: return ShapeOctahedron.FOV;
292
      case 12: return ShapeDodecahedron.FOV;
293 293
      }
294 294

  
295 295
    return 0;
......
301 301
    {
302 302
    switch( mReader.getNumFaces() )
303 303
      {
304
      case  4: return TwistyTetrahedron.RATIO;
305
      case  6: return TwistyHexahedron.RATIO;
306
      case  8: return TwistyOctahedron.RATIO;
307
      case 12: return TwistyDodecahedron.RATIO;
304
      case  4: return ShapeTetrahedron.RATIO;
305
      case  6: return ShapeHexahedron.RATIO;
306
      case  8: return ShapeOctahedron.RATIO;
307
      case 12: return ShapeDodecahedron.RATIO;
308 308
      }
309 309

  
310 310
    return 0.0f;
src/main/java/org/distorted/objectlib/main/TwistyOctahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class TwistyOctahedron extends TwistyObject
30
{
31
  static final int[] FACE_COLORS = new int[]
32
         {
33
           COLOR_ORANGE, COLOR_VIOLET,
34
           COLOR_WHITE , COLOR_BLUE  ,
35
           COLOR_YELLOW, COLOR_RED   ,
36
           COLOR_GREEN , COLOR_GREY
37
         };
38

  
39
  static final int NUM_FACES = 8;
40
  static final int FOV = 60;
41
  static final float RATIO = 0.68f;
42

  
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

  
45
  public TwistyOctahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
46
    {
47
    super(numLayers, realSize, quat, move, scale, stream);
48
    }
49

  
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

  
52
  public final int getNumFaces()
53
    {
54
    return NUM_FACES;
55
    }
56

  
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

  
59
  public int getNumFaceColors()
60
    {
61
    return FACE_COLORS.length;
62
    }
63

  
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

  
66
  public int getColor(int face)
67
    {
68
    return FACE_COLORS[face];
69
    }
70

  
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

  
73
  public int getFOV()
74
    {
75
    return FOV;
76
    }
77

  
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

  
80
  public float getScreenRatio()
81
    {
82
    return RATIO;
83
    }
84
}
src/main/java/org/distorted/objectlib/main/TwistyTetrahedron.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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.main;
21

  
22
import java.io.InputStream;
23

  
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public abstract class TwistyTetrahedron extends TwistyObject
30
{
31
  static final int[] FACE_COLORS = new int[]
32
         {
33
           COLOR_GREEN , COLOR_YELLOW,
34
           COLOR_BLUE  , COLOR_RED
35
         };
36

  
37
  static final int NUM_FACES = 4;
38
  static final int FOV = 60;
39
  static final float RATIO = 0.89f;
40

  
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

  
43
  public TwistyTetrahedron(int[] numLayers, float realSize, Static4D quat, Static3D move, float scale, InputStream stream)
44
    {
45
    super(numLayers, realSize, quat, move, scale, stream);
46
    }
47

  
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

  
50
  public final int getNumFaces()
51
    {
52
    return NUM_FACES;
53
    }
54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
57
  public int getNumFaceColors()
58
    {
59
    return FACE_COLORS.length;
60
    }
61

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

  
64
  public int getColor(int face)
65
    {
66
    return FACE_COLORS[face];
67
    }
68

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

  
71
  public int getFOV()
72
    {
73
    return FOV;
74
    }
75

  
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

  
78
  public float getScreenRatio()
79
    {
80
    return RATIO;
81
    }
82
}
src/main/java/org/distorted/objectlib/objects/TwistyBandagedAbstract.java
32 32
import org.distorted.objectlib.helpers.ObjectSticker;
33 33
import org.distorted.objectlib.helpers.ScrambleState;
34 34
import org.distorted.objectlib.main.ObjectControl;
35
import org.distorted.objectlib.main.TwistyHexahedron;
35
import org.distorted.objectlib.main.ShapeHexahedron;
36 36

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

  
39
abstract class TwistyBandagedAbstract extends TwistyHexahedron
39
abstract class TwistyBandagedAbstract extends ShapeHexahedron
40 40
{
41 41
  // the three rotation axis of a 3x3 Cube. Must be normalized.
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyHexahedron;
36
import org.distorted.objectlib.main.ShapeHexahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyCuboid extends TwistyHexahedron
40
public class TwistyCuboid extends ShapeHexahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistyDiamond.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyOctahedron;
36
import org.distorted.objectlib.main.ShapeOctahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyDiamond extends TwistyOctahedron
40
public class TwistyDiamond extends ShapeOctahedron
41 41
{
42 42
  // the four rotation axis of a Diamond. Must be normalized.
43 43
  static final Static3D[] ROT_AXIS = new Static3D[]
src/main/java/org/distorted/objectlib/objects/TwistyDino.java
31 31
import org.distorted.objectlib.helpers.ObjectSticker;
32 32
import org.distorted.objectlib.helpers.ScrambleState;
33 33
import org.distorted.objectlib.main.ObjectControl;
34
import org.distorted.objectlib.main.TwistyHexahedron;
34
import org.distorted.objectlib.main.ShapeHexahedron;
35 35

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

  
38
abstract class TwistyDino extends TwistyHexahedron
38
abstract class TwistyDino extends ShapeHexahedron
39 39
{
40 40
  // the four rotation axis of a RubikDino. Must be normalized.
41 41
  static final Static3D[] ROT_AXIS = new Static3D[]
src/main/java/org/distorted/objectlib/objects/TwistyHelicopter.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyHexahedron;
36
import org.distorted.objectlib.main.ShapeHexahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyHelicopter extends TwistyHexahedron
40
public class TwistyHelicopter extends ShapeHexahedron
41 41
{
42 42
  // the six rotation axis of a Helicopter. Must be normalized.
43 43
  static final Static3D[] ROT_AXIS = new Static3D[]
src/main/java/org/distorted/objectlib/objects/TwistyIvy.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyHexahedron;
36
import org.distorted.objectlib.main.ShapeHexahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyIvy extends TwistyHexahedron
40
public class TwistyIvy extends ShapeHexahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistyJing.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyTetrahedron;
36
import org.distorted.objectlib.main.ShapeTetrahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyJing extends TwistyTetrahedron
40
public class TwistyJing extends ShapeTetrahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistyMinx.java
32 32
import org.distorted.objectlib.main.MovementDodecahedron;
33 33
import org.distorted.objectlib.helpers.ObjectSticker;
34 34
import org.distorted.objectlib.helpers.ScrambleState;
35
import org.distorted.objectlib.main.TwistyDodecahedron;
35
import org.distorted.objectlib.main.ShapeDodecahedron;
36 36

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

  
39
abstract class TwistyMinx extends TwistyDodecahedron
39
abstract class TwistyMinx extends ShapeDodecahedron
40 40
{
41 41
  static final int NUM_CORNERS = 20;
42 42
  static final int NUM_CENTERS = 12;
src/main/java/org/distorted/objectlib/objects/TwistyMirror.java
32 32
import org.distorted.objectlib.helpers.ObjectShape;
33 33
import org.distorted.objectlib.helpers.ObjectSticker;
34 34
import org.distorted.objectlib.helpers.ScrambleState;
35
import org.distorted.objectlib.main.TwistyHexahedron;
35
import org.distorted.objectlib.main.ShapeHexahedron;
36 36

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

  
39
public class TwistyMirror extends TwistyHexahedron
39
public class TwistyMirror extends ShapeHexahedron
40 40
{
41 41
  static final Static3D[] ROT_AXIS = new Static3D[]
42 42
         {
src/main/java/org/distorted/objectlib/objects/TwistyPyraminx.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyTetrahedron;
36
import org.distorted.objectlib.main.ShapeTetrahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyPyraminx extends TwistyTetrahedron
40
public class TwistyPyraminx extends ShapeTetrahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistyRedi.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyHexahedron;
36
import org.distorted.objectlib.main.ShapeHexahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyRedi extends TwistyHexahedron
40
public class TwistyRedi extends ShapeHexahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistyRex.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyHexahedron;
36
import org.distorted.objectlib.main.ShapeHexahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyRex extends TwistyHexahedron
40
public class TwistyRex extends ShapeHexahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistySkewb.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyHexahedron;
36
import org.distorted.objectlib.main.ShapeHexahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistySkewb extends TwistyHexahedron
40
public class TwistySkewb extends ShapeHexahedron
41 41
{
42 42
  static final Static3D[] ROT_AXIS = new Static3D[]
43 43
         {
src/main/java/org/distorted/objectlib/objects/TwistySquare.java
26 26

  
27 27
import org.distorted.library.type.Static3D;
28 28
import org.distorted.library.type.Static4D;
29
import org.distorted.objectlib.main.TwistyHexahedron;
29
import org.distorted.objectlib.main.ShapeHexahedron;
30 30

  
31 31
///////////////////////////////////////////////////////////////////////////////////////////////////
32 32

  
33
abstract class TwistySquare extends TwistyHexahedron
33
abstract class TwistySquare extends ShapeHexahedron
34 34
{
35 35
  static final float COS15 = (SQ6+SQ2)/4;
36 36
  static final float SIN15 = (SQ6-SQ2)/4;
src/main/java/org/distorted/objectlib/objects/TwistyUltimate.java
33 33
import org.distorted.objectlib.helpers.ObjectShape;
34 34
import org.distorted.objectlib.helpers.ObjectSticker;
35 35
import org.distorted.objectlib.helpers.ScrambleState;
36
import org.distorted.objectlib.main.TwistyDodecahedron;
36
import org.distorted.objectlib.main.ShapeDodecahedron;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40
public class TwistyUltimate extends TwistyDodecahedron
40
public class TwistyUltimate extends ShapeDodecahedron
41 41
{
42 42
  private static final float A = (float)Math.sqrt(21*SQ5+47);
43 43
  private static final float B = SQ6*(5*SQ5+11)/(6*A);

Also available in: Unified diff