CREATETETRAKAIDECAHEDRON Create a 3D mesh representing a tetrakaidecahedron. [V, E, F] = createTetrakaidecahedron; Create a mesh structure representing a tetrakaidecahedron, composed of both square and hexagonal faces. Tetrakaidecahedron can be used to tile the 3D Euclidean space. V is a 24-by-3 array with vertex coordinates, E is a 36-by-2 array containing indices of neighbour vertices, F is a 14-by-1 cell array containing vertex indices array of each face. [V, F] = createTetrakaidecahedron; Returns only the vertices and the face vertex indices. MESH = createTetrakaidecahedron; Returns the data as a mesh structure, with fields 'vertices', 'edges' and 'faces'. Example [n, e, f] = createTetrakaidecahedron; drawMesh(n, f); See also meshes3d, drawMesh
0001 function varargout = createTetrakaidecahedron() 0002 %CREATETETRAKAIDECAHEDRON Create a 3D mesh representing a tetrakaidecahedron. 0003 % 0004 % [V, E, F] = createTetrakaidecahedron; 0005 % Create a mesh structure representing a tetrakaidecahedron, composed of 0006 % both square and hexagonal faces. Tetrakaidecahedron can be used to tile 0007 % the 3D Euclidean space. 0008 % 0009 % V is a 24-by-3 array with vertex coordinates, 0010 % E is a 36-by-2 array containing indices of neighbour vertices, 0011 % F is a 14-by-1 cell array containing vertex indices array of each face. 0012 % 0013 % [V, F] = createTetrakaidecahedron; 0014 % Returns only the vertices and the face vertex indices. 0015 % 0016 % MESH = createTetrakaidecahedron; 0017 % Returns the data as a mesh structure, with fields 'vertices', 'edges' 0018 % and 'faces'. 0019 % 0020 % Example 0021 % [n, e, f] = createTetrakaidecahedron; 0022 % drawMesh(n, f); 0023 % 0024 % See also 0025 % meshes3d, drawMesh 0026 0027 % --------- 0028 % author : David Legland 0029 % e-mail: david.legland@inra.fr 0030 % INRA - TPV URPOI - BIA IMASTE 0031 % created the 10/02/2005. 0032 % 0033 0034 % HISTORY 0035 % 04/01/2007: remove unused variables 0036 0037 nodes = [... 0038 1 0 2;0 1 2;-1 0 2;0 -1 2;... 0039 2 0 1;0 2 1;-2 0 1;0 -2 1;... 0040 2 1 0;1 2 0;-1 2 0;-2 1 0;-2 -1 0;-1 -2 0;1 -2 0;2 -1 0;... 0041 2 0 -1;0 2 -1;-2 0 -1;0 -2 -1;... 0042 1 0 -2;0 1 -2;-1 0 -2;0 -1 -2]; 0043 0044 edges = [... 0045 1 2;1 4;1 5;2 3;2 6;3 4;3 7;4 8;... 0046 5 9;5 16;6 10;6 11;7 12;7 13;8 14;8 15;... 0047 9 10;9 17;10 18;11 12;11 18;12 19;13 14;13 19;14 20;15 16;15 20;16 17;.... 0048 17 21;18 22;19 23;20 24;21 22;21 24;22 23;23 24]; 0049 0050 0051 faces = {... 0052 [1 2 3 4], ... 0053 [1 4 8 15 16 5], [1 5 9 10 6 2], [2 6 11 12 7 3], [3 7 13 14 8 4],... 0054 [5 16 17 9], [6 10 18 11], [7 12 19 13], [8 14 20 15],... 0055 [9 17 21 22 18 10], [11 18 22 23 19 12], [13 19 23 24 20 14], [15 20 24 21 17 16], ... 0056 [21 24 23 22]}; 0057 faces = faces'; 0058 0059 % format output 0060 varargout = formatMeshOutput(nargout, nodes, edges, faces); 0061