Home > matGeom > meshes3d > createCubeOctahedron.m

createCubeOctahedron

PURPOSE ^

CREATECUBEOCTAHEDRON Create a 3D mesh representing a cube-octahedron.

SYNOPSIS ^

function varargout = createCubeOctahedron()

DESCRIPTION ^

CREATECUBEOCTAHEDRON Create a 3D mesh representing a cube-octahedron.

   [V, E, F] = createCubeOctahedron;
   Cubeoctahedron can be seen either as a truncated cube, or as a
   truncated octahedron.
   V is the 12-by-3 array of vertex coordinates
   E is the 27-by-2 array of edge vertex indices
   F is the 1-by-14 cell array of face vertex indices

   [V, F] = createCubeOctahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createCubeOctahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
   [n, e, f] = createCubeOctahedron;
   drawMesh(n, f);
   
   See also
   meshes3d, drawMesh, createCube, createOctahedron

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = createCubeOctahedron()
0002 %CREATECUBEOCTAHEDRON Create a 3D mesh representing a cube-octahedron.
0003 %
0004 %   [V, E, F] = createCubeOctahedron;
0005 %   Cubeoctahedron can be seen either as a truncated cube, or as a
0006 %   truncated octahedron.
0007 %   V is the 12-by-3 array of vertex coordinates
0008 %   E is the 27-by-2 array of edge vertex indices
0009 %   F is the 1-by-14 cell array of face vertex indices
0010 %
0011 %   [V, F] = createCubeOctahedron;
0012 %   Returns only the vertices and the face vertex indices.
0013 %
0014 %   MESH = createCubeOctahedron;
0015 %   Returns the data as a mesh structure, with fields 'vertices', 'edges'
0016 %   and 'faces'.
0017 %
0018 %   Example
0019 %   [n, e, f] = createCubeOctahedron;
0020 %   drawMesh(n, f);
0021 %
0022 %   See also
0023 %   meshes3d, drawMesh, createCube, createOctahedron
0024 %
0025 
0026 % ------
0027 % Author: David Legland
0028 % E-mail: david.legland@inrae.fr
0029 % Created: 2005-02-10
0030 % Copyright 2005-2024 INRA - TPV URPOI - BIA IMASTE
0031 
0032 nodes = [...
0033     0 -1 1;1 0 1;0 1 1;-1 0 1; ...
0034     1 -1 0;1 1 0;-1 1 0;-1 -1 0;...
0035     0 -1 -1;1 0 -1;0 1 -1;-1 0 -1];
0036 
0037 edges = [...
0038      1  2;  1  4; 1 5; 1 8; ...
0039      2  3;  2  5; 2 6; ...
0040      3  4;  3  6; 3 7; ...
0041      4  7;  4  8; ...
0042      5  9;  5 10; ...
0043      6 10;  6 11; ...
0044      7 11;  7 12; ...
0045      8  9;  8 12; ...
0046      9 10;  9 12; ...
0047     10 11; 11 12];
0048 
0049 faces = {...
0050     [1 2 3 4], [1 5 2], [2 6 3], [3 7 4], [4 8 1], ...
0051     [5 10 6 2], [3 6 11 7], [4 7 12 8], [1 8 9 5], ...
0052     [5 9 10], [6 10 11], [7 11 12], [8 12 9], [9 12 11 10]};
0053 
0054 % format output
0055 varargout = formatMeshOutput(nargout, nodes, edges, faces);
0056

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022