NAME
ISOSURFACE_TABLE - isosurface table class
ISOSURFACE_TABLE_POLYHEDRON - polyhedron class
ISOSURFACE_TABLE_ERROR - error message class
SYNOPSIS
#include "isotable.h"
using namespace ISOTABLE;
class ISOSURFACE_TABLE_POLYHEDRON;
class ISOSURFACE_TABLE;
class ISOSURFACE_TABLE_ERROR;
DESCRIPTION
Each isosurface lookup table is based on a convex polyhedron
in some dimension (not necessarily three.) Each table entry
corresponds to a sign pattern (+/-) on the vertices of the
polyhedron. Each table entry contains a set of simplices
forming an isosurface patch.
ISOSURFACE_TABLE_POLYHEDRON MEMBER FUNCTIONS
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.
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.
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.
bool VertexSign(const long code, const int iv) const
Return true if bit iv of code is 1. Return false oth-
erwise. Bit iv represents the sign of vertex iv in
integer code.
bool FacetVertexFlag(const FACET_INDEX jf, const int iv) const
Return true if facet jf contains vertex iv. Return
false otherwise.
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)
Set the number of polyhedron vertices and edges.
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 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 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).
void WriteVertexCoordText(ostream & out)
Write vertex coordinates in ascii text to output
stream.
void WriteEdgeListText(ostream & out)
Write edge endpoints in ascii text to output stream.
void ReadVertexCoordText(istream & in)
Read vertex coordinates in ascii text from input
stream.
void ReadEdgeListText(istream & in)
Read edge endpoints in ascii text from input stream.
bool CheckDimension() const
Check polyhedron dimension is valid.
bool Check() const
Check polyhedron specification is consistent.
ISOSURFACE_TABLE MEMBER FUNCTIONS
Included are routines for setting and getting the isosurface
polyhedron and the isosurface table entries. Each table
entry consists of a list of (d-1)-dimensional simplices.
Each simplex contains d vertices. Simplex vertices are
given, not by their coordinates, but by the polyhedron edge
containing the simplex vertex. This separates the computa-
tion of vertex coordinates from the generation of the iso-
surface simplices.
ISOSURFACE_TABLE(const int d)
Constructor. Initialize polyhedron dimension to d.
~ISOSURFACE_TABLE()
Destructor.
const ISOSURFACE_TABLE_POLYHEDRON & Polyhedron() const
Return (const) reference to isosurface table
polyhedron.
int Dimension() const
Return dimension of isosurface table polyhedron.
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 iv) const
Return index of edge containing simplex vertex iv in
simplex is in table entry it.
bool VertexSign(const long it, const int iv) const
Return sign (true = +, false = -) of vertex iv in entry
it.
int MaxNumVertices() const
Return the maximum number of vertices permitted in a
polyhedron. Note that tables for polyhedron of this
maximum size are probably impossible to compute/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.
const char * const FileHeader() const
Return the file header at the top of every isosurface
table file.
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 SetPolySize(const int numv, const int nume)
Set number of polyhedron vertices and number of
polyhedron edges to numv and nume, respectively.
coord)
void SetPolyVertexCoord(const int iv, const int ic, const int
Set coordinate ic of polyhedron vertex iv to coord.
Note that SetPolyNumVertices() or SetPolySize() must be
called before SetPolyVertexCoord().
iv1)
void SetPolyEdge(const EDGE_INDEX ie, const int iv0, const int
Set the endpoints of polyhedron edge ie to vertices iv0
and iv1. Note that SetNumPolyEdges() or SetPolySize()
must be called before SetPolyEdge().
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 ie)
Set index of edge of vertex iv of simplex is of table
entry it to ie.
void GenCube(const int d)
Generate a hypercube of dimension d. Vertices and edges
are indexed as in
ISOSURFACE_TABLE_POLYHEDRON::GenCube(). Calls AllocT-
able() to allocate the isosurface table.
void GenSimplex(const int d)
Generate a simplex of dimension d. Vertices and edges
are indexed as in
ISOSURFACE_TABLE_POLYHEDRON::GenSimplex(). Calls
AllocTable() to allocate the isosurface table.
void AllocTable()
Allocate the isosurface table. Note that the
polyhedron cannot be changed once the table has been
allocated. The table must be allocated once and only
once before storing the isosurface patches in the
table. Functions GenCube() and GenSimplex() automati-
cally allocate the isosurface table.
void WriteText(ostream & out)
Write the complete isosurface table including the
polyhedron description in ascii text to output stream
out.
void WriteFileHeaderText(ostream & out)
Write the isosurface table file header in ascii text to
output stream out.
void WriteTableText(ostream & out)
Write the isosurface table but not the polyhedron
description in ascii text to output stream out.
void ReadText(istream & in)
Read the complete isosurface table including the
polyhedron description in ascii text from input stream
in.
void ReadFileHeaderText(istream & in)
Read the isosurface table file header in ascii text
from input stream in.
void ReadTableText(istream & in)
Read the isosurface table but not the polyhedron
description in ascii text from input stream in.
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() const
Check isosurface table specification is consistent.
ISOSURFACE_TABLE_ERROR Member Functions
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(char * error_msg)
Constructor. Set error mesg to error_msg.
char * Msg() const
Return error message.
OTHER FUNCTIONS
void generate_prism
(const ISOSURFACE_TABLE_POLYHEDRON & base_polyhedron,
ISOSURFACE_TABLE_POLYHEDRON & prism)
Generate prism polyhedron over the given base
polyhedron.
NOTES
The size of the isosurface table is dependent upon the
number of vertices of the convex polyhedron. A convex
polyhedron with n vertices has 2^n sign patterns and 2^n
table entries. A hypercube in dimension 5 has 32 vertices
and its isosurface table would have a prohibitive 2^32 table
entries. On the other hand, a simplex in dimension 9 has 10
vertices and its isosurface table has a reasonable 2^10
entries.
SEE ALSO
genisotable,genisopatch,isotable(5).
AUTHOR
Praveen Bhaniramka, Rephael Wenger
Man(1) output converted with
man2html