Fix center orientation reset in picture/supercube mode#407
Fix center orientation reset in picture/supercube mode#407shuantsu wants to merge 1 commit intocubing:mainfrom
Conversation
|
Unfortunately, treating centers as distinguishable by default would cause effects that I think people would find surprising, particularly when comparing patterns. I have some thoughts on possible ways to do this, but unfortunately the fix cannot be as simple as a single line. I should probably pick an ergonomic hack that allows specifying a |
Can you clarify the "when comparing patterns" part?
Make sense. But at least it was enough to fix for 3x3x3 supercube animations You can see a demo here:
Did you notice that big cubes has a weird way of applying textures to stickers? It seems it duplicates stickers for some kind of pieces instead of really applying the texture with the correct UV map
|
Yeah, I literally mean comparing patterns: import { cube3x3x3 } from "cubing/puzzles";
const defaultPattern = (await cube3x3x3.kpuzzle()).defaultPattern();
const a = defaultPattern.applyAlg("R2 D' F2 R' F' L R U' B' L' F2 U2 D' F U' R2 U2 F2 L' F2 D2 R' D2 B2 L2 F2 R2");
const b = defaultPattern.applyAlg("D' F2 R2 U' F2 U2 F2 R2 D B2 L D F' U' F' R' U2 R' B' R2");
console.log(a.isIdentical(b));With this PR, this would print
Same dealio, those pieces are indistinguishable by default. Now that we have an external use case for it, let me see if it's simple enough to implement a |
18ce379 to
9bb0810
Compare
7845b85 to
635d4d2
Compare
a69483d to
93211be
Compare






Fix center orientation reset in picture/supercube mode
Problem
In picture/supercube mode, center stickers would rotate correctly during move animations but reset to their original orientation at the end of the animation. This broke the visual continuity expected in supercube scenarios where center orientations should be preserved.
Root Cause
The issue was in the 3x3x3 KPuzzle definition where
CENTERShadorientationMod: [1, 1, 1, 1, 1, 1]. This caused the orientation calculation(newOrientation) % 1to always result in0, effectively resetting all center orientations after each move.Solution
Changed
orientationModfrom[1, 1, 1, 1, 1, 1]to[4, 4, 4, 4, 4, 4]for theCENTERSorbit. This allows center orientations to be preserved (since centers havenumOrientations: 4) while maintaining mathematical correctness.Impact
Testing
Tested on
experiments.cubing.net/cubing.js/twisty/supercube-arrows.htmlwith moves likeU,R,U2, etc. Center stickers now maintain their final orientation instead of resetting.Fixes the issue introduced in commit 9cdf18f (July 2023) where the optimization for normal cubes conflicted with picture/supercube requirements.