{"id":9375,"date":"2022-10-21T15:58:02","date_gmt":"2022-10-21T19:58:02","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=9375"},"modified":"2022-10-22T02:52:42","modified_gmt":"2022-10-22T06:52:42","slug":"an-interactive-version-of-colorcubes","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2022\/10\/21\/an-interactive-version-of-colorcubes\/","title":{"rendered":"An Interactive Version of colorcubes"},"content":{"rendered":"\r\n\r\n<div class=\"content\"><!--introduction--><p>A 231-character static version of <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/5\/entries\/11543\">colorcubes<\/a> in the current <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/5\/entries\">MiniHack<\/a> generated quite a bit of interest. So I am posting the full version, where you can change number of cubes and the view point, <a href=\"https:\/\/blogs.mathworks.com\/cleve\/files\/colorcubes.m\">at this link<\/a>.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#2842fcd2-e0df-4ec2-bc84-82fad5a13e51\">Animation<\/a><\/li><li><a href=\"#530668b0-ea28-4376-a885-fa4d1a9c2037\">Quiz<\/a><\/li><\/ul><\/div><h4>Animation<a name=\"2842fcd2-e0df-4ec2-bc84-82fad5a13e51\"><\/a><\/h4><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/color_cubes.gif\" alt=\"\"> <\/p><h4>Quiz<a name=\"530668b0-ea28-4376-a885-fa4d1a9c2037\"><\/a><\/h4><p>What is the color of the cubelet, or cubelets, in the center?<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_0796b1601674403b8501c6cc237cbce2() {\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='0796b1601674403b8501c6cc237cbce2 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 0796b1601674403b8501c6cc237cbce2';\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_0796b1601674403b8501c6cc237cbce2()\"><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\n0796b1601674403b8501c6cc237cbce2 ##### SOURCE BEGIN #####\r\n%% An Interactive Version of colorcubes\r\n% A 231-character static version of \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/5\/entries\/11543\r\n% colorcubes> in the current\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/5\/entries\r\n% MiniHack> generated quite a bit of interest.\r\n% So I am posting the full version, where you can change number of cubes\r\n% and the view point,\r\n% <https:\/\/blogs.mathworks.com\/cleve\/files\/colorcubes.m\r\n% at this link>.\r\n\r\n%% Animation\r\n%\r\n% <<color_cubes.gif>>\r\n%\r\n\r\n%% Quiz\r\n% What is the color of the cubelet, or cubelets, in the center?\r\n##### SOURCE END ##### 0796b1601674403b8501c6cc237cbce2\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/colorcubes.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><!--introduction--><p>A 231-character static version of <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/5\/entries\/11543\">colorcubes<\/a> in the current <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/5\/entries\">MiniHack<\/a> generated quite a bit of interest. So I am posting the full version, where you can change number of cubes and the view point, <a href=\"https:\/\/blogs.mathworks.com\/cleve\/files\/colorcubes.m\">at this link<\/a>.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2022\/10\/21\/an-interactive-version-of-colorcubes\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":9378,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,5,23,37],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/9375"}],"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=9375"}],"version-history":[{"count":7,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/9375\/revisions"}],"predecessor-version":[{"id":9387,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/9375\/revisions\/9387"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media\/9378"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=9375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=9375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=9375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}