Home > vbmeg > external > iso2mesh > meshedge.m

meshedge

PURPOSE ^

SYNOPSIS ^

function edges=meshedge(elem,varargin)

DESCRIPTION ^

 edges=meshedge(elem,opt)

 return all edges in a surface or volumetric mesh

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2011/02/26

 input:
    elem:  element table of a mesh (support N-d space element)
    opt: optional input, giving the additional options. If opt
         is a struct, it can have the following field:
       opt.nodeorder: if 1, assuming the elem node indices is in CCW 
                      orientation; 0 use nchoosek() output to order edges
         you can replace opt by a series of ('param', value) pairs.

 output:
    edge:  edge list; each row is an edge, specified by the starting and
           ending node indices, the total edge number is
           size(elem,1) x nchoosek(size(elem,2),2). All edges are ordered
           by looping through each element first. 

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function edges=meshedge(elem,varargin)
0002 %
0003 % edges=meshedge(elem,opt)
0004 %
0005 % return all edges in a surface or volumetric mesh
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 % date: 2011/02/26
0009 %
0010 % input:
0011 %    elem:  element table of a mesh (support N-d space element)
0012 %    opt: optional input, giving the additional options. If opt
0013 %         is a struct, it can have the following field:
0014 %       opt.nodeorder: if 1, assuming the elem node indices is in CCW
0015 %                      orientation; 0 use nchoosek() output to order edges
0016 %         you can replace opt by a series of ('param', value) pairs.
0017 %
0018 % output:
0019 %    edge:  edge list; each row is an edge, specified by the starting and
0020 %           ending node indices, the total edge number is
0021 %           size(elem,1) x nchoosek(size(elem,2),2). All edges are ordered
0022 %           by looping through each element first.
0023 %
0024 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0025 %
0026 
0027 dim=size(elem);
0028 edgeid=nchoosek(1:dim(2),2);
0029 len=size(edgeid,1);
0030 edges=zeros(dim(1)*len,2);
0031 for i=0:len-1
0032     edges((i*dim(1)+1):((i+1)*dim(1)),:)=[elem(:,edgeid(i+1,1)) elem(:,edgeid(i+1,2))];
0033 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005