Tree @run/76005484-5c73-4540-97f6-afd5b9fa223d/main (Download .tar.gz)
- .git_filters
- debian
- doc
- meshfix
- sample
- tools
- .gitattributes
- .gitmodules
- advancefront.m
- affinemap.m
- AUTHORS.txt
- barydualmesh.m
- base64decode.m
- base64encode.m
- bbxflatsegment.m
- binsurface.m
- bwislands.m
- cgals2m.m
- cgalv2m.m
- ChangeLog.txt
- closestnode.m
- Content.txt
- COPYING.txt
- decodevarname.m
- deislands2d.m
- deislands3d.m
- delendelem.m
- deletemeshfile.m
- DESCRIPTION
- dist2surf.m
- edgeneighbors.m
- elemfacecenter.m
- elemvolume.m
- encodevarname.m
- extractloops.m
- extrudecurve.m
- extrudesurf.m
- faceneighbors.m
- fallbackexeext.m
- fast_match_bracket.m
- fillholes3d.m
- fillsurf.m
- finddisconnsurf.m
- flatsegment.m
- gendocs.sh
- getexeext.m
- getintersecttri.m
- getoptkey.m
- getplanefrom3pt.m
- getvarfrom.m
- gzipdecode.m
- gzipencode.m
- highordertet.m
- i2m.m
- i2m.png
- i2m.prj
- imedge3d.m
- img2mesh.fig
- img2mesh.m
- INDEX
- innersurf.m
- insurface.m
- internalpoint.m
- iso2meshver.m
- isoctavemesh.m
- jdatadecode.m
- jdataencode.m
- jload.m
- jnifticreate.m
- jnii2nii.m
- jsave.m
- jsonopt.m
- latticegrid.m
- layersurf.m
- linextriangle.m
- loadbj.m
- loadjnifti.m
- loadjson.m
- loadmsgpack.m
- loadnifti.m
- loadubjson.m
- lz4decode.m
- lz4encode.m
- lz4hcdecode.m
- lz4hcencode.m
- lzipdecode.m
- lzipencode.m
- lzmadecode.m
- lzmaencode.m
- m2v.m
- maskdist.m
- match_bracket.m
- maxsurf.m
- mcpath.m
- memmapstream.m
- mergemesh.m
- mergestruct.m
- mergesurf.m
- mesh2mask.m
- mesh2vol.m
- meshabox.m
- meshacylinder.m
- meshanellip.m
- meshasphere.m
- meshcentroid.m
- meshcheckrepair.m
- meshconn.m
- meshcylinders.m
- meshedge.m
- mesheuler.m
- meshface.m
- meshgrid5.m
- meshgrid6.m
- meshinterp.m
- meshquality.m
- meshrefine.m
- meshremap.m
- meshreorient.m
- meshresample.m
- meshunitsphere.m
- metchgui.fig
- metchgui.m
- metchgui_one.m
- mwpath.m
- ndgaussian.m
- ndimfilter.m
- neighborelem.m
- nestbracket2dim.m
- nifticreate.m
- nii2jnii.m
- niicodemap.m
- niiformat.m
- nodesurfnorm.m
- nodevolume.m
- orderloopedge.m
- orthdisk.m
- outersurf.m
- plotedges.m
- plotmesh.m
- plotsurf.m
- plottetra.m
- polylineinterp.m
- polylinelen.m
- polylinesimplify.m
- proj2mesh.m
- qmeshcut.m
- raysurf.m
- raytrace.m
- readasc.m
- readgts.m
- readinr.m
- README.md
- README.txt
- readmedit.m
- readmptiff.m
- readnifti.m
- readnirfast.m
- readoff.m
- readsmf.m
- readtetgen.m
- regpt2surf.m
- remeshsurf.m
- removedupelem.m
- removedupnodes.m
- removeisolatednode.m
- removeisolatedsurf.m
- rotatevec3d.m
- rotmat2vec.m
- s2m.m
- s2v.m
- saveabaqus.m
- saveasc.m
- savebinstl.m
- savebj.m
- savebnii.m
- savedxf.m
- savegts.m
- saveinr.m
- savejmesh.m
- savejnifti.m
- savejnii.m
- savejson.m
- savemedit.m
- savemphtxt.m
- savemsgpack.m
- savemsh.m
- savenifti.m
- savenirfast.m
- saveoff.m
- savesmf.m
- savestl.m
- savesurfpoly.m
- savetetgenele.m
- savetetgennode.m
- saveubjson.m
- savevrml.m
- slicesurf.m
- slicesurf3.m
- smoothbinvol.m
- smoothsurf.m
- sms.m
- sortmesh.m
- surf2mesh.m
- surf2vol.m
- surf2volz.m
- surfaceclean.m
- surfacenorm.m
- surfboolean.m
- surfdiffuse.m
- surfedge.m
- surfinterior.m
- surfpart.m
- surfplane.m
- surfreorient.m
- surfseeds.m
- surfvolume.m
- thickenbinvol.m
- thinbinvol.m
- TODO.txt
- uniqedges.m
- uniqfaces.m
- v2m.m
- v2s.m
- varargin2struct.m
- vol2mesh.m
- vol2restrictedtri.m
- vol2surf.m
- volface.m
- volmap2mesh.m
- zlibdecode.m
- zlibencode.m
plotsurf.m @run/76005484-5c73-4540-97f6-afd5b9fa223d/main — raw · history · blame
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | function hm=plotsurf(node,face,varargin) % % hm=plotsurf(node,face,opt) % % plot 3D surface meshes (2d manifold) or polylines (1d manifold) % % author: Qianqian Fang <q.fang at neu.edu> % % input: % node: node coordinates, dimension (nn,3); if node has a % 4th column, it will be used to set the color at each node. % face: triangular surface face list; if face has a 4th column, % it will be used to separate the surface into % sub-surfaces and display them in different colors; % face can be a cell array, each element of the array represents % a polyhedral facet of the mesh, if an element is an array with % two array subelements, the first one is the node index, the % second one is a scalar as the group id of the facet. % opt: additional options for the plotting, see plotmesh % % output: % hm: handle or handles (vector) to the plotted surfaces % % example: % % h=plotsurf(node,face); % h=plotsurf(node,face,'facecolor','r'); % h=plotsurf(node,edges,'linestyle','-','linewidth',2,'color','r'); % % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) % rngstate = rand ('state'); if(nargin>=2) randseed=hex2dec('623F9A9E'); % "U+623F U+9A9E" if(isoctavemesh) randseed=randseed+3; end if(~isempty(getvarfrom({'caller','base'},'ISO2MESH_RANDSEED'))) randseed=getvarfrom({'caller','base'},'ISO2MESH_RANDSEED'); end rand('state',randseed); if(iscell(face)) sc=sparse(10,3); % face colormap sc(1:10,:)=rand(3,10)'; len=length(face); newsurf=cell(1); % reorganizing each labeled surface into a new cell for i=1:len fc=face{i}; if(iscell(fc) && length(fc)>=2) if(fc{2}+1>10) sc(fc{2}+1,:)=rand(1,3); end if(fc{2}+1>length(newsurf)) newsurf{fc{2}+1}={}; end newsurf{fc{2}+1}{end+1}=fc{1}; else % unlabeled facet is tagged by 0 if(iscell(fc)) newsurf{1}{end+1}=cell2mat(fc); else newsurf{1}{end+1}=fc; end end end hold on; h=[]; newlen=length(newsurf); for i=1:newlen if(isempty(newsurf{i})); continue; end try subface=cell2mat(newsurf{i}')'; if(size(subface,1)>1 && ismatrix(subface)) subface=subface'; end h=[h patch('Vertices',node,'Faces',subface,'facecolor',sc(i,:),varargin{:})]; catch for j=1:length(newsurf{i}) h=[h patch('Vertices',node,'Faces',newsurf{i}{j},'facecolor',sc(i,:),varargin{:})]; end end end else if(size(face,2)==4) tag=face(:,4); types=unique(tag); hold on; h=[]; for i=1:length(types) if(size(node,2)==3) h=[h plotasurf(node,face(tag==types(i),1:3),'facecolor',rand(3,1),varargin{:})]; else h=[h plotasurf(node,face(tag==types(i),1:3),varargin{:})]; end end else h=plotasurf(node,face,varargin{:}); end end end if(~isempty(h)) axis equal; if(all(get(gca,'view')==[0 90])) view(3); end end if(~isempty(h) && nargout>=1) hm=h; end rand ('state',rngstate); %------------------------------------------------------------------------- function hh=plotasurf(node,face,varargin) isoct=isoctavemesh; if(size(face,2)<=2) h=plotedges(node,face,varargin{:}); else if(size(node,2)==4) if(isoct && ~exist('trisurf','file')) h=trimesh(face(:,1:3),node(:,1),node(:,2),node(:,3),node(:,4),'edgecolor','k',varargin{:}); else h=trisurf(face(:,1:3),node(:,1),node(:,2),node(:,3),node(:,4),varargin{:}); end else if(isoct && ~exist('trisurf','file')) h=trimesh(face(:,1:3),node(:,1),node(:,2),node(:,3),'edgecolor','k',varargin{:}); else h=trisurf(face(:,1:3),node(:,1),node(:,2),node(:,3),varargin{:}); end end end if(exist('h','var')) hh=h; end |