aboutsummaryrefslogtreecommitdiff
path: root/src/core/transform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/transform.h')
-rw-r--r--src/core/transform.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/core/transform.h b/src/core/transform.h
index 73636fe..f956718 100644
--- a/src/core/transform.h
+++ b/src/core/transform.h
@@ -21,6 +21,9 @@ STATIC cube_t transform_edges(cube_t, uint8_t);
21STATIC cube_t transform_corners(cube_t, uint8_t); 21STATIC cube_t transform_corners(cube_t, uint8_t);
22STATIC cube_t transform(cube_t, uint8_t); 22STATIC cube_t transform(cube_t, uint8_t);
23STATIC cube_t applytrans(cube_t, const char *); 23STATIC cube_t applytrans(cube_t, const char *);
24STATIC_INLINE uint8_t inverse_trans(uint8_t);
25STATIC uint8_t transform_move(uint8_t, uint8_t);
26STATIC uint64_t symmetry_mask(cube_t);
24 27
25STATIC cube_t 28STATIC cube_t
26transform_edges(cube_t c, uint8_t t) 29transform_edges(cube_t c, uint8_t t)
@@ -354,3 +357,40 @@ applytrans(cube_t cube, const char *buf)
354 357
355 return transform(cube, t); 358 return transform(cube, t);
356} 359}
360
361STATIC_INLINE uint8_t
362inverse_trans(uint8_t t)
363{
364 return inverse_trans_table[t];
365}
366
367STATIC uint8_t
368transform_move(uint8_t m, uint8_t t)
369{
370 uint8_t a, base, modifier;
371
372 a = moveaxis(m);
373 base = trans_move_table[t][a];
374 if (movebase(m) != 2 * a)
375 base = moveopposite(base);
376
377 modifier = m % 3;
378 if (t >= TRANS_UFm)
379 modifier = 2 - modifier;
380
381 return base + modifier;
382}
383
384STATIC uint64_t
385symmetry_mask(cube_t cube)
386{
387 uint64_t t, ret;
388 cube_t transformed;
389
390 for (t = 0, ret = 0; t < 48; t++) {
391 transformed = transform(cube, t);
392 ret |= ((uint64_t)equal(cube, transformed)) << t;
393 }
394
395 return ret;
396}

Generated with cgit - Back to sebastiano.tronto.net