next up previous contents index
Next: slice2 and slice2x: Slicing Up: The Slicing Functions Previous: slice3mesh: Pseudo-slice for a   Contents   Index


slice3: Plane and Isosurface Slices of a 3D mesh

Calling Sequence
...
  
[nverts, xyzverts, color] = \ 
slice3 (m3, fslice, nv, xyzv [, fcolor [, flg 1 ]] 

[, value = <val>] [, node = flg 2 ])

Description
Slice the 3D mesh m3 as specified by fslice, returning the list [nverts, xyzverts, color]. nverts is the number of vertices in each polygon of the slice, and xyzverts is the 3-by-sum (nverts) list of polygon vertices. If the fcolor argument is present, the values of that coloring function on the polygons are returned as the value of color. color will have the same size as nverts, i. e., the number of polygons in the slice, except that the keyword argument node, if present and nonzero, is a signal to return node-centered values rather than cell-centered values. In the latter case color will be sum (nverts) long and entries in color will be associated with the corresponding coordinates in xyzverts. nv and xyzv are not needed; None should be passed as their values (this is a leftover from an older version of the code).

fslice can be a function, a vector of 4 reals, or an integer number. If fslice is a function, it should be of the form:

  
def fslice (m3, chunk) 
or, in the case of an isosurface slice, 
def fslice (m3, chunk, iso_index, _value) 
or for a plane slice, 
def fslice (m3, chunk, normal, projection)

and should return a list of function values on the specified chunk of the mesh m3. Module slice3 offers plane and isosurface slicers (for descriptions, see page [*]). If you wish to write your own slice routine, you should bear in mind that the format of chunk depends on the type of m3 mesh, so you should use only the appropriate mesh functions xyz3 and getv3 which take that type of m3 and chunk as arguments. The return value of fslice should have the same dimensions as the return value of getv3; the return value of xyz3 has an additional first dimension of length 3.

If fslice is a list of 4 reals, it is taken as a slicing plane as returned by plane3.

If fslice is a single integer, the slice will be an isosurface for the fslice th function associated with the mesh m3. In this case, the keyword value must also be present, representing the value of that function on the isosurface.

If fcolor is omitted or has value None, then slice3 returns None as the value of color.. If you want to color the polygons in a manner that depends only on their vertex coordinates (e. g., by a 3D shading calculation), use this mode.

fcolor can be a function or a single integer. If fcolor is a function, it should be of the form: def fcolor (m3, cells, l, u, fsl, fsu, ihist) and should return a list of function values on the specified cells of the mesh m3. If the optional argument flg 1 after fcolor is not missing or None and is non-zero, then the fcolor function is called with only two arguments:

  
def fcolor (m3, cells)
The cells argument will be the list of cell indices in m3 at which values are to be returned. l, u, fsl, fsu, and ihist are interpolation coefficients which can be used to interpolate from vertex centered values to the required cell centered values, ignoring the cells argument. See getc3 source code. The return values should always have the same size and shape as cells.

If fcolor is a single integer, then the slice will be an isosurface for the fcolor th variable associated with the mesh m3.


next up previous contents index
Next: slice2 and slice2x: Slicing Up: The Slicing Functions Previous: slice3mesh: Pseudo-slice for a   Contents   Index
Michiel Jan Laurens de Hoon 2003-04-19