CREATESOCCERBALL Create a 3D mesh representing a soccer ball. It is basically a wrapper of the 'bucky' function in matlab. [V, E, F] = createSoccerBall return vertices, edges and faces that constitute a soccerball V is a 60-by-3 array containing vertex coordinates E is a 90-by-2 array containing indices of neighbor vertices F is a 32-by-1 cell array containing vertex indices of each face Example [v, f] = createSoccerBall; drawMesh(v, f); See also meshes, drawMesh, bucky
0001 function varargout = createSoccerBall() 0002 %CREATESOCCERBALL Create a 3D mesh representing a soccer ball. 0003 % 0004 % It is basically a wrapper of the 'bucky' function in matlab. 0005 % [V, E, F] = createSoccerBall 0006 % return vertices, edges and faces that constitute a soccerball 0007 % V is a 60-by-3 array containing vertex coordinates 0008 % E is a 90-by-2 array containing indices of neighbor vertices 0009 % F is a 32-by-1 cell array containing vertex indices of each face 0010 % Example 0011 % [v, f] = createSoccerBall; 0012 % drawMesh(v, f); 0013 % 0014 % See also 0015 % meshes, drawMesh, bucky 0016 0017 % ------ 0018 % Author: David Legland 0019 % e-mail: david.legland@inra.fr 0020 % Created: 2006-08-09 0021 % Copyright 2006 INRA - CEPIA Nantes - MIAJ (Jouy-en-Josas). 0022 0023 % HISTORY 0024 % 2007-01-04 remove unused variables, enhance output processing 0025 % 2010-12-07 clean up edges, uses formatMeshOutput 0026 0027 0028 % get vertices and adjacency matrix of the buckyball 0029 [b, n] = bucky; 0030 0031 % compute edges 0032 [i, j] = find(b); 0033 e = [i j]; 0034 e = unique(sort(e, 2), 'rows'); 0035 0036 % compute polygons that correspond to each 3D face 0037 f = minConvexHull(n)'; 0038 0039 % format output 0040 varargout = formatMeshOutput(nargout, n, e, f);