{"id":499,"date":"2016-05-06T13:36:06","date_gmt":"2016-05-06T17:36:06","guid":{"rendered":"https:\/\/blogs.mathworks.com\/graphics\/?p=499"},"modified":"2016-05-06T13:36:06","modified_gmt":"2016-05-06T17:36:06","slug":"the-five-tetrahedra","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/graphics\/2016\/05\/06\/the-five-tetrahedra\/","title":{"rendered":"The Five Tetrahedra"},"content":{"rendered":"<div class=\"content\"><p>The dodecahedron is a particularly interesting polyhedron. It's full of interesting five-fold symmetries. Let's take a look at a couple of them.<\/p><p>First we'll need the vertices. There's an interesting pattern to them.<\/p><pre class=\"codeinput\">p = (1+sqrt(5))\/2;\r\nq = 1\/p;\r\nverts = [-1 -1 -1; <span class=\"keyword\">...<\/span>\r\n         -1 -1  1; <span class=\"keyword\">...<\/span>\r\n          1 -1  1; <span class=\"keyword\">...<\/span>\r\n          1 -1 -1; <span class=\"keyword\">...<\/span>\r\n         -q  0 -p; <span class=\"keyword\">...<\/span>\r\n         -p -q  0; <span class=\"keyword\">...<\/span>\r\n          0 -p  q; <span class=\"keyword\">...<\/span>\r\n         -p  q  0; <span class=\"keyword\">...<\/span>\r\n          0 -p -q; <span class=\"keyword\">...<\/span>\r\n          q  0 -p; <span class=\"keyword\">...<\/span>\r\n         -q  0  p; <span class=\"keyword\">...<\/span>\r\n          0  p  q; <span class=\"keyword\">...<\/span>\r\n          p -q  0; <span class=\"keyword\">...<\/span>\r\n          0  p -q; <span class=\"keyword\">...<\/span>\r\n          p  q  0; <span class=\"keyword\">...<\/span>\r\n          q  0  p; <span class=\"keyword\">...<\/span>\r\n         -1  1  1; <span class=\"keyword\">...<\/span>\r\n         -1  1 -1; <span class=\"keyword\">...<\/span>\r\n          1  1 -1; <span class=\"keyword\">...<\/span>\r\n          1  1  1];\r\n<\/pre><p>We can draw them with scatter3.<\/p><pre class=\"codeinput\">grey = [.25 .25 .25];\r\nscatter3(verts(:,1),verts(:,2),verts(:,3),<span class=\"string\">'filled'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,grey)\r\naxis <span class=\"string\">vis3d<\/span>\r\ngrid <span class=\"string\">off<\/span>\r\nbox <span class=\"string\">on<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_01.png\" alt=\"\"> <p>And we can draw the edges like so:<\/p><pre class=\"codeinput\">s = [1 1 1 2 2  2 3  3  3 4  4  4  5  5 6 7  8  8 10 11 11 12 12 12 13 14 14 15 15 16];\r\ne = [5 6 9 6 7 11 7 13 16 9 10 13 10 18 8 9 17 18 19 16 17 14 17 20 15 18 19 19 20 20];\r\nn = nan(1,30);\r\nlx = [verts(s',1)'; verts(e',1)'; n];\r\nly = [verts(s',2)'; verts(e',2)'; n];\r\nlz = [verts(s',3)'; verts(e',3)'; n];\r\nl = line(lx(:),ly(:),lz(:),<span class=\"string\">'Color'<\/span>,grey);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_02.png\" alt=\"\"> <p>If you look at the first 4 vertices and the last 4 vertices, you might recognize that there's a cube hiding inside the dodecahedron. Let's draw it.<\/p><pre class=\"codeinput\">cols = lines(7);\r\nfaces = [ 4 19 20  3; <span class=\"keyword\">...<\/span>\r\n         19 18 17 20; <span class=\"keyword\">...<\/span>\r\n         18  1  2 17; <span class=\"keyword\">...<\/span>\r\n          1  4  3  2; <span class=\"keyword\">...<\/span>\r\n          2  3 20 17; <span class=\"keyword\">...<\/span>\r\n         18 19  4  1];\r\ncube1 = patch(<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(1,:));\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_03.png\" alt=\"\"> <p>Since everything in a dodecahedron comes in multiples of 5, lets make 4 more copies of that cube.<\/p><pre class=\"codeinput\">g2 = hgtransform;\r\ncube2 = patch(<span class=\"string\">'Parent'<\/span>,g2,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(2,:));\r\ng3 = hgtransform;\r\ncube3 = patch(<span class=\"string\">'Parent'<\/span>,g3,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(3,:));\r\ng4 = hgtransform;\r\ncube4 = patch(<span class=\"string\">'Parent'<\/span>,g4,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(4,:));\r\ng5 = hgtransform;\r\ncube5 = patch(<span class=\"string\">'Parent'<\/span>,g5,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(5,:));\r\nset([cube1 cube2 cube3 cube4 cube5],<span class=\"string\">'SpecularStrength'<\/span>,0,<span class=\"string\">'AmbientStrength'<\/span>,.4,<span class=\"string\">'EdgeColor'<\/span>,<span class=\"string\">'none'<\/span>);\r\n\r\nxlim([-p p])\r\nylim([-p p])\r\nzlim([-p p])\r\ncamlight <span class=\"string\">right<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_04.png\" alt=\"\"> <p>The cube has 4 diagonals which define axes of rotational symmetry. What if we start rotating each of those four extra cubes around one of those axes?<\/p><pre class=\"codeinput\">rotax = [1  1  1; <span class=\"keyword\">...<\/span>\r\n        -1  1 -1; <span class=\"keyword\">...<\/span>\r\n        -1 -1  1; <span class=\"keyword\">...<\/span>\r\n         1 -1 -1];\r\n<span class=\"keyword\">for<\/span> ang=linspace(0,2*pi,250)\r\n    g2.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(1,:),ang);\r\n    g3.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(2,:),ang);\r\n    g4.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(3,:),ang);\r\n    g5.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(4,:),ang);\r\n    drawnow\r\n<span class=\"keyword\">end<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/cube_animation.gif\" alt=\"\"> <p>Something interesting happened at a particular angle in there. Did you see it? All of the vertices of the cubes land on vertices of the dodecahedron. It happens when the angle reaches pi\/4.<\/p><pre class=\"codeinput\">ang = pi\/4;\r\ng2.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(1,:),ang);\r\ng3.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(2,:),ang);\r\ng4.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(3,:),ang);\r\ng5.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(4,:),ang);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_06.png\" alt=\"\"> <p>It can be a little easier to see some of the symmetry patterns if we make all of the cubes the same color and add some different edges.<\/p><pre class=\"codeinput\">set(findobj(gca,<span class=\"string\">'Type'<\/span>,<span class=\"string\">'patch'<\/span>),<span class=\"string\">'FaceColor'<\/span>,cols(5,:))\r\ns = [1  1  1  1  2  2  2  2  2  3  3  3  3  3  4  4  4  5  5  5  5  6  6  6  6  6  7 <span class=\"keyword\">...<\/span>\r\n     7  7  8  8  8  9 10 10 10 10 11 11 12 12 12 12 13 13 13 14 14 14 15 16 17 17 18 19];\r\ne = [2  7  8 18  3  8  9 16 17  4  9 11 15 20  7 15 19  6  8 14 19  7  9 11 17 18 11 <span class=\"keyword\">...<\/span>\r\n    13 16 11 12 14 13 13 14 15 18 12 20 15 16 18 19 16 19 20 15 17 20 16 17 18 20 19 20];\r\nn = nan(1,55);\r\nlx2 = [verts(s',1)'; verts(e',1)'; n];\r\nly2 = [verts(s',2)'; verts(e',2)'; n];\r\nlz2 = [verts(s',3)'; verts(e',3)'; n];\r\nl.XData = lx2(:);\r\nl.YData = ly2(:);\r\nl.ZData = lz2(:);\r\nl.LineWidth = 3;\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_07.png\" alt=\"\"> <p>There are also tetrahedra hiding inside the dodecahedron. Let's draw one of them.<\/p><pre class=\"codeinput\">delete(findobj(gca,<span class=\"string\">'Type'<\/span>,<span class=\"string\">'patch'<\/span>))\r\nl.XData = lx(:);\r\nl.YData = ly(:);\r\nl.ZData = lz(:);\r\nl.LineWidth = .5;\r\n\r\nfaces = [2  5 12; <span class=\"keyword\">...<\/span>\r\n         2  5 13; <span class=\"keyword\">...<\/span>\r\n         2 12 13; <span class=\"keyword\">...<\/span>\r\n         5 12 13];\r\ntet1 = patch(<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts);\r\ntet1.FaceColor = cols(1,:);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_08.png\" alt=\"\"> <p>Again, we'll make 5 copies of this.<\/p><pre class=\"codeinput\">g2 = hgtransform;\r\ntet2 = patch(<span class=\"string\">'Parent'<\/span>,g2,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(2,:));\r\ng3 = hgtransform;\r\ntet3 = patch(<span class=\"string\">'Parent'<\/span>,g3,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(3,:));\r\ng4 = hgtransform;\r\ntet4 = patch(<span class=\"string\">'Parent'<\/span>,g4,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(4,:));\r\ng5 = hgtransform;\r\ntet5 = patch(<span class=\"string\">'Parent'<\/span>,g5,<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts,<span class=\"string\">'FaceColor'<\/span>,cols(5,:));\r\nset([tet1 tet2 tet3 tet4 tet5],<span class=\"string\">'SpecularStrength'<\/span>,0,<span class=\"string\">'AmbientStrength'<\/span>,.4,<span class=\"string\">'EdgeColor'<\/span>,<span class=\"string\">'none'<\/span>);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_09.png\" alt=\"\"> <p>And we'll spin these around four different axes. In this case, the axes of rotation are each through the midpoint of an edge which touches one of the vertices of the tetrahedron.<\/p><pre class=\"codeinput\">r = 1+p;\r\nrotax = [-1, -r,  p; <span class=\"keyword\">...<\/span>\r\n         -p,  1, -r; <span class=\"keyword\">...<\/span>\r\n         -1,  r,  p; <span class=\"keyword\">...<\/span>\r\n          r, -p, -1];\r\n\r\n<span class=\"keyword\">for<\/span> ang=linspace(0,2*pi,250)\r\n    g2.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(1,:),ang);\r\n    g3.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(2,:),ang);\r\n    g4.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(3,:),ang);\r\n    g5.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(4,:),ang);\r\n    drawnow\r\n<span class=\"keyword\">end<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/tetrahedron_animation.gif\" alt=\"\"> <p>This one's a bit harder to follow, but there is one particularly interesting angle in this case too. When the angle of rotation reaches pi, all of the vertices of the tetrahedra land on vertices of the dodecahedron.<\/p><pre class=\"codeinput\">ang = pi;\r\ng2.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(1,:),ang);\r\ng3.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(2,:),ang);\r\ng4.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(3,:),ang);\r\ng5.Matrix = makehgtform(<span class=\"string\">'axisrotate'<\/span>,rotax(4,:),ang);\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_11.png\" alt=\"\"> <p>The pattern can be a little hard to see at first, but if we look straight down on one of the faces of the dodecahedron, it jumps out at us.<\/p><pre class=\"codeinput\">view(0,60)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_12.png\" alt=\"\"> <p>If we combine the tetrahedra, we get an interesting shape that was first described by Edmund Hess in 1876, who also described that compound of the five cubes.<\/p><pre class=\"codeinput\">set(findobj(gca,<span class=\"string\">'Type'<\/span>,<span class=\"string\">'patch'<\/span>),<span class=\"string\">'FaceColor'<\/span>,cols(5,:))\r\naxis <span class=\"string\">off<\/span>\r\ndelete(findobj(gca,<span class=\"string\">'Type'<\/span>,<span class=\"string\">'line'<\/span>))\r\ndelete(findobj(gca,<span class=\"string\">'Type'<\/span>,<span class=\"string\">'scatter'<\/span>))\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_13.png\" alt=\"\"> <p>One of the unusual features of this shape is that it is an enantiomorph of its dual. <a href=\"https:\/\/en.wiktionary.org\/wiki\/enantiomorph\">Enantiomorphs<\/a> are shapes which are mirror images of each other. There's another object which is a mirror image of this one. Coxeter called this one the \"dextro\" version. Here's the other one, which is known as the \"laevo\" version.<\/p><pre class=\"codeinput\">first_ax = gca;\r\nfirst_ax.Position = [.05 .05 .4 .8];\r\ntitle(first_ax,<span class=\"string\">'Dextro'<\/span>)\r\nsecond_ax = copyobj(first_ax,first_ax.Parent);\r\nsecond_ax.Position = [.55 .05 .4 .8];\r\ndelete(findobj(second_ax,<span class=\"string\">'Type'<\/span>,<span class=\"string\">'patch'<\/span>))\r\n\r\nfaces = [8  9 19; 8 16  9; 8 19 16;  9 16 19; <span class=\"keyword\">...<\/span>\r\n         5  7 15; 5 17  7; 5 15 17;  7 17 15; <span class=\"keyword\">...<\/span>\r\n         3  6 12; 3 10  6; 3 12 10;  6 10 12; <span class=\"keyword\">...<\/span>\r\n         1 11 13; 1 14 11; 1 13 14; 11 14 13; <span class=\"keyword\">...<\/span>\r\n         2  4 18; 2 20  4; 2 18 20;  4 20 18];\r\nhlaevo = patch(<span class=\"string\">'Faces'<\/span>,faces,<span class=\"string\">'Vertices'<\/span>,verts, <span class=\"keyword\">...<\/span>\r\n               <span class=\"string\">'FaceColor'<\/span>,cols(5,:),<span class=\"string\">'EdgeColor'<\/span>,<span class=\"string\">'none'<\/span>, <span class=\"keyword\">...<\/span>\r\n               <span class=\"string\">'SpecularStrength'<\/span>,0,<span class=\"string\">'AmbientStrength'<\/span>,.4, <span class=\"keyword\">...<\/span>\r\n               <span class=\"string\">'Parent'<\/span>,second_ax);\r\ntitle(second_ax,<span class=\"string\">'Laevo'<\/span>)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_14.png\" alt=\"\"> <p>The dextro and laevo versions look similar, but you can't rotate one of them in such a way as to make it match the other one.<\/p><p>If we combine a dextro and a laevo in the same axes, we get another interesting object, but that's a story for another day.<\/p><pre class=\"codeinput\">hlaevo.Parent = first_ax;\r\ndelete(second_ax)\r\nfirst_ax.Position = [0 0 1 1];\r\ntitle(first_ax,<span class=\"string\">''<\/span>)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_script_15.png\" alt=\"\"> <p>I've always found these 5-way symmetries fascinating. What do you think?<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_aa21b1bf55a44901bd8a2d8ad4ef722f() {\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='aa21b1bf55a44901bd8a2d8ad4ef722f ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' aa21b1bf55a44901bd8a2d8ad4ef722f';\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 2016 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_aa21b1bf55a44901bd8a2d8ad4ef722f()\"><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; R2016a<br><\/p><\/div><!--\r\naa21b1bf55a44901bd8a2d8ad4ef722f ##### SOURCE BEGIN #####\r\n%%\r\n% The dodecahedron is a particularly interesting polyhedron. It's full of\r\n% interesting five-fold symmetries. Let's take a look at a couple of them.\r\n%\r\n% First we'll need the vertices. There's an interesting pattern to them.\r\n%\r\np = (1+sqrt(5))\/2;\r\nq = 1\/p;\r\nverts = [-1 -1 -1; ...\r\n         -1 -1  1; ...\r\n          1 -1  1; ...\r\n          1 -1 -1; ...\r\n         -q  0 -p; ...\r\n         -p -q  0; ...\r\n          0 -p  q; ...\r\n         -p  q  0; ...\r\n          0 -p -q; ...\r\n          q  0 -p; ...\r\n         -q  0  p; ...\r\n          0  p  q; ...\r\n          p -q  0; ...\r\n          0  p -q; ...\r\n          p  q  0; ...\r\n          q  0  p; ...\r\n         -1  1  1; ...\r\n         -1  1 -1; ...\r\n          1  1 -1; ...\r\n          1  1  1];\r\n      \r\n%%\r\n% We can draw them with scatter3.\r\n%\r\ngrey = [.25 .25 .25];\r\nscatter3(verts(:,1),verts(:,2),verts(:,3),'filled','MarkerFaceColor',grey)\r\naxis vis3d\r\ngrid off\r\nbox on\r\n\r\n%%\r\n% And we can draw the edges like so:\r\n%\r\ns = [1 1 1 2 2  2 3  3  3 4  4  4  5  5 6 7  8  8 10 11 11 12 12 12 13 14 14 15 15 16];\r\ne = [5 6 9 6 7 11 7 13 16 9 10 13 10 18 8 9 17 18 19 16 17 14 17 20 15 18 19 19 20 20];\r\nn = nan(1,30);\r\nlx = [verts(s',1)'; verts(e',1)'; n];\r\nly = [verts(s',2)'; verts(e',2)'; n];\r\nlz = [verts(s',3)'; verts(e',3)'; n];\r\nl = line(lx(:),ly(:),lz(:),'Color',grey);\r\n\r\n%%\r\n% If you look at the first 4 vertices and the last 4 vertices, you might\r\n% recognize that there's a cube hiding inside the dodecahedron. Let's draw\r\n% it.\r\n%\r\ncols = lines(7);\r\nfaces = [ 4 19 20  3; ...\r\n         19 18 17 20; ...\r\n         18  1  2 17; ...\r\n          1  4  3  2; ...\r\n          2  3 20 17; ...\r\n         18 19  4  1];\r\ncube1 = patch('Faces',faces,'Vertices',verts,'FaceColor',cols(1,:));\r\n\r\n%%\r\n% Since everything in a dodecahedron comes in multiples of 5, lets make\r\n% 4 more copies of that cube.\r\n%\r\ng2 = hgtransform;\r\ncube2 = patch('Parent',g2,'Faces',faces,'Vertices',verts,'FaceColor',cols(2,:));\r\ng3 = hgtransform;\r\ncube3 = patch('Parent',g3,'Faces',faces,'Vertices',verts,'FaceColor',cols(3,:));\r\ng4 = hgtransform;\r\ncube4 = patch('Parent',g4,'Faces',faces,'Vertices',verts,'FaceColor',cols(4,:));\r\ng5 = hgtransform;\r\ncube5 = patch('Parent',g5,'Faces',faces,'Vertices',verts,'FaceColor',cols(5,:));\r\nset([cube1 cube2 cube3 cube4 cube5],'SpecularStrength',0,'AmbientStrength',.4,'EdgeColor','none');\r\n\r\nxlim([-p p])\r\nylim([-p p])\r\nzlim([-p p])\r\ncamlight right\r\n\r\n%%\r\n% The cube has 4 diagonals which define axes of rotational symmetry. What\r\n% if we start rotating each of those four extra cubes around one of those axes?\r\n%\r\nrotax = [1  1  1; ...\r\n        -1  1 -1; ...\r\n        -1 -1  1; ...\r\n         1 -1 -1];\r\nfor ang=linspace(0,2*pi,250)\r\n    g2.Matrix = makehgtform('axisrotate',rotax(1,:),ang);\r\n    g3.Matrix = makehgtform('axisrotate',rotax(2,:),ang);\r\n    g4.Matrix = makehgtform('axisrotate',rotax(3,:),ang);\r\n    g5.Matrix = makehgtform('axisrotate',rotax(4,:),ang);\r\n    drawnow\r\nend\r\n\r\n%%\r\n% Something interesting happened at a particular angle in there. Did you\r\n% see it? All of the vertices of the cubes land on vertices of the dodecahedron. \r\n% It happens when the angle reaches pi\/4.\r\n%\r\nang = pi\/4;\r\ng2.Matrix = makehgtform('axisrotate',rotax(1,:),ang);\r\ng3.Matrix = makehgtform('axisrotate',rotax(2,:),ang);\r\ng4.Matrix = makehgtform('axisrotate',rotax(3,:),ang);\r\ng5.Matrix = makehgtform('axisrotate',rotax(4,:),ang);\r\n\r\n%%\r\n% It can be a little easier to see some of the symmetry patterns if we make\r\n% all of the cubes the same color and add some different edges.\r\n%\r\nset(findobj(gca,'Type','patch'),'FaceColor',cols(5,:))\r\ns = [1  1  1  1  2  2  2  2  2  3  3  3  3  3  4  4  4  5  5  5  5  6  6  6  6  6  7 ...\r\n     7  7  8  8  8  9 10 10 10 10 11 11 12 12 12 12 13 13 13 14 14 14 15 16 17 17 18 19];\r\ne = [2  7  8 18  3  8  9 16 17  4  9 11 15 20  7 15 19  6  8 14 19  7  9 11 17 18 11 ...\r\n    13 16 11 12 14 13 13 14 15 18 12 20 15 16 18 19 16 19 20 15 17 20 16 17 18 20 19 20];  \r\nn = nan(1,55);\r\nlx2 = [verts(s',1)'; verts(e',1)'; n];\r\nly2 = [verts(s',2)'; verts(e',2)'; n];\r\nlz2 = [verts(s',3)'; verts(e',3)'; n];\r\nl.XData = lx2(:);\r\nl.YData = ly2(:);\r\nl.ZData = lz2(:);\r\nl.LineWidth = 3;\r\n\r\n%%\r\n% There are also tetrahedra hiding inside the dodecahedron. Let's draw one\r\n% of them.\r\n%\r\ndelete(findobj(gca,'Type','patch'))\r\nl.XData = lx(:);\r\nl.YData = ly(:);\r\nl.ZData = lz(:);\r\nl.LineWidth = .5;\r\n\r\nfaces = [2  5 12; ...\r\n         2  5 13; ...\r\n         2 12 13; ...\r\n         5 12 13];\r\ntet1 = patch('Faces',faces,'Vertices',verts);\r\ntet1.FaceColor = cols(1,:);\r\n\r\n%%\r\n% Again, we'll make 5 copies of this.\r\ng2 = hgtransform;\r\ntet2 = patch('Parent',g2,'Faces',faces,'Vertices',verts,'FaceColor',cols(2,:));\r\ng3 = hgtransform;\r\ntet3 = patch('Parent',g3,'Faces',faces,'Vertices',verts,'FaceColor',cols(3,:));\r\ng4 = hgtransform;\r\ntet4 = patch('Parent',g4,'Faces',faces,'Vertices',verts,'FaceColor',cols(4,:));\r\ng5 = hgtransform;\r\ntet5 = patch('Parent',g5,'Faces',faces,'Vertices',verts,'FaceColor',cols(5,:));\r\nset([tet1 tet2 tet3 tet4 tet5],'SpecularStrength',0,'AmbientStrength',.4,'EdgeColor','none');\r\n\r\n%%\r\n% And we'll spin these around four different axes. In this case, the axes\r\n% of rotation are each through the midpoint of an edge which touches one of\r\n% the vertices of the tetrahedron.\r\n%\r\nr = 1+p;\r\nrotax = [-1, -r,  p; ...\r\n         -p,  1, -r; ...\r\n         -1,  r,  p; ...\r\n          r, -p, -1];\r\n     \r\nfor ang=linspace(0,2*pi,250)\r\n    g2.Matrix = makehgtform('axisrotate',rotax(1,:),ang);\r\n    g3.Matrix = makehgtform('axisrotate',rotax(2,:),ang);\r\n    g4.Matrix = makehgtform('axisrotate',rotax(3,:),ang);\r\n    g5.Matrix = makehgtform('axisrotate',rotax(4,:),ang);\r\n    drawnow\r\nend\r\n\r\n%%\r\n% This one's a bit harder to follow, but there is one particularly\r\n% interesting angle in this case too. When the angle of rotation reaches\r\n% pi, all of the vertices of the tetrahedra land on vertices of the\r\n% dodecahedron.\r\n%\r\nang = pi;\r\ng2.Matrix = makehgtform('axisrotate',rotax(1,:),ang);\r\ng3.Matrix = makehgtform('axisrotate',rotax(2,:),ang);\r\ng4.Matrix = makehgtform('axisrotate',rotax(3,:),ang);\r\ng5.Matrix = makehgtform('axisrotate',rotax(4,:),ang);\r\n\r\n%%\r\n% The pattern can be a little hard to see at first, but if we look straight\r\n% down on one of the faces of the dodecahedron, it jumps out at us.\r\nview(0,60)\r\n\r\n%%\r\n% If we combine the tetrahedra, we get an interesting shape that was first\r\n% described by Edmund Hess in 1876, who also described that compound of the\r\n% five cubes.\r\n%\r\nset(findobj(gca,'Type','patch'),'FaceColor',cols(5,:))\r\naxis off\r\ndelete(findobj(gca,'Type','line'))\r\ndelete(findobj(gca,'Type','scatter'))\r\n\r\n%%\r\n% One of the unusual features of this shape is that it is an enantiomorph of its dual. \r\n% <https:\/\/en.wiktionary.org\/wiki\/enantiomorph Enantiomorphs> are shapes which are mirror images of each\r\n% other. There's another object which is a mirror image of this one.\r\n% Coxeter called this one the \"dextro\" version. Here's the other one, which\r\n% is known as the \"laevo\" version.\r\n%\r\nfirst_ax = gca;\r\nfirst_ax.Position = [.05 .05 .4 .8];\r\ntitle(first_ax,'Dextro')\r\nsecond_ax = copyobj(first_ax,first_ax.Parent);\r\nsecond_ax.Position = [.55 .05 .4 .8];\r\ndelete(findobj(second_ax,'Type','patch'))\r\n\r\nfaces = [8  9 19; 8 16  9; 8 19 16;  9 16 19; ...\r\n         5  7 15; 5 17  7; 5 15 17;  7 17 15; ...\r\n         3  6 12; 3 10  6; 3 12 10;  6 10 12; ...\r\n         1 11 13; 1 14 11; 1 13 14; 11 14 13; ...\r\n         2  4 18; 2 20  4; 2 18 20;  4 20 18];\r\nhlaevo = patch('Faces',faces,'Vertices',verts, ...\r\n               'FaceColor',cols(5,:),'EdgeColor','none', ...\r\n               'SpecularStrength',0,'AmbientStrength',.4, ...\r\n               'Parent',second_ax);\r\ntitle(second_ax,'Laevo')\r\n\r\n%%\r\n% The dextro and laevo versions look similar, but you can't rotate one of\r\n% them in such a way as to make it match the other one.\r\n%\r\n% If we combine a dextro and a laevo in the same axes, we get another\r\n% interesting object, but that's a story for another day.\r\n%\r\nhlaevo.Parent = first_ax;\r\ndelete(second_ax)\r\nfirst_ax.Position = [0 0 1 1];\r\ntitle(first_ax,'')\r\n\r\n%%\r\n% I've always found these 5-way symmetries fascinating. What do you think?\r\n%\r\n\r\n##### SOURCE END ##### aa21b1bf55a44901bd8a2d8ad4ef722f\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/graphics\/files\/five_tetrahedra_thumbnail.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>The dodecahedron is a particularly interesting polyhedron. It's full of interesting five-fold symmetries. Let's take a look at a couple of them.First we'll need the vertices. There's an interesting... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/graphics\/2016\/05\/06\/the-five-tetrahedra\/\">read more >><\/a><\/p>","protected":false},"author":89,"featured_media":501,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts\/499"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/users\/89"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/comments?post=499"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":707,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/posts\/499\/revisions\/707"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/media\/501"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/categories?post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics\/wp-json\/wp\/v2\/tags?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}