qmeshcut: Fast Tetrahedral Mesh Cross-sectional Plot

1. Detailed help info:
2. parameters:
3. outputs
4. example:
4.1.1. example output
5. notes

1. Detailed help info:

[cutpos,cutvalue,facedata]=qmeshcut(elem,node,value,cutat)

Fast tetrahedral mesh slicer, by Qianqian Fang, <fangq at nmr.mgh.harvard.edu>

2. parameters:

    elem: an integer array with dimensions of NE x 4, each row contains
          the indices of all the nodes for each tetrahedron
    node: node coordinates, 3 columns for x, y and z respectively
    value: a scalar array with the length of node numbers, can have 
           multiple columns 
    cutat: cutat can have different forms:
           if cutat is a 3x3 matrix, it defines a plane by 3 points: 
                  cutat=[x1 y1 z1;x2 y2 z2;x3 y3 z3]
           if cutat is a vector of 4 element, it defines a plane by
                  a*x+b*y+c*z+d=0  and cutat=[a b c d]
           if cutat is a single scalar, it defines an isosurface 
                  inside the mesh at value=cutat
           if cutat is a string, it defines an implicit surface
                  at which the cut is made. it must has form expr1=expr2
                  where expr1 expr2 are expressions made of x,y,z,v and
                  constants
           if cutat is a cell in the form of {'expression',scalar}, 
                  the expression will be evaluated at each node to 
                  produce a new value and an isosurface is produced 
                  at the levelset where new value=scalar; the 
                  expression can contain constants and x,y,z,v

3. outputs

cutpos
all the intersections of mesh edges by the plane cutpos is similar to node, containing 3 columns for x/y/z
cutvalue
interpolated values at the intersections, with row number being the num. of the intersections, column number is the same as "value".
facedata
define the intersection polygons in the form of patch "Faces"

the outputs of this subroutine can be easily viewed using

    patch('Vertices',cutpos,'Faces',facedata,'FaceVertexCData',cutvalue,'FaceColor','interp');  

4. example:

please run sample/demo_qmeshcut_ex1.m

4.1.1. example output

cut along a plane
upload:qmeshcut_sample.png

cut along isosurfaces
upload:qmeshcut_isosurface.png

5. notes

This function is not included in iso2mesh 0.5.1. You can get it via CVS. It will be included in the next release of this toolbox. One can also download an early version of qmeshcut.m from Matlab File Exchange.

This function is Octave compatible.

User toolbar
Powered by Habitat