col::Topology Class Reference

Zur Beschreibung von Inzidenz- und Adjazenz-Relationen. More...

Collaboration diagram for col::Topology:

Collaboration graph
[legend]
List of all members.

Creation, desctruction, assignments

 Topology ()
 Empty topology.
 Topology (const Topology &source)
void operator= (const Topology &source)
 Topology (const std::vector< TopoFace > &face)
 Create the topology relations.
 Topology (const unsigned int face_a[][Dop::NumOri], unsigned int nfaces, unsigned int face_nv[])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Face_a is a 2-dim.
 Topology (const osg::GeometryPtr geom, bool unify=true, float tolerance=NearZero)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void operator= (const std::vector< TopoFace > &face)
 Create the relations from a vector.
void createFromGeom (const osg::GeometryPtr geom, bool unify=false, float tolerance=NearZero)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is exactly like the constructor Topology(const osg::GeometryPtr geom).
void create (const unsigned int face_a[][Dop::NumOri], unsigned int nfaces, unsigned int face_nv[])
 Create the relations from arrays.
void createRelations (void)
 Create relationships.

Public Types

typedef std::vector< unsigned
int > 
FaceNeighbors
typedef FaceNeighbors::const_iterator FaceNeighborIterator
typedef std::vector< unsigned
int > 
VertexNeighbors
typedef VertexNeighbors::const_iterator VertexNeighborIterator

Public Member Functions

void setVertexEqualityEpsilon (OSG::Real32 epsilon)
void setVertexEqualityTest (bool status)
Access
unsigned int v_neighbors (unsigned int v_index) const
 Return the number of neighbors a vertex has (i.e,, its degree).
unsigned int v_degree (unsigned int v_index) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
unsigned int v2f_size (unsigned int v_index) const
 Return the number of faces a vertex is incident to.
unsigned int f_size (unsigned int f_index_in) const
 Return the number of vertices a face has.
const unsigned int * f_index (unsigned int f_index_in) const
 Return the table of vertex indices for a given face.
const std::vector< TopoFace > & getFaceVector (void) const
 Return the original face vector used to construct the topology.
Topology::VertexNeighborIterator vertexNeighborBegin (unsigned int v_index) const
 Get begin of vertex neighbors.
Topology::VertexNeighborIterator vertexNeighborEnd (unsigned int v_index) const
 Get end of vertex neighbors.
Topology::FaceNeighborIterator faceNeighborBegin (unsigned int f_index) const
 Get begin of face neighbors.
Topology::FaceNeighborIterator faceNeighborEnd (unsigned int f_index) const
 Get end of face neighbors.
void print (void) const
 Print the topology (for debugging purposes).

Protected Attributes

std::vector< std::vector<
unsigned int > > 
m_v2f
 vertex to face incidence relation; see createNeighbors(); v2f[i][j] is an index of a face that contains vertex i .
std::vector< VertexNeighbors > m_v2v
 vertex to vertex adjacency relation; see createNeighbors(); v2v[i][j] is an index of a vertex that is adjacent to i .
std::vector< FaceNeighbors > m_f2f
 vertex to vertex adjacency relation; see createNeighbors(); f2f[i][j] is an index of a face that is adjacent to i .
std::vector< TopoFacem_f2v
 face to vertex incidence relation (the array of faces)
std::vector< unsigned int > m_vEquivClass
 Equity relation of vertex indices.

Detailed Description

Zur Beschreibung von Inzidenz- und Adjazenz-Relationen.

Alle Relationen verwenden Indices, keine Pointer. Die zugehoerige Geometrie wird (z.Z.) nicht in einem Topology-Objekt mit gespeichert.

See also:
Classes ConvexHull, TopoFace.
Todo:
Implementation:
Implementierungsdetails, etc.
Author:
Gabriel Zachmann


Constructor & Destructor Documentation

col::Topology::Topology (  ) 

Empty topology.

You assign a sensible value from a vector<TopoFace> later with the = operator.

col::Topology::Topology ( const std::vector< TopoFace > &  face  ) 

Create the topology relations.

Parameters:
face an array of faces
Each TopoFace of the face array consists of a number of indices; each of these indices is an index into some vertex array. So, vertices are just identified by the index. The topology object doesn't need to know the actual vertex array.

Exceptions:
XColBug siehe createRelations
Warning:
The vertex and the face vectors must not change after the Topology has been constructed!
Precondition:
The largest index in face determines the number of vertices.

col::Topology::Topology ( const unsigned int  face_a[][Dop::NumOri],
unsigned int  nfaces,
unsigned int  face_nv[] 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Face_a is a 2-dim.

array of indices into some vertex array. nfaces is the number of rows in face_a; face_nv[i] is the number of elements in face[i] (which must be < Dop::NumOri!).

Exceptions:
XCollision If some face_nv[i] > Dop::NumOri.

col::Topology::Topology ( const osg::GeometryPtr  geom,
bool  unify = true,
float  tolerance = NearZero 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
unify If true (default), then vertices will be unified first
tolerance Threshold for the unification
If the geometry contains GL_POLYGON's, this might cause performance issues, because later, when you walk around a vertex, you need many steps just to "step over" a single polygon. (The constructor will print a warning in this case.)

If unify is set, then vertices will first be unified (according to some tolerance), before the topology relations are generated. The geometry geom will not be altered.

If the same vertices (= same coordinates) occur with different indices in geom's faces, and if unify is set to false, then they will still not be treated as the same vertex, i.e., a walk around such a vertex will not find all incident faces!


Member Function Documentation

void col::Topology::operator= ( const std::vector< TopoFace > &  face  ) 

Create the relations from a vector.

Exactly like the constructor Topology( const std::vector<TopoFace> &face ).

void col::Topology::createFromGeom ( const osg::GeometryPtr  geom,
bool  unify = false,
float  tolerance = NearZero 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is exactly like the constructor Topology(const osg::GeometryPtr geom).

Bug:
Es kommen immer 0 faces raus! hat FaceIterator einen Bug?!
See also:
setUnifyTolerance, setUnify

void col::Topology::create ( const unsigned int  face_a[][Dop::NumOri],
unsigned int  nfaces,
unsigned int  face_nv[] 
)

Create the relations from arrays.

Exactly like the constructor Topology( face_a[][Dop::NumOri], ... )

unsigned int col::Topology::v_neighbors ( unsigned int  m_v_index  )  const

Return the number of neighbors a vertex has (i.e,, its degree).

Parameters:
m_v_index the index number of a vertex
Returns:
the number of neighbors a vertex has (i.e,, its degree)
Warning:
m_v_index must be less than the number of vertices!

unsigned int col::Topology::v2f_size ( unsigned int  m_v_index  )  const

Return the number of faces a vertex is incident to.

Parameters:
m_v_index the index number of a vertex
Returns:
the number of faces a vertex is incident to.
Warning:
m_v_index must be less than the number of vertices!

unsigned int col::Topology::f_size ( unsigned int  f_index_in  )  const

Return the number of vertices a face has.

Parameters:
f_index_in the index number of a face
Warning:
f_index must be less than the number of faces!

const unsigned int * col::Topology::f_index ( unsigned int  f_index_in  )  const

Return the table of vertex indices for a given face.

Parameters:
f_index_in the index number of a face
Returns:
the table of vertex indices for a given face
Warning:
f_index_in must be less than the number of faces!

Topology::VertexNeighborIterator col::Topology::vertexNeighborBegin ( unsigned int  m_v_index  )  const

Get begin of vertex neighbors.

Warning:
For performance reasons, we don't check whether or not m_v_index is in bounds!

Topology::VertexNeighborIterator col::Topology::vertexNeighborEnd ( unsigned int  m_v_index  )  const

Get end of vertex neighbors.

Warning:
The end iterator points behind the last neighbor! For performance reasons, we don't check whether or not f_index is in bounds!

Topology::FaceNeighborIterator col::Topology::faceNeighborBegin ( unsigned int  inf_index  )  const

Get begin of face neighbors.

Warning:
For performance reasons, we don't check whether or not f_index is in bounds!

Topology::FaceNeighborIterator col::Topology::faceNeighborEnd ( unsigned int  inf_index  )  const

Get end of face neighbors.

Warning:
The end iterator points behind the last neighbor! For performance reasons, we don't check whether or not f_index is in bounds!

void col::Topology::createRelations ( void   )  [protected]

Create relationships.

This is meant to be called from the constructor

Exceptions:
XColBug If there is a bug in the vertex or face vectors. And if there is some inconsistency in the topology constructed.
Precondition:
  • Instance variable face is valid.
  • The vertex indices in each face[i] are sorted.
Todo:
Calc sizes of vectors first, so that we can do a resize() for each vector before filling it, in order to reduce memory fragmentation.


Member Data Documentation

std::vector<unsigned int> col::Topology::m_vEquivClass [protected]

Equity relation of vertex indices.

vEequality[i] is a vertex index that should be treated equal to vertex i . If this vector is empty, then vertices have not been unified.


The documentation for this class was generated from the following files:
Generated on Tue Oct 16 18:13:09 2007 for CollDet by  doxygen 1.5.2