Home > bioelectromagnetism > mesh_refine.m

mesh_refine

PURPOSE ^

mesh_refine - creates smaller triangles from a triangle mesh

SYNOPSIS ^

function [ FV ] = mesh_refine(FV,Nface)

DESCRIPTION ^

 mesh_refine - creates smaller triangles from a triangle mesh

 [ FV ] = mesh_refine( FV, Nface )

 FV.vertices   - vertex matrix (Nx3)
 FV.faces      - face matrix (Mx3), indices into vertex matrix rows

 Nface         - subdivide faces into 4 or 6 faces,
                 the default 4 provides an even subdivision
 
 This function calls mesh_refine_tri4 or mesh_refine_tri6.  See
 these for more details.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ FV ] = mesh_refine(FV,Nface)
0002 
0003 % mesh_refine - creates smaller triangles from a triangle mesh
0004 %
0005 % [ FV ] = mesh_refine( FV, Nface )
0006 %
0007 % FV.vertices   - vertex matrix (Nx3)
0008 % FV.faces      - face matrix (Mx3), indices into vertex matrix rows
0009 %
0010 % Nface         - subdivide faces into 4 or 6 faces,
0011 %                 the default 4 provides an even subdivision
0012 %
0013 % This function calls mesh_refine_tri4 or mesh_refine_tri6.  See
0014 % these for more details.
0015 %
0016 
0017 
0018 % This can be done until some minimal distance (D) of the mean
0019 % distance between vertices of all triangles is achieved.  If
0020 % no D argument is given, the function refines the mesh once.
0021 %
0022 
0023 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:35 $
0024 
0025 % Licence:  GNU GPL, no implied or express warranties
0026 % History:  08/2002, Darren.Weber_at_radiology.ucsf.edu, created
0027 %                    adapted this function as a wrapper to
0028 %                    mesh_refine_tri4 & mesh_refine_tri6
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 
0031 
0032 if ~exist('FV','var'),
0033     error('MESH_REFINE: NO input FV struct');
0034 elseif isempty(FV),
0035     error('MESH_REFINE: NO input FV struct');
0036 end
0037 
0038 if ~exist('Nface','var'),
0039     Nface = 4;
0040 elseif isempty(Nface),
0041     Nface = 4;
0042 end
0043 
0044 
0045 switch Nface,
0046     
0047 case 4,
0048     FV = mesh_refine_tri4(FV);
0049 case 6,
0050     FV = mesh_refine_tri6(FV);
0051 otherwise
0052     FV = mesh_refine_tri4(FV);
0053 end
0054 
0055 
0056 return
0057

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003