RCS Header: /cvsroot/petscgraphics/illuminator.c,v 1.7 2003/05/06 23:15:25 hazelsct Exp
This is the illuminator.c main file. It has all of the routines which
compute the triangulation in a distributed way.
Included Files
Preprocessor definitions
Maximum number of generated triangles per
node.
#define MAX_TRIANGLES 2000000
#define __FUNCT__ "storetri"
#define __FUNCT__ "DrawTetWithPlane"
#define COORD( c1, c2, index )
#define __FUNCT__ "DrawTet"
#define __FUNCT__ "DrawHex"
#define __FUNCT__ "Draw3DBlock"
Number of triangles in this node. Its value is initialized to zero, and
incremented as each triangle is added, then reset to zero when the
triangulation is displayed.
int num_triangles
Array of vertex corners, whose size is fixed by MAX_TRIANGLES. For each
triangle, this array has the coordinates of the three nodes, and its R, G, B
and A color values, hence 13 PetscScalars for each triangle.
PetscScalar vertices[13*2000000]
Calculate vertices of isoquant triangle(s) in a 3-D array of right regular
hexahedra. This loops through a 3-D array and calls DrawHex to calculate the
triangulation of each hexahedral cell.
int Draw3DBlock ( int xd, int yd, int zd, int xs, int ys, int zs, int xm, int ym, int zm, PetscScalar* minmax, PetscScalar* vals, int skip, int n_quants, PetscScalar* isoquants, PetscScalar* colors )
- int Draw3DBlock
- Returns 0 or an error code.
- int xd
- Overall x-width of function value array.
- int yd
- Overall y-width of function value array.
- int zd
- Overall z-width of function value array.
- int xs
- X-index of the start of the array section we'd like to draw.
- int ys
- Y-index of the start of the array section we'd like to draw.
- int zs
- Z-index of the start of the array section we'd like to draw.
- int xm
- X-width of the array section we'd like to draw.
- int ym
- Y-width of the array section we'd like to draw.
- int zm
- Z-width of the array section we'd like to draw.
- PetscScalar* minmax
- Position of block corners: xmin, xmax, ymin, ymax, zmin, zmax.
- PetscScalar* vals
- The array of function values at vertices.
- int skip
- Number of interlaced fields in this array.
- int n_quants
- Number of isoquant surfaces to draw (isoquant values).
- PetscScalar* isoquants
- Array of function values at which to draw triangles.
- PetscScalar* colors
- Array of color R,G,B,A quads for each isoquant.
This divides a right regular hexahedron into tetrahedra, and loops over them
to generate triangles on each one. It calculates edge and whichplane
parameters so it can use DrawTetWithPlane directly.
int DrawHex ( PetscScalar* coords, PetscScalar* vals, PetscScalar isoquant, PetscScalar* color )
- int DrawHex
- Returns 0 or an error code.
- PetscScalar* coords
- Coordinates of hexahedron corner points: xmin, xmax, ymin, etc.
- PetscScalar* vals
- Function values at hexahedron corners: f0, f1, f2, etc.
- PetscScalar isoquant
- Function value at which to draw triangles.
- PetscScalar* color
- R,G,B,A quad for this hexahedron.
This sets the edge and whichplane parameters and then passes everything to
DrawTetWithPlane to actually draw the triangle. It is intended for use by
developers with distributed arrays based on tetrahedra, e.g. a finite element
mesh.
int DrawTet ( PetscScalar* coords, PetscScalar* vals, PetscScalar isoquant, PetscScalar* color )
- int DrawTet
- Returns 0 or an error code.
- PetscScalar* coords
- Coordinates of tetrahedron corner points: x0, y0, z0, x1, etc.
- PetscScalar* vals
- Function values at tetrahedron corners: f0, f1, f2, f3.
- PetscScalar isoquant
- Function value at which to draw triangle.
- PetscScalar* color
- R,G,B,A quad for this tetrahedron.
This function calculates triangle vertices for an isoquant surface in a
linear tetrahedron, using the whichplane information supplied by the routine
calling this one, and "draws" them using storetri. This is really an
internal function, not intended to be called by user programs. It is used by
DrawTet and DrawHex.
static inline int DrawTetWithPlane ( PetscScalar x0, PetscScalar y0, PetscScalar z0, PetscScalar f0, PetscScalar x1, PetscScalar y1, PetscScalar z1, PetscScalar f1, PetscScalar x2, PetscScalar y2, PetscScalar z2, PetscScalar f2, PetscScalar x3, PetscScalar y3, PetscScalar z3, PetscScalar f3, PetscScalar isoquant, PetscScalar edge0, PetscScalar edge1, PetscScalar edge3, int whichplane, PetscScalar* color )
- int DrawTetWithPlane
- Returns 0 or an error code.
- PetscScalar x0
- X-coordinate of vertex 0.
- PetscScalar y0
- Y-coordinate of vertex 0.
- PetscScalar z0
- Z-coordinate of vertex 0.
- PetscScalar f0
- Function value at vertex 0.
- PetscScalar x1
- X-coordinate of vertex 1.
- PetscScalar y1
- Y-coordinate of vertex 1.
- PetscScalar z1
- Z-coordinate of vertex 1.
- PetscScalar f1
- Function value at vertex 1.
- PetscScalar x2
- X-coordinate of vertex 2.
- PetscScalar y2
- Y-coordinate of vertex 2.
- PetscScalar z2
- Z-coordinate of vertex 2.
- PetscScalar f2
- Function value at vertex 2.
- PetscScalar x3
- X-coordinate of vertex 3.
- PetscScalar y3
- Y-coordinate of vertex 3.
- PetscScalar z3
- Z-coordinate of vertex 3.
- PetscScalar f3
- Function value at vertex 3.
- PetscScalar isoquant
- Function value at which to draw triangle.
- PetscScalar edge0
- Normalized intercept at edge 0, 0. at node 0, 1. at node 1.
- PetscScalar edge1
- Normalized intercept at edge 1, 0. at node 1, 1. at node 2.
- PetscScalar edge3
- Normalized intercept at edge 3, 0. at node 0, 1. at node 3.
- int whichplane
- Index of which edge intercept(s) is between zero and 1.
- PetscScalar* color
- R,G,B,A quad for this tetrahedron.
This little inline routine just implements triangle storage. Maybe it will
be more sophisticated in the future.
static inline int storetri ( PetscScalar x0, PetscScalar y0, PetscScalar z0, PetscScalar x1, PetscScalar y1, PetscScalar z1, PetscScalar x2, PetscScalar y2, PetscScalar z2, PetscScalar* color )
- int storetri
- Returns 0 or an error code.
- PetscScalar x0
- X-coordinate of corner 0.
- PetscScalar y0
- Y-coordinate of corner 0.
- PetscScalar z0
- Z-coordinate of corner 0.
- PetscScalar x1
- X-coordinate of corner 1.
- PetscScalar y1
- Y-coordinate of corner 1.
- PetscScalar z1
- Z-coordinate of corner 1.
- PetscScalar x2
- X-coordinate of corner 2.
- PetscScalar y2
- Y-coordinate of corner 2.
- PetscScalar z2
- Z-coordinate of corner 2.
- PetscScalar* color
- R,G,B,A quad for this triangle.