Home > atmlab > gridcreation > uniformsphere > IcosahedronMesh.m

IcosahedronMesh

PURPOSE ^

Name speaks for itself.

SYNOPSIS ^

function TR=IcosahedronMesh

DESCRIPTION ^

 Name speaks for itself.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

IcosahedronMesh.m

SOURCE CODE ^

0001 function TR=IcosahedronMesh
0002 % Name speaks for itself.
0003 
0004 % Get the vertex coordinates
0005 t=(1+sqrt(5))/2; % golden ratio
0006 x=[0 1 t];
0007 s=[1 1 1; 1 1 -1; 1 -1 -1; 1 -1 1];
0008 x=repmat(x,[4 1]).*s;
0009 x=[x;circshift(x,[0 -1]);circshift(x,[0 -2])];
0010 x_L2=sqrt(sum(x.^2,2));
0011 x=bsxfun(@rdivide,x,x_L2);
0012 
0013 % Triangulate the points
0014 Tri = fliplr(convhulln(x));
0015 TR=TriRep(Tri,x);

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005