| 1 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 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.objects;
|
| 21 |
|
|
|
| 22 |
|
|
import android.content.res.Resources;
|
| 23 |
|
|
|
| 24 |
acf165d9
|
Leszek Koltunski
|
import org.distorted.helpers.ObjectShape;
|
| 25 |
9c06394a
|
Leszek Koltunski
|
import org.distorted.helpers.ObjectSticker;
|
| 26 |
bc649d9a
|
Leszek Koltunski
|
import org.distorted.library.main.DistortedEffects;
|
| 27 |
|
|
import org.distorted.library.main.DistortedTexture;
|
| 28 |
|
|
import org.distorted.library.mesh.MeshSquare;
|
| 29 |
|
|
import org.distorted.library.type.Static3D;
|
| 30 |
|
|
import org.distorted.library.type.Static4D;
|
| 31 |
|
|
import org.distorted.main.R;
|
| 32 |
|
|
|
| 33 |
|
|
import java.util.Random;
|
| 34 |
|
|
|
| 35 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_DBLUE;
|
| 36 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_DGREEN;
|
| 37 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_DRED;
|
| 38 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_DYELLOW;
|
| 39 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_GREY;
|
| 40 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_LBLUE;
|
| 41 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_LGREEN;
|
| 42 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_ORANGE;
|
| 43 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_PINK;
|
| 44 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_SANDY;
|
| 45 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_VIOLET;
|
| 46 |
|
|
import static org.distorted.objects.TwistyMinx.MINX_WHITE;
|
| 47 |
|
|
|
| 48 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 49 |
|
|
|
| 50 |
|
|
class TwistyUltimate extends TwistyObject
|
| 51 |
|
|
{
|
| 52 |
|
|
private static final float A = (float)Math.sqrt(21*SQ5+47);
|
| 53 |
|
|
private static final float B = SQ6*(5*SQ5+11)/(6*A);
|
| 54 |
|
|
private static final float C = SQ6*( SQ5+ 2)/(3*A);
|
| 55 |
|
|
private static final float D = SQ3/3;
|
| 56 |
|
|
private static final float E = (SQ5+1)/4;
|
| 57 |
|
|
private static final float F = (SQ5-1)/4;
|
| 58 |
74ffd68e
|
Leszek Koltunski
|
private static final float G = (SQ5+3)/4;
|
| 59 |
bc649d9a
|
Leszek Koltunski
|
|
| 60 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
| 61 |
|
|
{
|
| 62 |
|
|
new Static3D( B,0,C ),
|
| 63 |
|
|
new Static3D( C,B,0 ),
|
| 64 |
|
|
new Static3D(-D,D,D ),
|
| 65 |
|
|
new Static3D( 0,C,-B)
|
| 66 |
|
|
};
|
| 67 |
|
|
|
| 68 |
925ed78f
|
Leszek Koltunski
|
private static final int[] BASIC_ANGLE = new int[] { 3,3,3,3 };
|
| 69 |
|
|
|
| 70 |
bc649d9a
|
Leszek Koltunski
|
private static final int[] FACE_COLORS = new int[]
|
| 71 |
|
|
{
|
| 72 |
|
|
MINX_LGREEN, MINX_PINK , MINX_SANDY , MINX_LBLUE,
|
| 73 |
|
|
MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED ,
|
| 74 |
|
|
MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY
|
| 75 |
|
|
};
|
| 76 |
|
|
|
| 77 |
|
|
private static final Static4D[] QUATS = new Static4D[]
|
| 78 |
|
|
{
|
| 79 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ),
|
| 80 |
|
|
new Static4D(-0.5f, 0.5f, 0.5f, 0.5f ),
|
| 81 |
|
|
new Static4D( 0.5f,-0.5f,-0.5f, 0.5f ),
|
| 82 |
|
|
new Static4D( 0.0f, F, -E, 0.5f ),
|
| 83 |
|
|
new Static4D( 0.0f, -F, E, 0.5f ),
|
| 84 |
|
|
new Static4D( E, 0.0f, F, 0.5f ),
|
| 85 |
|
|
new Static4D( -E, 0.0f, -F, 0.5f ),
|
| 86 |
|
|
new Static4D( F, E, 0.0f, 0.5f ),
|
| 87 |
|
|
new Static4D( -F, -E, 0.0f, 0.5f ),
|
| 88 |
|
|
new Static4D( E, F,-0.5f, 0.0f ),
|
| 89 |
|
|
new Static4D( 0.5f, -E, F, 0.0f ),
|
| 90 |
|
|
new Static4D( F, 0.5f, E, 0.0f )
|
| 91 |
|
|
};
|
| 92 |
|
|
|
| 93 |
20f42f61
|
Leszek Koltunski
|
// Colors of the faces of cubits.
|
| 94 |
74ffd68e
|
Leszek Koltunski
|
private static final int[][] mFaceMap = new int[][]
|
| 95 |
|
|
{
|
| 96 |
20f42f61
|
Leszek Koltunski
|
{ 25,24,35, 36,36,36,36,36 },
|
| 97 |
|
|
{ 27,28,29, 36,36,36,36,36 },
|
| 98 |
|
|
{ 31,26,30, 36,36,36,36,36 },
|
| 99 |
|
|
{ 32,34,33, 36,36,36,36,36 },
|
| 100 |
|
|
|
| 101 |
|
|
{ 31,32,25, 36,36,36,36,36 },
|
| 102 |
|
|
{ 33,28,24, 36,36,36,36,36 },
|
| 103 |
|
|
{ 26,35,27, 36,36,36,36,36 },
|
| 104 |
|
|
{ 30,29,34, 36,36,36,36,36 },
|
| 105 |
|
|
|
| 106 |
|
|
{ 8, 0,13,21, 36,36,36,36 },
|
| 107 |
|
|
{ 1, 2,19,23, 36,36,36,36 },
|
| 108 |
|
|
{ 4,11,12,15, 36,36,36,36 },
|
| 109 |
|
|
{ 3, 6,14,17, 36,36,36,36 },
|
| 110 |
|
|
{ 5, 9,22,16, 36,36,36,36 },
|
| 111 |
|
|
{ 7,10,20,18, 36,36,36,36 }
|
| 112 |
74ffd68e
|
Leszek Koltunski
|
};
|
| 113 |
|
|
|
| 114 |
|
|
// centers of the 14 cubits.
|
| 115 |
|
|
static final float[][] CENTERS = new float[][]
|
| 116 |
|
|
{
|
| 117 |
|
|
{ 0.0f,-0.5f, G },
|
| 118 |
62efeeae
|
Leszek Koltunski
|
{ E, -E, -E },
|
| 119 |
|
|
{ -G, 0.0f,-0.5f },
|
| 120 |
|
|
{ 0.5f, G, 0.0f },
|
| 121 |
|
|
|
| 122 |
74ffd68e
|
Leszek Koltunski
|
{ -E, E, E },
|
| 123 |
|
|
{ G, 0.0f, 0.5f },
|
| 124 |
|
|
{-0.5f, -G, 0.0f },
|
| 125 |
|
|
{ 0.0f, 0.5f, -G },
|
| 126 |
|
|
|
| 127 |
|
|
{ E/2, (E+0.5f)/2, (E+G)/2 },
|
| 128 |
|
|
{ -(E+G)/2, -E/2, (E+0.5f)/2 },
|
| 129 |
|
|
{ (E+0.5f)/2, -(E+G)/2, E/2 },
|
| 130 |
|
|
{ -E/2,-(E+0.5f)/2, -(E+G)/2 },
|
| 131 |
|
|
{ (E+G)/2, E/2,-(E+0.5f)/2 },
|
| 132 |
|
|
{-(E+0.5f)/2, (E+G)/2, -E/2 }
|
| 133 |
|
|
};
|
| 134 |
|
|
|
| 135 |
62efeeae
|
Leszek Koltunski
|
private static final double[][] VERTICES_SMALL_LEFT = new double[][]
|
| 136 |
74ffd68e
|
Leszek Koltunski
|
{
|
| 137 |
62efeeae
|
Leszek Koltunski
|
{ 0.000, 0.000, 0.000},
|
| 138 |
|
|
{ - 0.250,-SQ5/8 - 0.125,-SQ5/8 - 0.375},
|
| 139 |
|
|
{ SQ5/8 + 0.125,-SQ5/8 - 0.375, + 0.250},
|
| 140 |
|
|
{ SQ5/8 + 0.375, + 0.250,-SQ5/8 - 0.125},
|
| 141 |
|
|
{ SQ5/4 + 0.250,-SQ5/4 - 0.250,-SQ5/4 - 0.250},
|
| 142 |
|
|
{ SQ5/8 - 0.125, + 0.250,-SQ5/8 - 0.125},
|
| 143 |
|
|
{ - 0.250,-SQ5/8 - 0.125,-SQ5/8 + 0.125},
|
| 144 |
|
|
{ SQ5/8 + 0.125,-SQ5/8 + 0.125, + 0.250}
|
| 145 |
74ffd68e
|
Leszek Koltunski
|
};
|
| 146 |
|
|
|
| 147 |
62efeeae
|
Leszek Koltunski
|
private static final int[][] VERT_INDEXES_SMALL_LEFT = new int[][]
|
| 148 |
|
|
{
|
| 149 |
|
|
{6,0,5,1}, // counterclockwise!
|
| 150 |
|
|
{0,7,3,5},
|
| 151 |
|
|
{0,6,2,7},
|
| 152 |
|
|
{1,5,3,4},
|
| 153 |
|
|
{3,7,2,4},
|
| 154 |
|
|
{2,6,1,4},
|
| 155 |
|
|
};
|
| 156 |
|
|
|
| 157 |
|
|
private static final double[][] VERTICES_SMALL_RIGHT = new double[][]
|
| 158 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 159 |
|
|
{ 0.0 , 0.0 , 0.0 },
|
| 160 |
|
|
{ -0.5*E , 0.5*E+0.25, -0.25 },
|
| 161 |
|
|
{-0.25 , -E/2 , (-2*E-1)/4},
|
| 162 |
|
|
{ 0.5*E+0.25, 0.25 , -E/2 },
|
| 163 |
|
|
{ 0.0 , 0.5 , -E-0.5 },
|
| 164 |
|
|
{ 0.0 , 0.5 , 0.0 },
|
| 165 |
|
|
{ -0.5*E ,-0.5*E+0.25, -0.25 },
|
| 166 |
|
|
{ 0.5*E ,-0.5*E+0.25, -0.25 }
|
| 167 |
|
|
};
|
| 168 |
|
|
|
| 169 |
62efeeae
|
Leszek Koltunski
|
private static final int[][] VERT_INDEXES_SMALL_RIGHT = new int[][]
|
| 170 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 171 |
|
|
{6,0,5,1}, // counterclockwise!
|
| 172 |
|
|
{0,7,3,5},
|
| 173 |
|
|
{0,6,2,7},
|
| 174 |
|
|
{4,3,5,1},
|
| 175 |
|
|
{4,2,7,3},
|
| 176 |
|
|
{4,1,6,2},
|
| 177 |
|
|
};
|
| 178 |
|
|
|
| 179 |
|
|
private static final double[][] VERTICES_BIG = new double[][]
|
| 180 |
|
|
{
|
| 181 |
|
|
{-E/2 ,-E/2+0.25, 0.25},
|
| 182 |
|
|
{ E/2 , E/2-0.25, -0.25},
|
| 183 |
|
|
{-E , 0.00, 0.00},
|
| 184 |
|
|
{ 0.25, E/2 ,-E/2-0.25},
|
| 185 |
|
|
{-E/2 ,-E/2-0.25, 0.25},
|
| 186 |
|
|
{ E/2+0.25, -0.25,-E/2 },
|
| 187 |
|
|
{-E , -0.50, 0.00},
|
| 188 |
|
|
{ 0.50, 0.00,-E },
|
| 189 |
|
|
{-E +0.25, E/2 ,-E/2-0.25},
|
| 190 |
|
|
{ 0.25,-E/2-0.50,-E/2+0.25},
|
| 191 |
|
|
{-E/2 ,-E/2-0.25,-E -0.25}
|
| 192 |
|
|
};
|
| 193 |
|
|
|
| 194 |
|
|
private static final int[][] VERT_INDEXES_BIG = new int[][]
|
| 195 |
|
|
{
|
| 196 |
|
|
{0,1,3,8,2}, // counterclockwise!
|
| 197 |
|
|
{0,4,9,5,1},
|
| 198 |
|
|
{ 0,2,6,4},
|
| 199 |
|
|
{ 1,5,7,3},
|
| 200 |
|
|
{10,9,4,6},
|
| 201 |
|
|
{10,9,5,7},
|
| 202 |
|
|
{10,8,3,7},
|
| 203 |
|
|
{10,8,2,6}
|
| 204 |
|
|
};
|
| 205 |
|
|
|
| 206 |
62efeeae
|
Leszek Koltunski
|
private static final int[] QUAT_INDEX = new int[]
|
| 207 |
|
|
{
|
| 208 |
|
|
0,6,1,2,0,4,6,5,0,1,4,9,5,2
|
| 209 |
|
|
};
|
| 210 |
|
|
|
| 211 |
bc649d9a
|
Leszek Koltunski
|
private static final float[][] STICKERS = new float[][]
|
| 212 |
|
|
{
|
| 213 |
74ffd68e
|
Leszek Koltunski
|
{ -0.14400357f, -0.47894150f, 0.50000000f,-0.011045523f, 0.37700626f, 0.36749030f,-0.26699730f, 0.36749026f, -0.46600536f, -0.24499352f }, // Big cubit 1st
|
| 214 |
|
|
{ 0.36327127f, 0.26393202f,-0.36327127f, 0.500000000f,-0.36327127f,-0.26393202f, 0.36327127f,-0.50000000f }, // Big cubit 2nd
|
| 215 |
|
|
{ -0.29389262f, -0.50000000f, 0.29389262f,-0.309017000f, 0.29389262f, 0.30901700f,-0.29389262f, 0.50000000f }, // Small cubit 1st
|
| 216 |
bc649d9a
|
Leszek Koltunski
|
};
|
| 217 |
|
|
|
| 218 |
9c06394a
|
Leszek Koltunski
|
private static final ObjectSticker[] mStickers;
|
| 219 |
|
|
|
| 220 |
|
|
static
|
| 221 |
|
|
{
|
| 222 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
| 223 |
|
|
final float R1 = 0.08f;
|
| 224 |
|
|
final float R2 = 0.13f;
|
| 225 |
|
|
final float R3 = 0.11f;
|
| 226 |
|
|
final float[][] radii = { {R1,R1,R1,R1,R1},{R2,R2,R2,R2},{R3,R3,R3,R3} };
|
| 227 |
|
|
final float[] strokes = { 0.07f, 0.09f, 0.08f };
|
| 228 |
|
|
|
| 229 |
|
|
for(int s=0; s<STICKERS.length; s++)
|
| 230 |
|
|
{
|
| 231 |
|
|
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
|
| 232 |
|
|
}
|
| 233 |
|
|
}
|
| 234 |
|
|
|
| 235 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 236 |
|
|
|
| 237 |
|
|
TwistyUltimate(int size, Static4D quat, DistortedTexture texture,
|
| 238 |
|
|
MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
| 239 |
|
|
{
|
| 240 |
|
|
super(size, size, quat, texture, mesh, effects, moves, ObjectList.ULTI, res, scrWidth);
|
| 241 |
|
|
}
|
| 242 |
|
|
|
| 243 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 244 |
|
|
|
| 245 |
acf165d9
|
Leszek Koltunski
|
ObjectShape getObjectShape(int cubit, int numLayers)
|
| 246 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 247 |
acf165d9
|
Leszek Koltunski
|
int variant = getCubitVariant(cubit,numLayers);
|
| 248 |
bc649d9a
|
Leszek Koltunski
|
|
| 249 |
acf165d9
|
Leszek Koltunski
|
if( variant==0 )
|
| 250 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 251 |
acf165d9
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.03f,17,0.5f,0.2f,5,2,2}, {0.01f, 1,0.5f,0.2f,5,2,2} };
|
| 252 |
|
|
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
| 253 |
|
|
float[][] corners = new float[][] { { 0.013f, 0.08f } };
|
| 254 |
|
|
int[] cornerIndices = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 };
|
| 255 |
|
|
float[][] centers = new float[][] { { 0.0f,-0.5f, -(SQ5+3)/4 } };
|
| 256 |
|
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
| 257 |
|
|
return new ObjectShape(VERTICES_SMALL_RIGHT,VERT_INDEXES_SMALL_RIGHT,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
| 258 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 259 |
acf165d9
|
Leszek Koltunski
|
else if( variant==1 )
|
| 260 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 261 |
acf165d9
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.03f,17,0.5f,0.2f,5,2,2}, {0.01f, 1,0.5f,0.2f,5,2,2} };
|
| 262 |
|
|
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
| 263 |
|
|
float[][] corners = new float[][] { { 0.013f, 0.08f } };
|
| 264 |
|
|
int[] cornerIndices = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 };
|
| 265 |
|
|
float[][] centers = new float[][] { { 0.0f,-0.5f, -(SQ5+3)/4 } };
|
| 266 |
|
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
| 267 |
|
|
return new ObjectShape(VERTICES_SMALL_LEFT,VERT_INDEXES_SMALL_LEFT,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
| 268 |
62efeeae
|
Leszek Koltunski
|
}
|
| 269 |
|
|
else
|
| 270 |
|
|
{
|
| 271 |
acf165d9
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.04f,17,0.5f,0.2f,5,2,2}, {0.03f,17,0.5f,0.2f,5,2,2}, {0.01f, 1,0.5f,0.2f,5,2,2} };
|
| 272 |
|
|
int[] bandIndices = new int[] { 0,0,1,1,2,2,2,2 };
|
| 273 |
|
|
float[][] corners = new float[][] { { 0.013f, 0.08f } };
|
| 274 |
|
|
int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0,0,0,-1 };
|
| 275 |
|
|
float[][] centers = new float[][] { { -(SQ5+1)/8, 0.25f, -(SQ5+5)/8 } };
|
| 276 |
|
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0,0,0,0 };
|
| 277 |
|
|
return new ObjectShape(VERTICES_BIG,VERT_INDEXES_BIG,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
| 278 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 279 |
acf165d9
|
Leszek Koltunski
|
}
|
| 280 |
bc649d9a
|
Leszek Koltunski
|
|
| 281 |
acf165d9
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 282 |
bc649d9a
|
Leszek Koltunski
|
|
| 283 |
3e605536
|
Leszek Koltunski
|
Static4D getQuat(int cubit, int numLayers)
|
| 284 |
acf165d9
|
Leszek Koltunski
|
{
|
| 285 |
|
|
return QUATS[QUAT_INDEX[cubit]];
|
| 286 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 287 |
|
|
|
| 288 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 289 |
|
|
|
| 290 |
3e605536
|
Leszek Koltunski
|
int getNumCubitVariants(int numLayers)
|
| 291 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 292 |
acf165d9
|
Leszek Koltunski
|
return 3;
|
| 293 |
|
|
}
|
| 294 |
|
|
|
| 295 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 296 |
|
|
|
| 297 |
|
|
int getCubitVariant(int cubit, int numLayers)
|
| 298 |
|
|
{
|
| 299 |
|
|
return cubit<4 ? 0 : (cubit<8 ? 1:2);
|
| 300 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 301 |
|
|
|
| 302 |
acf165d9
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 303 |
|
|
|
| 304 |
|
|
float[][] getCubitPositions(int numLayers)
|
| 305 |
|
|
{
|
| 306 |
|
|
return CENTERS;
|
| 307 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 308 |
|
|
|
| 309 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 310 |
|
|
|
| 311 |
9c06394a
|
Leszek Koltunski
|
int getFaceColor(int cubit, int cubitface, int size)
|
| 312 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 313 |
9c06394a
|
Leszek Koltunski
|
return mFaceMap[cubit][cubitface];
|
| 314 |
|
|
}
|
| 315 |
74ffd68e
|
Leszek Koltunski
|
|
| 316 |
9c06394a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 317 |
bc649d9a
|
Leszek Koltunski
|
|
| 318 |
9c06394a
|
Leszek Koltunski
|
int getColor(int face)
|
| 319 |
|
|
{
|
| 320 |
|
|
return FACE_COLORS[face];
|
| 321 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 322 |
|
|
|
| 323 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 324 |
|
|
|
| 325 |
9c06394a
|
Leszek Koltunski
|
ObjectSticker retSticker(int face)
|
| 326 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 327 |
9c06394a
|
Leszek Koltunski
|
return mStickers[face/NUM_FACES];
|
| 328 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 329 |
|
|
|
| 330 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 331 |
|
|
|
| 332 |
|
|
float returnMultiplier()
|
| 333 |
|
|
{
|
| 334 |
74ffd68e
|
Leszek Koltunski
|
return 1.0f;
|
| 335 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 336 |
|
|
|
| 337 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 338 |
|
|
|
| 339 |
|
|
Static4D[] getQuats()
|
| 340 |
|
|
{
|
| 341 |
|
|
return QUATS;
|
| 342 |
|
|
}
|
| 343 |
|
|
|
| 344 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 345 |
|
|
|
| 346 |
|
|
boolean shouldResetTextureMaps()
|
| 347 |
|
|
{
|
| 348 |
|
|
return false;
|
| 349 |
|
|
}
|
| 350 |
|
|
|
| 351 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 352 |
|
|
|
| 353 |
|
|
int getNumFaces()
|
| 354 |
|
|
{
|
| 355 |
|
|
return FACE_COLORS.length;
|
| 356 |
|
|
}
|
| 357 |
|
|
|
| 358 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 359 |
|
|
|
| 360 |
e6734aa9
|
Leszek Koltunski
|
float[][] getCuts(int numLayers)
|
| 361 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 362 |
e6734aa9
|
Leszek Koltunski
|
float[] cut = new float[] {0.0f};
|
| 363 |
|
|
return new float[][] { cut,cut,cut,cut };
|
| 364 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 365 |
|
|
|
| 366 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 367 |
|
|
|
| 368 |
|
|
int getNumStickerTypes(int numLayers)
|
| 369 |
|
|
{
|
| 370 |
|
|
return STICKERS.length;
|
| 371 |
|
|
}
|
| 372 |
|
|
|
| 373 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 374 |
|
|
|
| 375 |
|
|
int getNumCubitFaces()
|
| 376 |
|
|
{
|
| 377 |
|
|
return 8;
|
| 378 |
|
|
}
|
| 379 |
|
|
|
| 380 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 381 |
|
|
|
| 382 |
|
|
float getScreenRatio()
|
| 383 |
|
|
{
|
| 384 |
62efeeae
|
Leszek Koltunski
|
return 0.67f;
|
| 385 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 386 |
|
|
|
| 387 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 388 |
|
|
// PUBLIC API
|
| 389 |
|
|
|
| 390 |
|
|
public Static3D[] getRotationAxis()
|
| 391 |
|
|
{
|
| 392 |
|
|
return ROT_AXIS;
|
| 393 |
|
|
}
|
| 394 |
|
|
|
| 395 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 396 |
|
|
|
| 397 |
925ed78f
|
Leszek Koltunski
|
public int[] getBasicAngle()
|
| 398 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 399 |
925ed78f
|
Leszek Koltunski
|
return BASIC_ANGLE;
|
| 400 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 401 |
|
|
|
| 402 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 403 |
|
|
|
| 404 |
9f171eba
|
Leszek Koltunski
|
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total)
|
| 405 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 406 |
9f171eba
|
Leszek Koltunski
|
if( curr==0 )
|
| 407 |
bc649d9a
|
Leszek Koltunski
|
{
|
| 408 |
9f171eba
|
Leszek Koltunski
|
scramble[curr][0] = rnd.nextInt(NUM_AXIS);
|
| 409 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 410 |
|
|
else
|
| 411 |
|
|
{
|
| 412 |
582617c1
|
Leszek Koltunski
|
int newVector = rnd.nextInt(NUM_AXIS -1);
|
| 413 |
9f171eba
|
Leszek Koltunski
|
scramble[curr][0] = (newVector>=scramble[curr-1][0] ? newVector+1 : newVector);
|
| 414 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 415 |
|
|
|
| 416 |
9f171eba
|
Leszek Koltunski
|
scramble[curr][1] = rnd.nextFloat()<=0.5f ? 0 : 1;
|
| 417 |
bc649d9a
|
Leszek Koltunski
|
|
| 418 |
|
|
switch( rnd.nextInt(2) )
|
| 419 |
|
|
{
|
| 420 |
9f171eba
|
Leszek Koltunski
|
case 0: scramble[curr][2] = 1; break;
|
| 421 |
|
|
case 1: scramble[curr][2] = -1; break;
|
| 422 |
bc649d9a
|
Leszek Koltunski
|
}
|
| 423 |
|
|
}
|
| 424 |
|
|
|
| 425 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 426 |
|
|
|
| 427 |
|
|
public boolean isSolved()
|
| 428 |
|
|
{
|
| 429 |
|
|
int index = CUBITS[0].mQuatIndex;
|
| 430 |
|
|
|
| 431 |
|
|
for(int i=1; i<NUM_CUBITS; i++)
|
| 432 |
|
|
{
|
| 433 |
|
|
if( CUBITS[i].mQuatIndex != index ) return false;
|
| 434 |
|
|
}
|
| 435 |
|
|
|
| 436 |
|
|
return true;
|
| 437 |
|
|
}
|
| 438 |
|
|
|
| 439 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 440 |
|
|
|
| 441 |
|
|
public int getObjectName(int numLayers)
|
| 442 |
|
|
{
|
| 443 |
|
|
return R.string.ulti2;
|
| 444 |
|
|
}
|
| 445 |
|
|
|
| 446 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 447 |
|
|
|
| 448 |
|
|
public int getInventor(int numLayers)
|
| 449 |
|
|
{
|
| 450 |
|
|
return R.string.ulti2_inventor;
|
| 451 |
|
|
}
|
| 452 |
|
|
|
| 453 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 454 |
|
|
|
| 455 |
|
|
public int getComplexity(int numLayers)
|
| 456 |
|
|
{
|
| 457 |
|
|
return 6;
|
| 458 |
|
|
}
|
| 459 |
|
|
}
|