{"id":8621,"date":"2022-05-04T09:17:25","date_gmt":"2022-05-04T13:17:25","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=8621"},"modified":"2022-05-04T13:10:50","modified_gmt":"2022-05-04T17:10:50","slug":"qube-the-movie","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2022\/05\/04\/qube-the-movie\/","title":{"rendered":"Qube, The Movie"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/Q12freeze.png\" alt=\"\"> <\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#b1e6c340-d4d7-4051-9aa4-77dcfb5c7240\">The Movie<\/a><\/li><li><a href=\"#e7056c28-9958-4523-8281-52340d459601\">Scaling<\/a><\/li><li><a href=\"#bb29b058-8ab1-4527-829b-961984f854da\">Rubik's Rotations<\/a><\/li><li><a href=\"#1cc365ad-c05e-4901-a8c6-0224f017bad4\">Types<\/a><\/li><\/ul><\/div><h4>The Movie<a name=\"b1e6c340-d4d7-4051-9aa4-77dcfb5c7240\"><\/a><\/h4><p>Here is a link to <a href=\"https:\/\/blogs.mathworks.com\/cleve\/files\/Qube_TheMovie.mp4\">\"Qube, The Movie\"<\/a>, a video made with <tt>Qube<\/tt>, my digital Rubik's cube simulator. Mathematically, all of the action is driven by the 3-by-3 matrices on display.<\/p><h4>Scaling<a name=\"e7056c28-9958-4523-8281-52340d459601\"><\/a><\/h4><p><tt>Qube<\/tt> uses a <tt>3x3x3<\/tt> array of identical <i>cubelets<\/i> . The coordinates <tt>[x,y,z]<\/tt> of the centers of the cubelets are all of the possible combinations of <tt>-2<\/tt>, <tt>0<\/tt> and <tt>+2<\/tt>. The vertices of an individual cubelet form a 8-by-3 matrix. The width of a cubelet is controlled by multiplying its vertices by a 3-by-3 diagonal scaling matrix.<\/p><p>Our video begins with the width near zero, so the cubelets appear to be points at the centers.  The width is increased to a value where the cubelets almost touch each other. The small gap is maintained for its visual effect.<\/p><h4>Rubik's Rotations<a name=\"bb29b058-8ab1-4527-829b-961984f854da\"><\/a><\/h4><p>The primary operations with a Rubik's cube are the simultaneous rotation of all  the cubelets contained in one of the six faces. For example, <a href=\"https:\/\/blogs.mathworks.com\/cleve\/files\/Qube_TheMovie2.mp4\">this video<\/a> shows a slow-motion rotation of the \"Left\" face about the <tt>x<\/tt>-axis.<\/p><p>It is also possible to rotate the three interior \"slices\", as well as the entire cube about one of the coordinate axes.<\/p><h4>Types<a name=\"1cc365ad-c05e-4901-a8c6-0224f017bad4\"><\/a><\/h4><p>The <i>type<\/i> of a cubelet is the number of nonzeros in the coordinates of its center.<\/p><pre>  type = nnz([x,y,z])<\/pre><p>The cubelet in the center of the puzzle has <tt>type = 0<\/tt> and the six cubelets with <tt>type = 1<\/tt> are located at the center of each face. We use <tt>0:1<\/tt> to denote the set of these seven cubelets. In a real, physical Rubick's Cube, <tt>0:1<\/tt> is a single solid central core that holds the entire puzzle together.<\/p><p>There are twelve <tt>type = 2<\/tt> cubelets located on the edges of each face and eight <tt>type = 3<\/tt> cubelets at the corners of the puzzle. So, <tt>0:3<\/tt> denotes the entire cube and <tt>2:3<\/tt> is the corners and edges without the central core. <a href=\"https:\/\/blogs.mathworks.com\/cleve\/files\/Qube_TheMovie.mp4\">Qube, The Movie<\/a> shows the types in this order:<\/p><pre>  0:3, 0:2, 0:1, 0, 1, 2, 3, 2:3<\/pre><p>Careful readers of this blog should recognize <tt>2:3<\/tt> as level one of the <a href=\"https:\/\/blogs.mathworks.com\/cleve\/2021\/12\/06\/\">Menger sponge fractal<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_2b73884c09a04c8faa6b8c53cdab8ae6() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='2b73884c09a04c8faa6b8c53cdab8ae6 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 2b73884c09a04c8faa6b8c53cdab8ae6';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2022 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_2b73884c09a04c8faa6b8c53cdab8ae6()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2022a<br><\/p><\/div><!--\r\n2b73884c09a04c8faa6b8c53cdab8ae6 ##### SOURCE BEGIN #####\r\n%% Qube, The Movie\r\n%\r\n% <<Q12freeze.png>>\r\n%\r\n\r\n%% The Movie\r\n% Here is a link to \r\n% <https:\/\/blogs.mathworks.com\/cleve\/files\/Qube_TheMovie.mp4\r\n% \"Qube, The Movie\">, a video made \r\n% with |Qube|, my digital Rubik's cube simulator.  \r\n% Mathematically, all of the action is driven by the 3-by-3 matrices\r\n% on display.\r\n \r\n%% Scaling\r\n% |Qube| uses a |3x3x3| array of identical _cubelets_ .\r\n% The coordinates |[x,y,z]| of the centers of the cubelets are\r\n% all of the possible combinations of |-2|, |0| and |+2|.\r\n% The vertices of an individual cubelet form a 8-by-3 matrix.\r\n% The width of a cubelet is controlled by multiplying its vertices\r\n% by a 3-by-3 diagonal scaling matrix.  \r\n% \r\n% Our video begins with the width near zero, so the\r\n% cubelets appear to be points at the centers.  The width is increased\r\n% to a value where the cubelets almost touch each other.\r\n% The small gap is maintained for its visual effect.\r\n\r\n%% Rubik's Rotations\r\n% The primary operations with a Rubik's cube are the simultaneous\r\n% rotation of all  the cubelets contained in one of the six faces.\r\n% For example,\r\n% <https:\/\/blogs.mathworks.com\/cleve\/files\/Qube_TheMovie2.mp4\r\n% this video> \r\n% shows a slow-motion rotation of the \"Left\" face about the |x|-axis.\r\n%\r\n% It is also possible to rotate the three interior \"slices\",\r\n% as well as the entire cube about one of the coordinate axes.\r\n\r\n%% Types\r\n% The _type_ of a cubelet is the number of nonzeros in the coordinates\r\n% of its center.\r\n%\r\n%    type = nnz([x,y,z])\r\n%\r\n%% \r\n% The cubelet in the center of the puzzle has |type = 0| and the six\r\n% cubelets with |type = 1| are located at the center of each face.\r\n% We use |0:1| to denote the set of these seven cubelets. \r\n% In a real, physical Rubick's Cube, |0:1| is\r\n% a single solid central core that holds the entire puzzle together.\r\n%\r\n% There are twelve |type = 2| cubelets located on the edges of each face\r\n% and eight |type = 3| cubelets at the corners of the puzzle.\r\n% So, |0:3| denotes the entire cube and |2:3| is the corners and\r\n% edges without the central core.  \r\n% <https:\/\/blogs.mathworks.com\/cleve\/files\/Qube_TheMovie.mp4\r\n% Qube, The Movie> shows the types in this order:\r\n%\r\n%    0:3, 0:2, 0:1, 0, 1, 2, 3, 2:3\r\n%\r\n% Careful readers of this blog should recognize |2:3|\r\n% as level one of the <https:\/\/blogs.mathworks.com\/cleve\/2021\/12\/06\/\r\n% Menger sponge fractal>.\r\n\r\n##### SOURCE END ##### 2b73884c09a04c8faa6b8c53cdab8ae6\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/Qfeatured_image_2.gif\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><!--\/introduction-->... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2022\/05\/04\/qube-the-movie\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":8639,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,5,23,6,37],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/8621"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=8621"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/8621\/revisions"}],"predecessor-version":[{"id":8624,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/8621\/revisions\/8624"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media\/8639"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=8621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=8621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=8621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}