[newelem, evol]=meshreorient(node,elem) reorder nodes in a surface or tetrahedral mesh to ensure all elements are oriented consistently author: Qianqian Fang, <q.fang at neu.edu> date: 2010/05/05 input: node: list of nodes elem: list of elements (each row are indices of nodes of each element) output: newelem: the element list with consistent ordering evol: the signed element volume before reorientation -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function [newelem, evol]=meshreorient(node,elem) 0002 % 0003 % [newelem, evol]=meshreorient(node,elem) 0004 % 0005 % reorder nodes in a surface or tetrahedral mesh to ensure all 0006 % elements are oriented consistently 0007 % 0008 % author: Qianqian Fang, <q.fang at neu.edu> 0009 % date: 2010/05/05 0010 % 0011 % input: 0012 % node: list of nodes 0013 % elem: list of elements (each row are indices of nodes of each element) 0014 % 0015 % output: 0016 % newelem: the element list with consistent ordering 0017 % evol: the signed element volume before reorientation 0018 % 0019 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0020 % 0021 0022 % calculate the canonical volume of the element (can be a 2D or 3D) 0023 evol=elemvolume(node,elem,'signed'); 0024 0025 % make sure all elements are positive in volume 0026 idx=find(evol<0); 0027 elem(idx,[end-1,end])=elem(idx,[end,end-1]); 0028 newelem=elem;