[node,face,elem]=meshabox(p0,p1,opt,nodesize) create the surface and tetrahedral mesh of a box geometry author: Qianqian Fang, <q.fang at neu.edu> input: p0: coordinates (x,y,z) for one end of the box diagnoal p1: coordinates (x,y,z) for the other end of the box diagnoal opt: maximum volume of the tetrahedral elements nodesize: 1 or a 8x1 array, size of the element near each vertex output: node: node coordinates, 3 columns for x, y and z respectively face: integer array with dimensions of NB x 3, each row represents a surface mesh face element elem: integer array with dimensions of NE x 4, each row represents a tetrahedron example: [node,face,elem]=meshabox([2 3 2],[6 12 15],0.1,1); plotmesh(node,elem,'x>4'); -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function [node,face,elem]=meshabox(p0,p1,opt,nodesize) 0002 % 0003 % [node,face,elem]=meshabox(p0,p1,opt,nodesize) 0004 % 0005 % create the surface and tetrahedral mesh of a box geometry 0006 % 0007 % author: Qianqian Fang, <q.fang at neu.edu> 0008 % 0009 % input: 0010 % p0: coordinates (x,y,z) for one end of the box diagnoal 0011 % p1: coordinates (x,y,z) for the other end of the box diagnoal 0012 % opt: maximum volume of the tetrahedral elements 0013 % nodesize: 1 or a 8x1 array, size of the element near each vertex 0014 % 0015 % output: 0016 % node: node coordinates, 3 columns for x, y and z respectively 0017 % face: integer array with dimensions of NB x 3, each row represents 0018 % a surface mesh face element 0019 % elem: integer array with dimensions of NE x 4, each row represents 0020 % a tetrahedron 0021 % 0022 % example: 0023 % [node,face,elem]=meshabox([2 3 2],[6 12 15],0.1,1); 0024 % plotmesh(node,elem,'x>4'); 0025 % 0026 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0027 % 0028 0029 if(nargin<4) 0030 nodesize=1; 0031 end 0032 [node,elem,face]=surf2mesh([],[],p0,p1,1,opt,[],[],nodesize); 0033 elem=elem(:,1:4); 0034 face=face(:,1:3);