| 1 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 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 |
59c20632
|
Leszek Koltunski
|
import static org.distorted.objectlib.main.Movement.MOVEMENT_TETRAHEDRON;
|
| 23 |
29b82486
|
Leszek Koltunski
|
import static org.distorted.objectlib.main.Movement.TYPE_NOT_SPLIT;
|
| 24 |
|
|
|
| 25 |
|
|
import android.content.res.Resources;
|
| 26 |
|
|
|
| 27 |
|
|
import org.distorted.library.main.DistortedEffects;
|
| 28 |
|
|
import org.distorted.library.main.DistortedTexture;
|
| 29 |
|
|
import org.distorted.library.mesh.MeshSquare;
|
| 30 |
|
|
import org.distorted.library.type.Static3D;
|
| 31 |
|
|
import org.distorted.library.type.Static4D;
|
| 32 |
|
|
|
| 33 |
|
|
import org.distorted.objectlib.R;
|
| 34 |
|
|
import org.distorted.objectlib.main.Movement4;
|
| 35 |
8592461c
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectControl;
|
| 36 |
8005e762
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
| 37 |
198c5bf0
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectShape;
|
| 38 |
|
|
import org.distorted.objectlib.helpers.ObjectSticker;
|
| 39 |
|
|
import org.distorted.objectlib.helpers.ScrambleState;
|
| 40 |
29b82486
|
Leszek Koltunski
|
import org.distorted.objectlib.main.Twisty4;
|
| 41 |
|
|
|
| 42 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 43 |
|
|
|
| 44 |
|
|
public class TwistyJing extends Twisty4
|
| 45 |
|
|
{
|
| 46 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
| 47 |
|
|
{
|
| 48 |
|
|
new Static3D( 0,-SQ3/3,-SQ6/3),
|
| 49 |
|
|
new Static3D( 0,-SQ3/3,+SQ6/3),
|
| 50 |
|
|
new Static3D(+SQ6/3,+SQ3/3, 0),
|
| 51 |
|
|
new Static3D(-SQ6/3,+SQ3/3, 0),
|
| 52 |
|
|
};
|
| 53 |
|
|
|
| 54 |
|
|
static final float F = 0.48f; // length of the edge of the corner cubit. Keep<0.5
|
| 55 |
|
|
// Assuming the length of the edge of the whole
|
| 56 |
|
|
// tetrahedron is 2.0 (ie standard, equal to numLayers
|
| 57 |
|
|
|
| 58 |
|
|
private ScrambleState[] mStates;
|
| 59 |
|
|
private int[] mBasicAngle;
|
| 60 |
|
|
private int[] mRotQuat;
|
| 61 |
|
|
private Static4D[] mQuats;
|
| 62 |
|
|
private float[][] mCuts;
|
| 63 |
|
|
private float[][] mCenters;
|
| 64 |
|
|
private int[][] mFaceMap;
|
| 65 |
|
|
private ObjectSticker[] mStickers;
|
| 66 |
|
|
|
| 67 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 68 |
|
|
|
| 69 |
a57e6870
|
Leszek Koltunski
|
public TwistyJing(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
|
| 70 |
e7daa161
|
Leszek Koltunski
|
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
|
| 71 |
29b82486
|
Leszek Koltunski
|
{
|
| 72 |
e7daa161
|
Leszek Koltunski
|
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
| 73 |
29b82486
|
Leszek Koltunski
|
}
|
| 74 |
|
|
|
| 75 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 76 |
|
|
|
| 77 |
f9a81f52
|
Leszek Koltunski
|
public ScrambleState[] getScrambleStates()
|
| 78 |
29b82486
|
Leszek Koltunski
|
{
|
| 79 |
|
|
if( mStates==null )
|
| 80 |
|
|
{
|
| 81 |
|
|
int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
|
| 82 |
|
|
|
| 83 |
|
|
mStates = new ScrambleState[]
|
| 84 |
|
|
{
|
| 85 |
|
|
new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
|
| 86 |
|
|
};
|
| 87 |
|
|
}
|
| 88 |
|
|
|
| 89 |
|
|
return mStates;
|
| 90 |
|
|
}
|
| 91 |
|
|
|
| 92 |
4e1dc313
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 93 |
|
|
|
| 94 |
a57e6870
|
Leszek Koltunski
|
protected int getResource(int[] numLayers)
|
| 95 |
4e1dc313
|
Leszek Koltunski
|
{
|
| 96 |
|
|
return R.raw.jing;
|
| 97 |
|
|
}
|
| 98 |
|
|
|
| 99 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 100 |
|
|
|
| 101 |
|
|
private void initializeQuats()
|
| 102 |
|
|
{
|
| 103 |
|
|
mQuats = new Static4D[]
|
| 104 |
|
|
{
|
| 105 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f),
|
| 106 |
|
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f),
|
| 107 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f),
|
| 108 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f),
|
| 109 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f),
|
| 110 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f),
|
| 111 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f),
|
| 112 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f),
|
| 113 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f),
|
| 114 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f),
|
| 115 |
|
|
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f),
|
| 116 |
|
|
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f)
|
| 117 |
|
|
};
|
| 118 |
|
|
}
|
| 119 |
|
|
|
| 120 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 121 |
|
|
|
| 122 |
7b832206
|
Leszek Koltunski
|
public int[] getSolvedQuats(int cubit, int[] numLayers)
|
| 123 |
29b82486
|
Leszek Koltunski
|
{
|
| 124 |
|
|
if( mQuats==null ) initializeQuats();
|
| 125 |
|
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
| 126 |
|
|
return status<0 ? null : buildSolvedQuats(Movement4.FACE_AXIS[status],mQuats);
|
| 127 |
|
|
}
|
| 128 |
|
|
|
| 129 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 130 |
|
|
|
| 131 |
7b832206
|
Leszek Koltunski
|
public float[][] getCubitPositions(int[] numLayers)
|
| 132 |
29b82486
|
Leszek Koltunski
|
{
|
| 133 |
|
|
if( mCenters==null )
|
| 134 |
|
|
{
|
| 135 |
|
|
mCenters = new float[][]
|
| 136 |
|
|
{
|
| 137 |
|
|
{ 0.000f, -SQ2/2, 1.000f },
|
| 138 |
|
|
{ 0.000f, -SQ2/2,-1.000f },
|
| 139 |
|
|
{-1.000f, SQ2/2, 0.000f },
|
| 140 |
|
|
{ 1.000f, SQ2/2, 0.000f },
|
| 141 |
|
|
|
| 142 |
|
|
{ 0.000f, -SQ2/2, 0.000f },
|
| 143 |
|
|
{-0.500f, 0.000f, 0.500f },
|
| 144 |
|
|
{ 0.500f, 0.000f, 0.500f },
|
| 145 |
|
|
{-0.500f, 0.000f,-0.500f },
|
| 146 |
|
|
{ 0.500f, 0.000f,-0.500f },
|
| 147 |
|
|
{ 0.000f, SQ2/2, 0.000f },
|
| 148 |
|
|
|
| 149 |
|
|
{ 0.000f, SQ2/6, 1.0f/3 },
|
| 150 |
|
|
{ 0.000f, SQ2/6,-1.0f/3 },
|
| 151 |
|
|
{-1.0f/3, -SQ2/6, 0.000f },
|
| 152 |
|
|
{ 1.0f/3, -SQ2/6, 0.000f },
|
| 153 |
|
|
};
|
| 154 |
|
|
}
|
| 155 |
|
|
|
| 156 |
|
|
return mCenters;
|
| 157 |
|
|
}
|
| 158 |
|
|
|
| 159 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 160 |
|
|
|
| 161 |
1bb09f88
|
Leszek Koltunski
|
public Static4D[] getQuats()
|
| 162 |
29b82486
|
Leszek Koltunski
|
{
|
| 163 |
|
|
if( mQuats==null ) initializeQuats();
|
| 164 |
|
|
return mQuats;
|
| 165 |
|
|
}
|
| 166 |
|
|
|
| 167 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 168 |
|
|
|
| 169 |
59c20632
|
Leszek Koltunski
|
public int getSolvedFunctionIndex()
|
| 170 |
29b82486
|
Leszek Koltunski
|
{
|
| 171 |
|
|
return 0;
|
| 172 |
|
|
}
|
| 173 |
|
|
|
| 174 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 175 |
|
|
|
| 176 |
1bb09f88
|
Leszek Koltunski
|
public int getNumStickerTypes(int[] numLayers)
|
| 177 |
29b82486
|
Leszek Koltunski
|
{
|
| 178 |
|
|
return 3;
|
| 179 |
|
|
}
|
| 180 |
|
|
|
| 181 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 182 |
|
|
|
| 183 |
7bbfc84f
|
Leszek Koltunski
|
public float[][] getCuts(int[] numLayers)
|
| 184 |
29b82486
|
Leszek Koltunski
|
{
|
| 185 |
|
|
if( mCuts==null )
|
| 186 |
|
|
{
|
| 187 |
|
|
float[] cut = { (F-0.5f)*(SQ6/3) };
|
| 188 |
|
|
mCuts = new float[][] { cut,cut,cut,cut };
|
| 189 |
|
|
}
|
| 190 |
|
|
|
| 191 |
|
|
return mCuts;
|
| 192 |
|
|
}
|
| 193 |
|
|
|
| 194 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 195 |
|
|
|
| 196 |
59c20632
|
Leszek Koltunski
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
| 197 |
29b82486
|
Leszek Koltunski
|
{
|
| 198 |
59c20632
|
Leszek Koltunski
|
int numAxis = ROT_AXIS.length;
|
| 199 |
|
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
| 200 |
a57e6870
|
Leszek Koltunski
|
|
| 201 |
59c20632
|
Leszek Koltunski
|
for(int i=0; i<numAxis; i++)
|
| 202 |
|
|
{
|
| 203 |
|
|
layerRotatable[i] = new boolean[numLayers[i]];
|
| 204 |
|
|
for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
|
| 205 |
29b82486
|
Leszek Koltunski
|
}
|
| 206 |
59c20632
|
Leszek Koltunski
|
|
| 207 |
|
|
return layerRotatable;
|
| 208 |
|
|
}
|
| 209 |
|
|
|
| 210 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 211 |
|
|
|
| 212 |
|
|
public int getMovementType()
|
| 213 |
|
|
{
|
| 214 |
|
|
return MOVEMENT_TETRAHEDRON;
|
| 215 |
|
|
}
|
| 216 |
|
|
|
| 217 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 218 |
|
|
|
| 219 |
|
|
public int getMovementSplit()
|
| 220 |
|
|
{
|
| 221 |
|
|
return TYPE_NOT_SPLIT;
|
| 222 |
|
|
}
|
| 223 |
|
|
|
| 224 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 225 |
|
|
|
| 226 |
|
|
public int[][][] getEnabled()
|
| 227 |
|
|
{
|
| 228 |
|
|
return new int[][][]
|
| 229 |
|
|
{
|
| 230 |
|
|
{{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}}
|
| 231 |
|
|
};
|
| 232 |
|
|
}
|
| 233 |
|
|
|
| 234 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 235 |
|
|
|
| 236 |
|
|
public float[] getDist3D(int[] numLayers)
|
| 237 |
|
|
{
|
| 238 |
|
|
return null;
|
| 239 |
29b82486
|
Leszek Koltunski
|
}
|
| 240 |
|
|
|
| 241 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 242 |
|
|
|
| 243 |
|
|
protected int getNumCubitFaces()
|
| 244 |
|
|
{
|
| 245 |
|
|
return 6;
|
| 246 |
|
|
}
|
| 247 |
|
|
|
| 248 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 249 |
|
|
|
| 250 |
a57e6870
|
Leszek Koltunski
|
protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
|
| 251 |
29b82486
|
Leszek Koltunski
|
{
|
| 252 |
|
|
if( mFaceMap==null )
|
| 253 |
|
|
{
|
| 254 |
|
|
// Colors of the faces of cubits.
|
| 255 |
|
|
// GREEN 0 YELLOW 1 BLUE 2 RED 3
|
| 256 |
|
|
// GREEN 4 YELLOW 5 BLUE 6 RED 7
|
| 257 |
|
|
// GREEN 8 YELLOW 9 BLUE 10 RED 11
|
| 258 |
|
|
mFaceMap = new int[][]
|
| 259 |
|
|
{
|
| 260 |
|
|
{ 0, 3, 2, 12, 12, 12 },
|
| 261 |
|
|
{ 1, 2, 3, 12, 12, 12 },
|
| 262 |
|
|
{ 1, 0, 2, 12, 12, 12 },
|
| 263 |
|
|
{ 1, 3, 0, 12, 12, 12 },
|
| 264 |
|
|
|
| 265 |
|
|
{ 7, 6, 12, 12, 12, 12 },
|
| 266 |
|
|
{ 4, 6, 12, 12, 12, 12 },
|
| 267 |
|
|
{ 7, 4, 12, 12, 12, 12 },
|
| 268 |
|
|
{ 5, 6, 12, 12, 12, 12 },
|
| 269 |
|
|
{ 7, 5, 12, 12, 12, 12 },
|
| 270 |
|
|
{ 4, 5, 12, 12, 12, 12 },
|
| 271 |
|
|
|
| 272 |
|
|
{ 8, 12, 12, 12, 12, 12 },
|
| 273 |
|
|
{ 9, 12, 12, 12, 12, 12 },
|
| 274 |
|
|
{ 10, 12, 12, 12, 12, 12 },
|
| 275 |
|
|
{ 11, 12, 12, 12, 12, 12 },
|
| 276 |
|
|
};
|
| 277 |
|
|
}
|
| 278 |
|
|
|
| 279 |
|
|
return mFaceMap[cubit][cubitface];
|
| 280 |
|
|
}
|
| 281 |
|
|
|
| 282 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 283 |
|
|
|
| 284 |
e30c522a
|
Leszek Koltunski
|
public ObjectShape getObjectShape(int variant)
|
| 285 |
29b82486
|
Leszek Koltunski
|
{
|
| 286 |
|
|
final float X = F/2;
|
| 287 |
|
|
final float Y = F*SQ2/2;
|
| 288 |
|
|
final float Z =-F/2;
|
| 289 |
|
|
final float L = (2.0f-3*F);
|
| 290 |
|
|
final float X2= L/2;
|
| 291 |
|
|
final float Y2= L*SQ2/2;
|
| 292 |
|
|
final float Z2=-L/2;
|
| 293 |
|
|
final float D = F/L;
|
| 294 |
|
|
final float G = 1.0f-F;
|
| 295 |
|
|
|
| 296 |
|
|
if( variant==0 )
|
| 297 |
|
|
{
|
| 298 |
|
|
double[][] vertices = new double[][]
|
| 299 |
|
|
{
|
| 300 |
|
|
{ 0.0, 0.0, 0.0 },
|
| 301 |
|
|
{ X, Y, Z },
|
| 302 |
|
|
{ 0.0, 2*Y, 2*Z },
|
| 303 |
|
|
{ -X, Y, Z },
|
| 304 |
|
|
{ 0.0, 0.0, -F },
|
| 305 |
|
|
{ X, Y, Z-F },
|
| 306 |
|
|
{ 0.0, 2*Y, 2*Z-F },
|
| 307 |
|
|
{ -X, Y, Z-F },
|
| 308 |
|
|
};
|
| 309 |
|
|
int[][] vert_indices = new int[][]
|
| 310 |
|
|
{
|
| 311 |
|
|
{0,1,2,3},
|
| 312 |
|
|
{1,0,4,5},
|
| 313 |
|
|
{7,4,0,3},
|
| 314 |
|
|
{1,5,6,2},
|
| 315 |
|
|
{7,3,2,6},
|
| 316 |
|
|
{4,7,6,5}
|
| 317 |
|
|
};
|
| 318 |
|
|
|
| 319 |
2289cab1
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.015f,35,0.25f*F,0.5f*F,5,1,1},{0.001f,35,0.25f*F,0.5f*F,5,1,1} };
|
| 320 |
29b82486
|
Leszek Koltunski
|
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
| 321 |
|
|
float[][] corners = new float[][] { {0.08f,0.20f*F},{0.07f,0.20f*F} };
|
| 322 |
|
|
int[] cornerIndices = new int[] { 0,1,1,-1,1,-1,-1,-1 };
|
| 323 |
854b09be
|
Leszek Koltunski
|
float[][] centers = new float[][] { { 0.0f, Y, Z-F/2} };
|
| 324 |
29b82486
|
Leszek Koltunski
|
int[] centerIndices = new int[] { 0,0,0,-1,0,-1,-1,-1 };
|
| 325 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
| 326 |
|
|
}
|
| 327 |
|
|
else if( variant==1 )
|
| 328 |
|
|
{
|
| 329 |
|
|
double[][] vertices = new double[][]
|
| 330 |
|
|
{
|
| 331 |
|
|
{ 0.0, 0.0, G },
|
| 332 |
|
|
{ X, Y, Z+G },
|
| 333 |
|
|
{ 0.0, 2*Y, 2*Z+G },
|
| 334 |
|
|
{ -X, Y, Z+G },
|
| 335 |
|
|
{ 0.0, 0.0, -G },
|
| 336 |
|
|
{ X, Y, -Z-G },
|
| 337 |
|
|
{ 0.0, 2*Y,-2*Z-G },
|
| 338 |
|
|
{ -X, Y, -Z-G },
|
| 339 |
|
|
};
|
| 340 |
|
|
int[][] vert_indices = new int[][]
|
| 341 |
|
|
{
|
| 342 |
|
|
{0,4,5,1},
|
| 343 |
|
|
{3,7,4,0},
|
| 344 |
|
|
{0,1,2,3},
|
| 345 |
|
|
{4,7,6,5},
|
| 346 |
|
|
{1,5,6,2},
|
| 347 |
|
|
{2,6,7,3}
|
| 348 |
|
|
};
|
| 349 |
|
|
|
| 350 |
|
|
float[][] bands = new float[][] { {0.015f,35,0.5f*F,F,5,1,1},{0.001f,35,0.5f*F,F,5,1,1} };
|
| 351 |
|
|
int[] bandIndices = new int[] { 0,0,1,1,1,1 };
|
| 352 |
|
|
float[][] corners = new float[][] { {0.07f,0.20f*F} };
|
| 353 |
|
|
int[] cornerIndices = new int[] { 0,0,-1,0,0,0,-1,0 };
|
| 354 |
|
|
float[][] centers = new float[][] { { 0, F*SQ2/2, 0 } };
|
| 355 |
|
|
int[] centerIndices = new int[] { 0,0,-1,0,0,0,-1,0 };
|
| 356 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
| 357 |
|
|
}
|
| 358 |
|
|
else
|
| 359 |
|
|
{
|
| 360 |
|
|
double[][] vertices = new double[][]
|
| 361 |
|
|
{
|
| 362 |
|
|
{ 0.0, -2*Y2/3, -2*Z2/3 },
|
| 363 |
|
|
{ X2, Y2/3, Z2/3 },
|
| 364 |
|
|
{ -X2, Y2/3, Z2/3 },
|
| 365 |
|
|
{ 0.0, -2*Y2/3,-2*Z2/3+2*D*Z2 },
|
| 366 |
|
|
{ X2-D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
| 367 |
|
|
{ -X2+D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
| 368 |
|
|
};
|
| 369 |
|
|
int[][] vert_indices = new int[][]
|
| 370 |
|
|
{
|
| 371 |
|
|
{0,1,2},
|
| 372 |
|
|
{3,5,4},
|
| 373 |
|
|
{0,3,4,1},
|
| 374 |
|
|
{5,3,0,2},
|
| 375 |
|
|
{4,5,2,1}
|
| 376 |
|
|
};
|
| 377 |
|
|
|
| 378 |
|
|
float[][] bands = new float[][] { {0.020f,35,0.20f*L,0.6f*L,5,1,1}, {0.001f,35,0.05f*L,0.1f*L,5,1,1} };
|
| 379 |
|
|
int[] bandIndices = new int[] { 0,1,1,1,1,1 };
|
| 380 |
|
|
float[][] corners = new float[][] { {0.04f,0.6f*F} };
|
| 381 |
|
|
int[] cornerIndices = new int[] { 0,0,0,-1,-1,-1 };
|
| 382 |
|
|
float[][] centers = new float[][] { { 0, -2*Y/3, 4*Z/3 } };
|
| 383 |
|
|
int[] centerIndices = new int[] { 0,0,0,-1,-1,-1 };
|
| 384 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
| 385 |
|
|
}
|
| 386 |
|
|
}
|
| 387 |
|
|
|
| 388 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 389 |
|
|
|
| 390 |
7b832206
|
Leszek Koltunski
|
public Static4D getQuat(int cubit, int[] numLayers)
|
| 391 |
29b82486
|
Leszek Koltunski
|
{
|
| 392 |
|
|
if( mQuats==null ) initializeQuats();
|
| 393 |
|
|
if( mRotQuat ==null ) mRotQuat = new int[] {0,1,2,7,0,2,7,6,3,10,0,1,3,5};
|
| 394 |
|
|
return mQuats[mRotQuat[cubit]];
|
| 395 |
|
|
}
|
| 396 |
|
|
|
| 397 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 398 |
|
|
|
| 399 |
e30c522a
|
Leszek Koltunski
|
public int getNumCubitVariants(int[] numLayers)
|
| 400 |
29b82486
|
Leszek Koltunski
|
{
|
| 401 |
|
|
return 3;
|
| 402 |
|
|
}
|
| 403 |
|
|
|
| 404 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 405 |
|
|
|
| 406 |
e30c522a
|
Leszek Koltunski
|
public int getCubitVariant(int cubit, int[] numLayers)
|
| 407 |
29b82486
|
Leszek Koltunski
|
{
|
| 408 |
|
|
return cubit<4 ? 0 : (cubit<10?1:2);
|
| 409 |
|
|
}
|
| 410 |
|
|
|
| 411 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 412 |
|
|
|
| 413 |
1bb09f88
|
Leszek Koltunski
|
public ObjectSticker retSticker(int sticker)
|
| 414 |
29b82486
|
Leszek Koltunski
|
{
|
| 415 |
|
|
if( mStickers==null )
|
| 416 |
|
|
{
|
| 417 |
|
|
float[][] STICKERS = new float[][]
|
| 418 |
|
|
{
|
| 419 |
|
|
{ 0.0f, -0.5f, 0.28867516f, 0.0f, 0.0f, 0.5f, -0.28867516f, 0.0f },
|
| 420 |
|
|
{ -0.5f, 0.11983269f, 0.27964598f, -0.43146032f, 0.3200817f, 0.007388768f, -0.09972769f, 0.30423886f },
|
| 421 |
|
|
{ 0.0f, -0.5f, 0.43301272f, 0.25f, -0.43301272f, 0.25f },
|
| 422 |
|
|
};
|
| 423 |
|
|
|
| 424 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
| 425 |
|
|
final float R1 = 0.05f;
|
| 426 |
|
|
final float R2 = 0.10f;
|
| 427 |
|
|
final float R3 = 0.03f;
|
| 428 |
|
|
final float[][] radii = { { R1,R1,R1,R1 },{ R3,R3,R2,R2 },{ R1,R1,R1 } };
|
| 429 |
8592461c
|
Leszek Koltunski
|
float[] strokes = { 0.06f, 0.03f, 0.05f };
|
| 430 |
|
|
|
| 431 |
|
|
if( ObjectControl.isInIconMode() )
|
| 432 |
|
|
{
|
| 433 |
|
|
strokes[0]*=2.0f;
|
| 434 |
|
|
strokes[1]*=2.0f;
|
| 435 |
|
|
strokes[2]*=2.0f;
|
| 436 |
|
|
}
|
| 437 |
29b82486
|
Leszek Koltunski
|
|
| 438 |
|
|
for(int s=0; s<STICKERS.length; s++)
|
| 439 |
|
|
{
|
| 440 |
|
|
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
|
| 441 |
|
|
}
|
| 442 |
|
|
}
|
| 443 |
|
|
|
| 444 |
1bb09f88
|
Leszek Koltunski
|
return mStickers[sticker];
|
| 445 |
|
|
}
|
| 446 |
|
|
|
| 447 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 448 |
|
|
// PUBLIC API
|
| 449 |
|
|
|
| 450 |
|
|
public Static3D[] getRotationAxis()
|
| 451 |
|
|
{
|
| 452 |
|
|
return ROT_AXIS;
|
| 453 |
|
|
}
|
| 454 |
|
|
|
| 455 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 456 |
|
|
|
| 457 |
|
|
public int[] getBasicAngle()
|
| 458 |
|
|
{
|
| 459 |
|
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
| 460 |
|
|
return mBasicAngle;
|
| 461 |
|
|
}
|
| 462 |
|
|
|
| 463 |
61aa85e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 464 |
|
|
|
| 465 |
a57e6870
|
Leszek Koltunski
|
public ObjectType intGetObjectType(int[] numLayers)
|
| 466 |
61aa85e4
|
Leszek Koltunski
|
{
|
| 467 |
8005e762
|
Leszek Koltunski
|
return ObjectType.JING_2;
|
| 468 |
61aa85e4
|
Leszek Koltunski
|
}
|
| 469 |
|
|
|
| 470 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 471 |
|
|
|
| 472 |
a57e6870
|
Leszek Koltunski
|
public int getObjectName(int[] numLayers)
|
| 473 |
29b82486
|
Leszek Koltunski
|
{
|
| 474 |
|
|
return R.string.jing;
|
| 475 |
|
|
}
|
| 476 |
|
|
|
| 477 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 478 |
|
|
|
| 479 |
a57e6870
|
Leszek Koltunski
|
public int getInventor(int[] numLayers)
|
| 480 |
29b82486
|
Leszek Koltunski
|
{
|
| 481 |
|
|
return R.string.jing_inventor;
|
| 482 |
|
|
}
|
| 483 |
|
|
|
| 484 |
59c20632
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 485 |
|
|
|
| 486 |
|
|
public int getYearOfInvention(int[] numLayers)
|
| 487 |
|
|
{
|
| 488 |
|
|
return 1991;
|
| 489 |
|
|
}
|
| 490 |
|
|
|
| 491 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 492 |
|
|
|
| 493 |
a57e6870
|
Leszek Koltunski
|
public int getComplexity(int[] numLayers)
|
| 494 |
29b82486
|
Leszek Koltunski
|
{
|
| 495 |
|
|
return 4;
|
| 496 |
|
|
}
|
| 497 |
|
|
}
|