NAME

     ISOSURFACE_TABLE - isosurface table class
     ISOSURFACE_TABLE_POLYHEDRON - polyhedron class
     ISOSURFACE_VERTEX - isosurface vertex class
     ISOSURFACE_TABLE_ERROR - error message class


SYNOPSIS

     #include "ijktable.h"
     using namespace IJKTABLE;
     class ISOSURFACE_TABLE_POLYHEDRON;
     class ISOSURFACE_VERTEX;
     class ISOSURFACE_TABLE;
     class ISOSURFACE_TABLE_ERROR;


DESCRIPTION

     Each isosurface or interval volume lookup table is based  on
     a  convex  polyhedron  in  some  dimension  (not necessarily
     three.)  Each table entry corresponds to a set of labels  (-
     /+) or (-/=/+) or (-/*/+) on the vertices of the polyhedron.
     Each table entry contains a set of simplices forming an iso-
     surface patch.


CLASS ISOSURFACE_TABLE_POLYHEDRON

     Included are routines for setting and getting the polyhedron
     vertices and edges and for creating hypercubes and simplices
     in arbitrary dimensions.  The polyhedron is defined  by  its
     vertices, edges and facets.  No other faces are used.

  CONSTRUCTORS, DESTRUCTOR, COPY
     Constructor, destructor and copy member functions for  class
     ISOSURFACE_TABLE_POLYHEDRON.

     ISOSURFACE_TABLE_POLYHEDRON(const int d)
          Constructor.  Initialize polyhedron dimension to d.

     ISOSURFACE_TABLE_POLYHEDRON
               (const ISOSURFACE_TABLE_POLYHEDRON & init)
          Constructor.  Set polyedron to init.

     ~ISOSURFACE_TABLE_POLYHEDRON()
          Destructor.

     const ISOSURFACE_TABLE_POLYHEDRON & operator =
               (const ISOSURFACE_TABLE_POLYHEDRON &)
          Copy operator.

  GET MEMBER FUNCTIONS
     Member   functions   to   get   information    from    class
     ISOSURFACE_TABLE_POLYHEDRON.

     int Dimension() const
          Return polyhedron dimension.

     int NumVertices() const
          Return number of polyhedron vertices.

     int NumEdges() const
          Return number of polyhedron edges.

     int NumFacets() const
          Return number of polyhedron facets.

     int NumFacetVertices(const FACET_INDEX jf) const
          Return number of vertices in facet jf.

     int VertexCoord(const int iv, const int ic) const
          Return coordinate ic of vertex iv.

     int EdgeEndpoint(const EDGE_INDEX ie, const int j) const
          Return vertex index of endpoint j of edge ie. The value
          of j is either 0 or 1.

     int MidpointCoord(const EDGE_INDEX ie, const int ic) const
          Return coordinate ic of the midpoint of edges ie.  Note
          that  all  vertex coordinates must be even so that mid-
          point coordinates are integers.

     FACET Facet(const FACET_INDEX jf) const
          Return an integer encoding the  vertices  contained  in
          the  facet.   The  k'th  polyhedron  vertex lies on the
          facet if the k'th bit is a 1.

     bool FacetVertexFlag(const FACET_INDEX jf, const int iv) const
          Return  true  if  facet  jf  contains vertex iv. Return
          false otherwise.

  SET MEMBER FUNCTIONS
     Member   functions   to    set    information    in    class
     ISOSURFACE_TABLE_POLYHEDRON.

     void SetDimension(const int d)
          Set the polyhedron dimension.

     void SetNumVertices(const int numv)
          Set the number of polyhedron vertices.

     void SetNumEdges(const int nume)
          Set the number of polyhedron edges.

     void SetNumFacets(const int numf)
          Set the number of polyhedron facets.

     void SetSize(const int numv, const int nume, const int numf)
          Set  the  number  of  polyhedron  vertices,  edges  and
          facets.

     void SetVertexCoord(const int iv, const int ic, const int coord)
          Set coordinate ic of vertex iv to coord. Note that ver-
          tex coodinates MUST BE even, so that edge midpoints are
          integers.  Note that SetNumVertices() or SetSize() must
          be called before SetVertexCoord().

     void SetEdge(const EDGE_INDEX ie, const int iv0, const int iv1)
          Set  the  endpoints of edge ie to vertices iv0 and iv1.
          Note that SetNumEdges() or  SetSize()  must  be  called
          before SetEdge().

     void SetFacetVertex(const FACET_INDEX jf, const int iv,
                         const bool in_facet)
          Set the bit representing whether facet jf contains ver-
          tex iv to in_facet.  If in_facet is true, then facet jf
          contains vertex  iv.  Note that SetNumFacets() or  Set-
          Size() must be called before SetFacetVertex().

  GENERATE CUBES, SIMPLICES, PYRAMIDS
     Member functions which generate all the vertices, edges  and
     facets of cubes, simplices or pyramids.

     void GenCube(const int d)
          Generate a hypercube of dimension d. Generates all ver-
          tices  and  edges of the hypercube.  Vertex coordinates
          are 0 and 2.  Vertices are indexed in increasing  lexi-
          cographical  order, i.e., (0 0 0), (2 0 0), (0 2 0), (2
          2 0), (0 0 2), etc.  Edges are  indexed  in  increasing
          lexicographical  order  by  their midpoint, i.e., first
          come edges whose midpoints have last coordinate 0, then
          edges  whose  midpoints  have  last  coordinate 1, then
          edges whose midpoints have last coordinate 2.

     void GenPyramid(const int d)
          Generate a pyramid of dimension d. Generates  all  ver-
          tices  and edges of the hypercube.  Base vertex coordi-
          nates are 0 and 4.  Apex coordinates are all  2,  i.e.,
          (2  2  2).   Base  vertices are listed first, then apex
          vertex.  Base vertices are indexed in increasing  lexi-
          cographical  order, i.e., (0 0 0), (4 0 0), (0 4 0), (4
          4 0), (0 0 4), etc.  Base edges are listed first,  then
          edges  incident on the apex.  Base edges are indexed in
          increasing lexicographical  order  by  their  midpoint,
          i.e.,  first come edges whose midpoints have last coor-
          dinate 0, then edges whose midpoints have last  coordi-
          nate 1, then edges whose midpoints have last coordinate
          2.  Apex edges are indexed in the  same  order  as  the
          base  vertices, i.e. in 3D, the order of the base edges
          is (0, 4), (1, 4), (2, 4), (3, 4), where 4 is the index
          of the apex.

     void GenSimplex(const int d)
          Generate a simplex of dimension d. Generates  all  ver-
          tices and edges of the simplex.  One vertex is the ori-
          gin, (0, 0, ..., 0).  All other  vertices  lie  on  the
          coordinate axes, i.e., (2, 0, 0).  Vertices are indexed
          in increasing lexicographical order, i.e., (0 0  0  0),
          (2  0 0 0), (0 2 0 0), (0 0 2 0), (0 0 0 2).  Edges are
          indexed in increasing lexicographical  order  by  their
          endpoint  indices, i.e., (0 1), (0 2), (0 3), (0 4), (1
          2), (1 3), (1 4), (2 3), (2 4), (3 4).

  CHECK MEMBER FUNCTIONS
     Member functions to check validity  or  consistency  of  the
     date in class ISOSURFACE_TABLE_POLYHEDRON.

     bool CheckDimension() const
          Check polyhedron dimension is valid.  Returns false  if
          polyhedron dimension is invalid.

     bool Check(ERROR & error) const
          Check polyhedron specification is consistent.   Returns
          false and an error message in class error if polyhedron
          specification is inconsistent.


CLASS ISOSURFACE_VERTEX

     Included are routines for  setting  and  getting  isosurface
     vertex type, face index and labels.

  ISOSURFACE_VERTEX_TYPE
     Definition of isosurface vertex type.

     typedef enum {VERTEX, EDGE, FACET, POINT} ISOSURFACE_VERTEX_TYPE;
          Type  of  isosurface vertex.  VERTEX represents an iso-
          surface vertex which is on a  polyhedron  vertex,  EDGE
          represents  an  isosurface vertex lying on a polyhedron
          edge, FACET represents an isosurface vertex lying on  a
          polyhedron  facet,  and  POINT represents an isosurface
          vertex lying anywhere in the polyhedron.

  CONSTRUCTOR AND DESTRUCTOR
     Constructor and destructor for class ISOSURFACE_VERTEX.

     ISOSURFACE_VERTEX()
          Constructor.

     ~ISOSURFACE_VERTEX()
          Destructor.

  GET MEMBER FUNCTIONS
     Member   functions   to   get   information    from    class
     ISOSURFACE_VERTEX.

     ISOSURFACE_VERTEX_TYPE Type() const
          Return the type of the isosurface vertex.

     int Face() const
          Return the index of the face containing the  isosurface
          vertex.   The  face  containing the vertex depends upon
          the  isosurface  vertex  type  and  this  index.    For
          instance, if the isosurface vertex type is EDGE and the
          index  is  3,  then  the  isosurface  vertex  lies   on
          polyhedron  edge  3.   If the isosurface vertex type is
          vertex and the index is 3, then the  isosurface  vertex
          lies  on  polyhedron vertex 3.  The face index is unde-
          fined if the isosurface vertex type is POINT.

     int NumCoord() const
          Return the number of coordinates (the dimension) of the
          isosurface vertex.  Defined only if the isosurface ver-
          tex type is POINT.

     COORD_TYPE Coord(const int ic) const
          Return the ic'th coordinate of the  isosurface  vertex.
          Defined only if the isosurface vertex type is POINT.

     std::string Label() const
          Return the isosurface vertex label.  This label can  be
          any string.

     bool IsLabelSet() const
          Return true if the label is set and false otherwise.

  SET MEMBER FUNCTIONS
     Member   functions   to    set    information    in    class
     ISOSURFACE_VERTEX.

     void SetType(const ISOSURFACE_VERTEX_TYPE t)
          Set the isosurface vertex type.

     void SetFace(const int index)
          Set the index of the  face  containing  the  isosurface
          vertex.

     void SetNumCoord(const int numc)
          Set the number of coordinates of the isosurface vertex.

     void SetCoord(const int ic, const COORD_TYPE c)
          Set ic'th vertex coordinate to coordinate c.

     void SetLabel(const std::string & s)
          Set the label of the isosurface vertex.


CLASS ISOSURFACE_TABLE

     Included are routines for setting and getting the isosurface
     polyhedron, the isosurface vertices and the isosurface table
     entries.  Each table entry consists  of  a  list  of  (d-1)-
     dimensional simplices.  Each simplex contains d simplex ver-
     tices.  Simplex vertices can be given by  their  coordinates
     or  by  the  polyhedron vertex, edge or facet containing the
     vertex.  This separates the computation  of  vertex  coordi-
     nates from the generation of the isosurface simplices.

  CONSTRUCTORS AND DESTRUCTOR
     Constructor, destructor and copy member functions for  class
     ISOSURFACE_TABLE.

     ISOSURFACE_TABLE(const int d)
          Constructor.  Initialize polyhedron dimension and  sim-
          plex dimension to d.

     ISOSURFACE_TABLE(const int poly_dimension,
                      const int simplex_dimension)
          Constructor.   Initialize   polyhedron   dimension   to
          poly_dimension     and     simplex     dimension     to
          simplex_dimension.  Isosurfaces have  simplex_dimension
          equal   to  poly_dimension-1.   Interval  volumes  have
          simplex_dimension equal to poly_dimension.

     ~ISOSURFACE_TABLE()
          Destructor.

  GET MEMBER FUNCTIONS
     Member   functions   to   get   information    from    class
     ISOSURFACE_TABLE.

     ENCODING Encoding() const
          Return the encoding of  the  isosurface  table.   Valid
          encodings are BINARY, BASE3 and NONSTANDARD.

     ENCODING EncodingName() const
          Return the string storing the encoding name.   Used  to
          store names of non-standard encodings.

     static std::string StandardEncodingName(const ENCODING encoding)
          Return the string with the encoding name for a standard
          encoding.  Returns string "BINARY" for encoding  BINARY
          and string "BASE3" for encoding BASE3.

     const ISOSURFACE_TABLE_POLYHEDRON & Polyhedron() const
          Return   (const)   reference   to   isosurface    table
          polyhedron.

     const ISOSURFACE_VERTEX & IsosurfaceVertex(const int i) const
          Return (const) reference to i'th isosurface vertex.

     int Dimension() const
          Return dimension of isosurface table polyhedron.

     int SimplexDimension() const
          Return dimension of isosurface table simplices.

     int NumVerticesPerSimplex() const
          Return number of vertices per simplex.  Number of  ver-
          tices per simplex equals SimplexDimension()+1.

     int NumTableEntries() const
          Return number of entries in isosurface table.

     int NumSimplices(const int it) const
          Return number of simplices in entry it.

     int SimplexVertex(const int it, const int is, const int k) const
          Return  the k'th simplex vertex in simplex Iis in table
          entry it.  Returns an index to an isosurface vertex.

     int MaxNumVertices() const
          Return the maximum number of vertices  permitted  in  a
          polyhedron.  Even tables for polyhedra of this size are
          probably impossible to compute or store.

     bool IsTableAllocated() const
          Return true if isosurface table has already been  allo-
          cated.  Note that the polyhedron cannot be changed once
          the table has been allocated.  The table must be  allo-
          cated  once and only once before storing the isosurface
          patches in the table.

  SET POLYHEDRON FUNCTIONS
     Member functions to  set  polyhedron  information  in  class
     ISOSURFACE_TABLE.

     void SetDimension(const int d)
          Set the polyhedron dimension to be d.

     void SetNumPolyVertices(const int numv)
          Set number of polyhedron vertices to numv.

     void SetNumPolyEdges(const int nume)
          Set number of polyhedron edges to nume.

     void SetNumPolyFacets(const int numf)
          Set number of polyhedron facets to numf.

     void SetPolySize(const int numv, const int nume, const int numf)
          Set  number  of polyhedron vertices to numv, set number
          of  polyhedron  edges  to  nume  and  set   number   of
          polyhedron facets to numf.

     void SetPolyVertexCoord(const int iv, const int ic,
                             const int coord)

          Set coordinate ic of polyhedron  vertex  iv  to  coord.
          Note that SetPolyNumVertices() or SetPolySize() must be
          called before SetPolyVertexCoord().

     void SetPolyEdge(const EDGE_INDEX ie, const int iv0,
                      const int iv1)
          Set the endpoints of polyhedron edge ie to vertices iv0
          and  iv1.  Note that SetNumPolyEdges() or SetPolySize()
          must be called before SetPolyEdge().

     void SetPolyFacetVertex(const int jf, const int iv,
                             const bool in_facet)
          Set the bit representing whether facet jf contains ver-
          tex iv to in_facet.  If in_facet is true, then facet jf
          contains vertex  iv.  Note that  SetNumPolyFacets()  or
          SetPolySize()  must  be  called before SetPolyFacetVer-
          tex().

     void Set(const ISOSURFACE_TABLE_POLYHEDRON & polyhedron)
          Set the isosurface table polyhedron to polyhedron.

  SET ISOSURFACE VERTEX FUNCTIONS
     Member functions to set  isosurface  vertex  information  in
     class ISOSURFACE_TABLE.

     void SetNumIsosurfaceVertices(const int num_vertices)
          Set number of isosurface vertices to num_vertices.

     void SetIsosurfaceVertexType
       (const int i,
        const ISOSURFACE_VERTEX::ISOSURFACE_VERTEX_TYPE t)
          Set isosurface vertex type of vertex i to type t.

     void SetIsoVertexFace(const int i, const int index)
          Set face index of isosurface vertex i.

     void SetIsoVertexNumCoord(const int i, const int numc)
          Set the number of coordinates of isosurface vertex i.

     void SetIsoVertexCoord
       (const int i, const int ic,
        const ISOSURFACE_VERTEX::ISOSURFACE_VERTEX_TYPE t)
          Set the coordinate ic of isosurface vertex i.

     void SetIsoVertexLabel(const int i, const std::string & s)
          Set the label of isosurface vertex i.

  SET LOOKUP TABLE FUNCTIONS
     Member functions to set lookup table  information  in  class
     ISOSURFACE_TABLE.

     void SetSimplexDimension(const int d)
          Set the simplex dimension to be d.

     void SetEncoding(const ENCODING encoding)
          Set the table encoding to be encoding.

     void SetBindaryEncoding()
          Set the table encoding to be BINARY.

     void SetBase3Encoding()
          Set the table encoding to be BASE3.

     void SetNonstandardEncoding(const & std::name)
          Set the table encoding to be NONSTANDARD and the encod-
          ing string name to be name.

     void SetNumTableEntries(const int num_table_entries)
          Set number of isosurface table entries.

     void SetNumSimplices(const int it, const int nums)
          Set number of simplices in table entry it.

     void SetSimplexVertex(const int it, const int is,
                         const int iv, const EDGE_INDEX isov)
          Set index of of vertex iv of simplex is of table  entry
          it to isosurface vertex isov.

  GENERATE POLYHEDRA
     Member functions to generate cubes, simplices or pyramids.

     void GenCube(const int d)
          Generate a hypercube of dimension d. Vertices and edges
          are         indexed        as        in        function
          ISOSURFACE_TABLE_POLYHEDRON::GenCube().

     void GenPyramid(const int d)
          Generate a pyramid of dimension d. Vertices  and  edges
          are         indexed        as        in        function
          ISOSURFACE_TABLE_POLYHEDRON::GenPyramid().

     void GenSimplex(const int d)
          Generate a simplex of dimension d. Vertices  and  edges
          are         indexed        as        in        function
          ISOSURFACE_TABLE_POLYHEDRON::GenSimplex().

  GENERATE ISOSURFACE VERTICES
     Functions to generate isosurface  vertices  from  polyhedron
     vertices,  edges  or  facets.  Function SetNumIsosurfaceVer-
     tices() must be called before any of these functions.

     void StorePolyVerticesAsIsoVertices(const int vstart)
          Store  polyhedron  vertices  as  isosurface   vertices,
          starting  at  isosurface  vertex vstart.  The number of
          isosurface vertices must be at least  vstart  plus  the
          number of polyhedron vertices.

     void StorePolyEdgesAsIsoVertices(const int vstart)
          Generate an isosurface vertex for each polyhedron edge,
          starting  at  isosurface  vertex vstart.  The number of
          isosurface vertices must be at least  vstart  plus  the
          number of polyhedron edges.

     void StorePolyVerticesAsIsoVertices(const int vstart)
          Generate  an  isosurface  vertex  for  each  polyhedron
          facet,  starting  at  isosurface  vertex  vstart.   The
          number of isosurface vertices must be at  least  vstart
          plus the number of polyhedron facets.

  CHECK MEMBER FUNCTIONS
     Member functions to check validity  or  consistency  of  the
     date in class ISOSURFACE_TABLE.

     bool CheckDimension(const int d) const
          Check dimension d is a valid polyhedron dimension.

     bool CheckDimension() const
          Check current polyhedron dimension is valid.

     bool CheckTable(ERROR & error) const
          Check isosurface  table  specification  is  consistent.
          Return false and an error message in class error if the
          table specification is inconsistent.

     bool Check(ERROR & error) const
          Check that isosurface polyhedron and  isosurface  table
          specifications  are  consistent.   Return  false and an
          error message in class error  if  an  inconsistency  is
          detected.


CLASS ISOSURFACE_TABLE_ERROR

     Functions      in      ISOSURFACE_TABLE_POLYHEDRON       and
     ISOSURFACE_TABLE       throw       the      error      class
     ISOSURFACE_TABLE_ERROR upon detecting an error.

     ISOSURFACE_TABLE_ERROR()
          Constructor.  No error message.

     ISOSURFACE_TABLE_ERROR(const char * error_msg)
     ISOSURFACE_TABLE_ERROR(const std::string & error_msg)
          Constructors.   Set  the   first   error   message   to
          error_msg.

     int NumMessage() const
          Return the number of error messages.

     std::string Message(const int i)
          Return the i'th error message.

     void AddMessage(const std::string & error_msg)
     void AddMessage(const char * error_msg)
          Add another error message.

     ~ISOSURFACE_TABLE_ERROR()
          Destructor.


OTHER FUNCTIONS

     u_long calculate_num_entries
       (const int num_vert, const int num_colors)
          Calculate the number of table entries for num_vert ver-
          tices and num_colors possible colors at each vertex.

     void convert2base
       (const u_long ival, const u_int base, int * digit,
        const u_int max_num_digits)
          Convert ival to base base number storing the i'th digit
          in digit[i].

     void generate_prism
       (const ISOSURFACE_TABLE_POLYHEDRON & base_polyhedron,
        ISOSURFACE_TABLE_POLYHEDRON & prism)
          Generate  prism  polyhedron   over   the   given   base
          polyhedron.


SEE ALSO

     ijkgentable(1), ijkgenpatch(3), xit(5).


AUTHOR

     Praveen Bhaniramka, Rephael Wenger




















Man(1) output converted with man2html