Skip to content

Commit

Permalink
add extrudesurf function to expand an open surface into a solid
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Nov 8, 2017
1 parent 9f5e9f1 commit 98d9fb4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions extrudesurf.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function [node,face]=extrudesurf(no,fc,vec)
%
% [node,face]=extrudesurf(no,fc,vec)
%
% create a enclosed surface mesh by extruding an open surface
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
%
% output:
% node: 3D node coordinates for the generated surface mesh
% face: triangular face patches of the generated surface mesh, each
% row represents a triangle denoted by the indices of the 3 nodes
%
% -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
%

nlen=size(no,1);
if(length(vec)>1)
node=[no; no+repmat(vec(:)', nlen,1)];
else
node=[no; no+vec*nodesurfnorm(no, fc)];
end

face=[fc; fc+nlen];

edge=surfedge(fc);
sideface=[edge edge(:,1)+nlen; edge+nlen edge(:,2)];
face=[face; sideface];


0 comments on commit 98d9fb4

Please sign in to comment.