Revision f171c91e
Added by Leszek Koltunski over 3 years ago
.gitignore | ||
---|---|---|
44 | 44 |
# yes, ignore the .iml |
45 | 45 |
*.iml |
46 | 46 |
/google-services.json |
47 |
/release/output-metadata.json |
src/main/java/org/distorted/objects/TwistySquare1.java | ||
---|---|---|
227 | 227 |
{ 3, 0, 4, 1, 0, 0 }, |
228 | 228 |
}; |
229 | 229 |
|
230 |
// quat indices that make corner cubits bandage the puzzle. |
|
231 |
private static final int[][] BAD_CORNER_QUATS = new int[][] |
|
232 |
{ |
|
233 |
{ 2, 8,17,23}, |
|
234 |
{ 5,11,14,20}, |
|
235 |
{ 8, 2,23,17}, |
|
236 |
{11, 5,20,14}, |
|
237 |
{17,23, 2, 8}, |
|
238 |
{14,20, 5,11}, |
|
239 |
{23,17, 8, 2}, |
|
240 |
{20,14,11, 5} |
|
241 |
}; |
|
242 |
|
|
243 |
// QUAT[i]*QUAT[j] = QUAT_MULT[i][j] |
|
244 |
private static final int[][] QUAT_MULT = new int[][] |
|
245 |
{ |
|
246 |
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,}, |
|
247 |
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 12,}, |
|
248 |
{ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 12, 13,}, |
|
249 |
{ 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 15, 16, 17, 18, 19, 20, 21, 22, 23, 12, 13, 14,}, |
|
250 |
{ 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 12, 13, 14, 15,}, |
|
251 |
{ 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 17, 18, 19, 20, 21, 22, 23, 12, 13, 14, 15, 16,}, |
|
252 |
{ 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 18, 19, 20, 21, 22, 23, 12, 13, 14, 15, 16, 17,}, |
|
253 |
{ 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 19, 20, 21, 22, 23, 12, 13, 14, 15, 16, 17, 18,}, |
|
254 |
{ 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 16, 17, 18, 19,}, |
|
255 |
{ 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 21, 22, 23, 12, 13, 14, 15, 16, 17, 18, 19, 20,}, |
|
256 |
{ 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 22, 23, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,}, |
|
257 |
{ 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 23, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,}, |
|
258 |
{ 12, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,}, |
|
259 |
{ 13, 12, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,}, |
|
260 |
{ 14, 13, 12, 23, 22, 21, 20, 19, 18, 17, 16, 15, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4, 3,}, |
|
261 |
{ 15, 14, 13, 12, 23, 22, 21, 20, 19, 18, 17, 16, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4,}, |
|
262 |
{ 16, 15, 14, 13, 12, 23, 22, 21, 20, 19, 18, 17, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5,}, |
|
263 |
{ 17, 16, 15, 14, 13, 12, 23, 22, 21, 20, 19, 18, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6,}, |
|
264 |
{ 18, 17, 16, 15, 14, 13, 12, 23, 22, 21, 20, 19, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7,}, |
|
265 |
{ 19, 18, 17, 16, 15, 14, 13, 12, 23, 22, 21, 20, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8,}, |
|
266 |
{ 20, 19, 18, 17, 16, 15, 14, 13, 12, 23, 22, 21, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9,}, |
|
267 |
{ 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 23, 22, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10,}, |
|
268 |
{ 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 23, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11,}, |
|
269 |
{ 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,} |
|
270 |
}; |
|
271 |
|
|
230 | 272 |
private static MeshBase[] mMeshes; |
231 | 273 |
|
232 | 274 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/res/raw/compute_quats.c | ||
---|---|---|
136 | 136 |
|
137 | 137 |
/////////////////////////////////////////////////////////////////// |
138 | 138 |
|
139 |
void insert(float* quat, float* to)
|
|
139 |
int getIndexInTable(float* quat, float* table)
|
|
140 | 140 |
{ |
141 | 141 |
for(int i=0; i<inserted; i++) |
142 | 142 |
{ |
143 |
if( is_the_same(quat,to+4*i)==1 ) return;
|
|
143 |
if( is_the_same(quat,table+4*i)==1 ) return i;
|
|
144 | 144 |
} |
145 | 145 |
|
146 |
if( inserted<NUM_QUATS ) |
|
147 |
{ |
|
148 |
to[4*inserted+0] = quat[0]; |
|
149 |
to[4*inserted+1] = quat[1]; |
|
150 |
to[4*inserted+2] = quat[2]; |
|
151 |
to[4*inserted+3] = quat[3]; |
|
146 |
return -1; |
|
147 |
} |
|
152 | 148 |
|
153 |
inserted++; |
|
154 |
} |
|
155 |
else |
|
149 |
/////////////////////////////////////////////////////////////////// |
|
150 |
|
|
151 |
void insert(float* quat, float* table) |
|
152 |
{ |
|
153 |
if( getIndexInTable(quat,table)<0 ) |
|
156 | 154 |
{ |
157 |
printf("Error: inserted=%d\n", inserted); |
|
155 |
if( inserted<NUM_QUATS ) |
|
156 |
{ |
|
157 |
table[4*inserted+0] = quat[0]; |
|
158 |
table[4*inserted+1] = quat[1]; |
|
159 |
table[4*inserted+2] = quat[2]; |
|
160 |
table[4*inserted+3] = quat[3]; |
|
161 |
|
|
162 |
inserted++; |
|
163 |
} |
|
164 |
else printf("Error: inserted=%d\n", inserted); |
|
158 | 165 |
} |
159 | 166 |
} |
160 | 167 |
|
... | ... | |
207 | 214 |
} |
208 | 215 |
while( num < inserted ); |
209 | 216 |
|
217 |
printf("\n"); |
|
218 |
|
|
210 | 219 |
for(int i=0; i<inserted; i++) |
211 | 220 |
{ |
212 | 221 |
printf( "%2d %7.4f %7.4f %7.4f %7.4f\n", i, table[4*i], table[4*i+1], table[4*i+2], table[4*i+3] ); |
213 | 222 |
} |
214 | 223 |
|
224 |
printf("\n"); |
|
225 |
|
|
226 |
for(int i=0; i<inserted; i++) |
|
227 |
{ |
|
228 |
printf("{"); |
|
229 |
|
|
230 |
for(int j=0; j<inserted; j++) |
|
231 |
{ |
|
232 |
multiply_quats( table+4*i, table+4*j, tmp); |
|
233 |
num = getIndexInTable(tmp,table); |
|
234 |
printf("%3d," , num); |
|
235 |
} |
|
236 |
printf("},\n"); |
|
237 |
} |
|
238 |
|
|
215 | 239 |
return 0; |
216 | 240 |
} |
Also available in: Unified diff
Square-1: progress with automatic scrambling.