1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
function [node, face, elem] = meshabox(p0, p1, opt, nodesize)
%
% [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)
%
if (nargin < 4)
nodesize = 1;
end
[node, elem] = surf2mesh([], [], p0, p1, 1, opt, [], [], nodesize);
elem = meshreorient(node, elem(:, 1:4));
face = volface(elem);
|