Back to library index.
Package slice3 (in slice3.i) -
Index of documented functions or symbols:
DOCUMENT getc3(i, m3, chunk) or getc3(i, m3, clist, l, u, fsl, fsu, cells) return cell values of the Ith function attached to 3D mesh M3 for cells in the specified CHUNK. The CHUNK may be a list of cell indices, in which case getc3 returns a (dimsof(CHUNK)) list of vertex coordinates. CHUNK may also be a mesh-specific data structure used in the slice3 routine, in which case getc3 may return a (ni)x(nj)x(nk) array of vertex values. There is no savings in the amount of data for such a CHUNK, but the gather operation is cheaper than a general list of cell indices. Use getc3 when writing colorng functions for slice3. If CHUNK is a CLIST, the additional arguments L, U, FSL, and FSU are vertex index lists which override the CLIST if the Ith attached function is defined on mesh vertices. L and U are index lists into the 2x2x2x(dimsof(CLIST)) vertex value array, say vva, and FSL and FSU are corresponding interpolation coefficients; the zone centered value is computed as a weighted average of involving these coefficients. The CELLS argument is required by histogram to do the averaging. See the source code for details. By default, this conversion (if necessary) is done by averaging the eight vertex-centered values.
DOCUMENT getv3(i, m3, chunk) return vertex values of the Ith function attached to 3D mesh M3 for cells in the specified CHUNK. The CHUNK may be a list of cell indices, in which case getv3 returns a 2x2x2x(dimsof(CHUNK)) list of vertex coordinates. CHUNK may also be a mesh-specific data structure used in the slice3 routine, in which case getv3 may return a (ni)x(nj)x(nk) array of vertex values. For meshes which are logically rectangular or consist of several rectangular patches, this is up to 8 times less data, with a concomitant performance advantage. Use getv3 when writing slicing functions for slice3.
DOCUMENT mesh3(x,y,z) or mesh3(x,y,z, f1,f2,...) or mesh3(xyz, f1,f2,...) or mesh3(nxnynz, dxdydz, x0y0z0, f1,f2,...) make mesh3 argument for slice3, xyz3, getv3, etc., functions. X, Y, and Z are each 3D coordinate arrays. The optional F1, F2, etc. are 3D arrays of function values (e.g. density, temperature) which have one less value along each dimension than the coordinate arrays. The "index" of each zone in the returned mesh3 is the index in these cell-centered Fi arrays, so every index from one through the total number of cells indicates one real cell. The Fi arrays can also have the same dimensions as X, Y, or Z in order to represent point-centered quantities. If X has four dimensions and the length of the first is 3, then it is interpreted as XYZ (which is the quantity actually stored in the returned cell list). If X is a vector of 3 integers, it is interpreted as [nx,ny,nz] of a uniform 3D mesh, and the second and third arguments are [dx,dy,dz] and [x0,y0,z0] respectively. (DXDYDZ represent the size of the entire mesh, not the size of one cell, and NXNYNZ are the number of cells, not the number of points.)
DOCUMENT pl3surf, nverts, xyzverts or pl3surf, nverts, xyzverts, values Perform simple 3D rendering of an object created by slice3 (possibly followed by slice2). NVERTS and XYZVERTS are polygon lists as returned by slice3, so XYZVERTS is 3-by-sum(NVERTS), where NVERTS is a list of the number of vertices in each polygon. If present, the VALUES should have the same length as NVERTS; they are used to color the polygon. If VALUES is not specified, the 3D lighting calculation set up using the light3 function will be carried out. Keywords cmin= and cmax= as for plf, pli, or plfp are also accepted. (If you do not supply VALUES, you probably want to use the ambient= keyword to light3 instead of cmin= here, but cmax= may still be useful.)
DOCUMENT pl3tree, nverts, xyzverts or pl3tree, nverts, xyzverts, values, plane Add the polygon list specified by NVERTS (number of vertices in each polygon) and XYZVERTS (3-by-sum(NVERTS) vertex coordinates) to the currently displayed b-tree. If VALUES is specified, it must have the same dimension as NVERTS, and represents the color of each polygon. If VALUES is not specified, the polygons are assumed to form an isosurface which will be shaded by the current 3D lighting model; the isosurfaces are at the leaves of the b-tree, sliced by all of the planes. If PLANE is specified, the XYZVERTS must all lie in that plane, and that plane becomes a new slicing plane in the b-tree. Each leaf of the b-tree consists of a set of sliced isosurfaces. A node of the b-tree consists of some polygons in one of the planes, a b-tree or leaf entirely on one side of that plane, and a b-tree or leaf on the other side. The first plane you add becomes the root node, slicing any existing leaf in half. When you add an isosurface, it propagates down the tree, getting sliced at each node, until its pieces reach the existing leaves, to which they are added. When you add a plane, it also propagates down the tree, getting sliced at each node, until its pieces reach the leaves, which it slices, becoming the nodes closest to the leaves. This structure is relatively easy to plot, since from any viewpoint, a node can always be plotted in the order from one side, then the plane, then the other side. This routine assumes a "split palette"; the colors for the VALUES will be scaled to fit from color 0 to color 99, while the colors from the shading calculation will be scaled to fit from color 100 to color 199. (If VALUES is specified as a char array, however, it will be used without scaling.) You may specifiy a cmin= or cmax= keyword to affect the scaling; cmin is ignored if VALUES is not specified (use the ambient= keyword from light3 for that case).
SEE ALSO: pl3surf, slice3, slice2, rot3, light3, split_palette
DOCUMENT plane3(normal, point) or plane3([nx,ny,nz], [px,py,pz]) returns [nx,ny,nz,pp] for the specified plane.
DOCUMENT slice2, plane, nverts, xyzverts or slice2, plane, nverts, xyzverts, values Slice a polygon list, retaining only those polygons or parts of polygons on the positive side of PLANE, that is, the side where xyz(+)*PLANE(+:1:3)-PLANE(4) > 0.0. The NVERTS, XYZVERTS, and VALUES arrays serve as both input and output, and have the meanings of the return values from the slice3 function. It is legal to omit the VALUES argument (e.g.- if there is no fcolor function). In order to plot two intersecting slices, one could slice (for example) the horizontal plane twice (slice2x) - first with the plane of the vertical slice, then with minus that same plane. Then, plot first the back part of the slice, then the vertical slice, then the front part of the horizontal slice. Of course, the vertical plane could be the one to be sliced, and "back" and "front" vary depending on the view point, but the general idea always works.
SEE ALSO: slice3, plane3, slice2x, slice2_precision
DOCUMENT slice2, plane, nverts, values, xyzverts Slice a polygon list, retaining only those polygons or parts of polygons on the positive side of PLANE, that is, the side where xyz(+)*PLANE(+:1:3)-PLANE(4) > 0.0. The NVERTS, VALUES, and XYZVERTS arrays serve as both input and output, and have the meanings of the return values from the slice3 function.
SEE ALSO: slice2, slice2_precision
DOCUMENT slice2_precision= precision Controls how slice2 (or slice2x) handles points very close to the slicing plane. PRECISION should be a positive number or zero. Zero PRECISION means to clip exactly to the plane, with points exactly on the plane acting as if they were slightly on the side the normal points toward. Positive PRECISION means that edges are clipped to parallel planes a distance PRECISION on either side of the given plane. (Polygons lying entirely between these planes are completely discarded.) Default value is 0.0.
DOCUMENT slice3, m3, fslice, nverts, xyzverts or color_values= slice3(m3, fslice, nverts, xyzverts, fcolor) or color_values= slice3(m3, fslice, nverts, xyzverts, fcolor, 1) slice the 3D mesh M3 using the slicing function FSLICE, returning the lists NVERTS and XYZVERTS. 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 the slice3 function (numberof(color_values) == numberof(NVERTS) == number of polygons). If the slice function FSLICE is a function, it should be of the form: func fslice returning a list of function values on the specified chunk of the mesh m3. The format of chunk depends on the type of m3 mesh, so you should use only the other mesh functions xyz3 and getv3 which take 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 numbers, it is taken as a slicing plane with the equation FSLICE(+:1:3)*xyz(+)-FSLICE(4), as returned by plane3. If FSLICE is a single integer, the slice will be an isosurface for the FSLICEth variable associated with the mesh M3. In this case, the keyword value= must also be present, representing the value of that variable on the isosurface. If FCOLOR is nil, slice3 returns nil. 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. If FCOLOR is a function, it should be of the form: func fcolor returning a list of function values on the specified cells of the mesh m3. 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 dimsof(cells). If FCOLOR is a single integer, the slice will be an isosurface for the FCOLORth variable associated with the mesh M3. If the optional argument after FCOLOR is non-nil and non-zero, then the FCOLOR function is called with only two arguments: func fcolor
DOCUMENT split_bytscl(x, 0) or split_bytscl(x, 1) as bytscl function, but scale to the lower half of a split palette (0-99, normally the color scale) if the second parameter is zero or nil, or the upper half (100-199, normally the gray scale) if the second parameter is non-zero.
SEE ALSO: split_palette
DOCUMENT split_palette or split_palette, "palette_name.gp" split the current palette or the specified palette into two parts; colors 0 to 99 will be a compressed version of the original, while colors 100 to 199 will be a gray scale.
SEE ALSO: pl3tree, split_bytscl
DOCUMENT to_corners(list, ni, nj) convert a LIST of cell indices in an (NI-1)-by-(NJ-1)-by-(nk-1) logically rectangular grid of cells into the list of 2-by-2-by-2-by-numberof(LIST) cell corner indices in the corresponding NI-by-NJ-by-nk list of vertices.
DOCUMENT xyz3(m3, chunk) return vertex coordinates for CHUNK of 3D mesh M3. The CHUNK may be a list of cell indices, in which case xyz3 returns a 3x2x2x2x(dimsof(CHUNK)) list of vertex coordinates. CHUNK may also be a mesh-specific data structure used in the slice3 routine, in which case xyz3 may return a 3x(ni)x(nj)x(nk) array of vertex coordinates. For meshes which are logically rectangular or consist of several rectangular patches, this is up to 8 times less data, with a concomitant performance advantage. Use xyz3 when writing slicing functions or coloring functions for slice3.