mds::seg::CDelaunayTri Class Reference

#include <mdsDelaunayTri.h>

Inheritance diagram for mds::seg::CDelaunayTri:

Inheritance graph
[legend]
List of all members.

Detailed Description

If this macro is defined, various informations are logged.

Class providing Delaunay triangulation.


Public Types

enum  {
  XMIN_BOUNDARY = 16, YMIN_BOUNDARY = 32, XMAX_BOUNDARY = 64, YMAX_BOUNDARY = 128,
  BOUNDARY_FLAGS = XMIN_BOUNDARY | YMIN_BOUNDARY | XMAX_BOUNDARY | YMAX_BOUNDARY
}
 Flag used to mark boundary vertices. More...
typedef mds::base::CSharedPtr<
CDelaunayTri
tSmartPtr
 Smart pointer type.
typedef void(* tTriangleFunc )(vctl::MCTri *pTriangle, CDelaunayTri *pMesh)
 Triangle processing function.

Public Member Functions

bool addVertex (vctl::MCVertex *pVertex, int bBoundaryVertex=0, tTriangleFunc InsertFunc=NULL, tTriangleFunc RemoveFunc=NULL)
 Inserts a new vertex to the current triangulation satisfying the Delaunay criterion.
 CDelaunayTri ()
 Default constructor.
void clear ()
 Removes all triangles and vertices.
bool construct ()
 Constructs Delaunay triangulation from all vertices which are currently registered in the container of vertices.
template<class S>
void deserialize (mds::mod::CChannelSerializer< S > &Reader)
 Deserializes the triangular mesh.
vctl::MCTri * getFirstTriangle ()
 Returns pointer to the first triangle
  • Returns NULL if there is no triangle in the list.

vctl::MCVertex * getFirstVertex ()
 Returns pointer to the first vertex
  • Returns NULL if there is no vertex in the list.

bool getMaxCoordinates (double &dX, double &dY)
 Estimates maximal vertex coordinates.
bool getMinCoordinates (double &dX, double &dY)
 Estimates minimal vertex coordinates in the mesh.
int getNumOfTriangles ()
 Returns the number of all triangles.
int getNumOfVertices ()
 Returns the number of vertices.
vctl::MCTriS * getTriangles ()
 Returns pointer to the vertices container.
vctl::MCVerticeS * getVertices ()
 Returns pointer to the vertices container.
bool init (vctl::MCPoint3D *pMin, vctl::MCPoint3D *pMax, mds::tSize NumOfNodes=DEFAULT_NUMBER_OF_NODES, double dMinEdgeLength=DEFAULT_MIN_EDGE_LENGTH)
 Initializes the Delaunay triangulation
  • Vertices pMin and pMax are points defining the minimal and maximal vertex coordinates.

 MDS_ENTITY_BLOCK_SIZE (4096)
 Standard method getEntityBlockSize().
 MDS_ENTITY_COMPRESSION (mds::mod::CC_RAW)
 Standard method getEntityCompression().
 MDS_ENTITY_NAME ("DelaunayTri")
 Standard method getEntityName().
vctl::MCVertex * newVertex (vctl::MCPoint3D *pPoint)
vctl::MCVertex * newVertex (double x, double y)
 Returns pointer to a newly created vertex.
bool normalize (double dMinQuality, double dMinEdgeLength)
 Normalizes the triangular mesh
  • Minimal required triangle quality, the best value (= equilateral triangle) is equal to one.

vctl::MCVertex * randomVertex (double x, double y, double dMax=MAX_MOVEMENT)
 Generates randomly moved vertex.
vctl::MCVertex * randomVertex (vctl::MCPoint3D *pPoint, double dMax=MAX_MOVEMENT)
 Generates randomly moved vertex.
template<class S>
void serialize (mds::mod::CChannelSerializer< S > &Writer)
 Serializes the triangular mesh.
virtual ~CDelaunayTri ()
 Virtual destructor.

Static Public Attributes

static const double DEFAULT_MIN_EDGE_LENGTH = 1.0
 Minimal length of a triangle edge in the mesh.
static const tSize DEFAULT_NUMBER_OF_NODES = 7
 Default methods parameters.
static const double MAX_MOVEMENT = 0.5
 Maximal allowed random permutation of vertex coordinates.

Protected Types

typedef std::vector< vctl::MCTri * > tTriangles
 Vector of pointers to triangles.
typedef std::vector< vctl::MCVertex * > tVertices
 Vector of pointers to vertices.

Protected Member Functions

vctl::MCTri * addTriangle (vctl::MCVertex *pV0, vctl::MCVertex *pV1, vctl::MCVertex *pV2)
 Creates a new triangle
  • It is garanteed that normal of the triangle is coincident with the z-axis (0,0,1).

int checkBoundary (vctl::MCPoint3D *pPoint)
 Checks if a given vertex lies on the mesh boundary.
bool checkFlatness (vctl::MCVertex *pV0, vctl::MCVertex *pV1, vctl::MCVertex *pV2)
 Checks if given vertices lie on a line.
void clearFlags (const tTriangles &Triangles)
 Clears entity flags of given triangles.
void clearFlags ()
 Clears entity flags of all triangles.
vctl::MCTri * findBaseTriangle (vctl::MCPoint3D *pPoint)
 Uses a simple recursive tunneling algorithm to find out triangle in which a given point lies
  • Returns NULL on failure.

bool findCavity (vctl::MCPoint3D *pPoint, tTriangles &Cavity)
 Finds cavity of a given point
  • Cavity means all triangles whose circumcircle contains the point
  • Note: It uses entity flag vctl::ENTITY_MARK_FLAG to stop recursion.

bool findCavityEnvelope (const tTriangles &Cavity, tVertices &Envelope)
 Finds edges covering a given cavity
  • Note: It uses entity flag vctl::ENTITY_MARK_FLAG to recognize triangles in the cavity.

void removeTriangle (vctl::MCTri *pTriangle, bool bEraseVertices=false)
 Removes a given existing triangle.

Protected Attributes

double m_dMaxX
 Maximal vertex coordinates in the mesh.
double m_dMaxY
double m_dMinX
 Minimal vertex coordinates in the mesh.
double m_dMinY
vctl::MCVerticeS * m_pVertices
 Pointer to the container of vertices which is stored in the triangular mesh.
mds::math::CUniformPRNG m_Random
 Random number generator.
vctl::MCTriS m_Triangles
 Container of all triangles in the mesh.

Friends

class mds::base::CSharedPtr< CDelaunayTri >


Member Typedef Documentation

typedef mds::base::CSharedPtr< CDelaunayTri > mds::seg::CDelaunayTri::tSmartPtr
 

Smart pointer type.

  • Declares type tSmartPtr.

Reimplemented in mds::seg::CTriMesh.

typedef void(* mds::seg::CDelaunayTri::tTriangleFunc)(vctl::MCTri *pTriangle, CDelaunayTri *pMesh)
 

Triangle processing function.

typedef std::vector<vctl::MCTri *> mds::seg::CDelaunayTri::tTriangles [protected]
 

Vector of pointers to triangles.

typedef std::vector<vctl::MCVertex *> mds::seg::CDelaunayTri::tVertices [protected]
 

Vector of pointers to vertices.


Member Enumeration Documentation

anonymous enum
 

Flag used to mark boundary vertices.

Enumerator:
XMIN_BOUNDARY 
YMIN_BOUNDARY 
XMAX_BOUNDARY 
YMAX_BOUNDARY 
BOUNDARY_FLAGS 


Constructor & Destructor Documentation

mds::seg::CDelaunayTri::CDelaunayTri  ) 
 

Default constructor.

virtual mds::seg::CDelaunayTri::~CDelaunayTri  )  [inline, virtual]
 

Virtual destructor.


Member Function Documentation

vctl::MCTri * mds::seg::CDelaunayTri::addTriangle vctl::MCVertex *  pV0,
vctl::MCVertex *  pV1,
vctl::MCVertex *  pV2
[protected]
 

Creates a new triangle

  • It is garanteed that normal of the triangle is coincident with the z-axis (0,0,1).

  • Returns pointer to the newly created triangle

bool mds::seg::CDelaunayTri::addVertex vctl::MCVertex *  pVertex,
int  bBoundaryVertex = 0,
tTriangleFunc  InsertFunc = NULL,
tTriangleFunc  RemoveFunc = NULL
 

Inserts a new vertex to the current triangulation satisfying the Delaunay criterion.

  • Functions called for each removed and newly inserted triangle can be specified.

int mds::seg::CDelaunayTri::checkBoundary vctl::MCPoint3D *  pPoint  )  [protected]
 

Checks if a given vertex lies on the mesh boundary.

  • Normalizes vertex coordinates.
  • Returns appropriate boundary flag.

bool mds::seg::CDelaunayTri::checkFlatness vctl::MCVertex *  pV0,
vctl::MCVertex *  pV1,
vctl::MCVertex *  pV2
[protected]
 

Checks if given vertices lie on a line.

void mds::seg::CDelaunayTri::clear  ) 
 

Removes all triangles and vertices.

void mds::seg::CDelaunayTri::clearFlags const tTriangles Triangles  )  [protected]
 

Clears entity flags of given triangles.

void mds::seg::CDelaunayTri::clearFlags  )  [protected]
 

Clears entity flags of all triangles.

bool mds::seg::CDelaunayTri::construct  ) 
 

Constructs Delaunay triangulation from all vertices which are currently registered in the container of vertices.

  • Container of candidate vertices should be initiliazed first. Value of every vertex represents its significance later used for sorting vertices in decreasing order.
  • Incremental method is used.

template<class S>
void mds::seg::CDelaunayTri::deserialize mds::mod::CChannelSerializer< S > &  Reader  )  [inline]
 

Deserializes the triangular mesh.

Reimplemented in mds::seg::CTriMesh.

vctl::MCTri * mds::seg::CDelaunayTri::findBaseTriangle vctl::MCPoint3D *  pPoint  )  [protected]
 

Uses a simple recursive tunneling algorithm to find out triangle in which a given point lies

  • Returns NULL on failure.

bool mds::seg::CDelaunayTri::findCavity vctl::MCPoint3D *  pPoint,
tTriangles Cavity
[protected]
 

Finds cavity of a given point

  • Cavity means all triangles whose circumcircle contains the point
  • Note: It uses entity flag vctl::ENTITY_MARK_FLAG to stop recursion.

This flag is not cleared after the cavity is found.

  • Returns false if there is no such triangle

bool mds::seg::CDelaunayTri::findCavityEnvelope const tTriangles Cavity,
tVertices Envelope
[protected]
 

Finds edges covering a given cavity

  • Note: It uses entity flag vctl::ENTITY_MARK_FLAG to recognize triangles in the cavity.

This flag is cleared after the envelope is found.

  • Returns false on failure

vctl::MCTri* mds::seg::CDelaunayTri::getFirstTriangle  )  [inline]
 

Returns pointer to the first triangle

  • Returns NULL if there is no triangle in the list.

vctl::MCVertex* mds::seg::CDelaunayTri::getFirstVertex  )  [inline]
 

Returns pointer to the first vertex

  • Returns NULL if there is no vertex in the list.

bool mds::seg::CDelaunayTri::getMaxCoordinates double &  dX,
double &  dY
 

Estimates maximal vertex coordinates.

bool mds::seg::CDelaunayTri::getMinCoordinates double &  dX,
double &  dY
 

Estimates minimal vertex coordinates in the mesh.

int mds::seg::CDelaunayTri::getNumOfTriangles  )  [inline]
 

Returns the number of all triangles.

int mds::seg::CDelaunayTri::getNumOfVertices  )  [inline]
 

Returns the number of vertices.

vctl::MCTriS* mds::seg::CDelaunayTri::getTriangles  )  [inline]
 

Returns pointer to the vertices container.

vctl::MCVerticeS* mds::seg::CDelaunayTri::getVertices  )  [inline]
 

Returns pointer to the vertices container.

bool mds::seg::CDelaunayTri::init vctl::MCPoint3D *  pMin,
vctl::MCPoint3D *  pMax,
mds::tSize  NumOfNodes = DEFAULT_NUMBER_OF_NODES,
double  dMinEdgeLength = DEFAULT_MIN_EDGE_LENGTH
 

Initializes the Delaunay triangulation

  • Vertices pMin and pMax are points defining the minimal and maximal vertex coordinates.

  • Removes all triangles and vertices

mds::seg::CDelaunayTri::MDS_ENTITY_BLOCK_SIZE 4096   ) 
 

Standard method getEntityBlockSize().

Reimplemented in mds::seg::CTriMesh.

mds::seg::CDelaunayTri::MDS_ENTITY_COMPRESSION mds::mod::CC_RAW   ) 
 

Standard method getEntityCompression().

Reimplemented in mds::seg::CTriMesh.

mds::seg::CDelaunayTri::MDS_ENTITY_NAME "DelaunayTri"   ) 
 

Standard method getEntityName().

vctl::MCVertex* mds::seg::CDelaunayTri::newVertex vctl::MCPoint3D *  pPoint  )  [inline]
 

vctl::MCVertex* mds::seg::CDelaunayTri::newVertex double  x,
double  y
[inline]
 

Returns pointer to a newly created vertex.

bool mds::seg::CDelaunayTri::normalize double  dMinQuality,
double  dMinEdgeLength
 

Normalizes the triangular mesh

  • Minimal required triangle quality, the best value (= equilateral triangle) is equal to one.

  • If the longest triangle edge is shorter then a given value, the triangle is not optimized.

vctl::MCVertex * mds::seg::CDelaunayTri::randomVertex double  x,
double  y,
double  dMax = MAX_MOVEMENT
 

Generates randomly moved vertex.

vctl::MCVertex* mds::seg::CDelaunayTri::randomVertex vctl::MCPoint3D *  pPoint,
double  dMax = MAX_MOVEMENT
[inline]
 

Generates randomly moved vertex.

void mds::seg::CDelaunayTri::removeTriangle vctl::MCTri *  pTriangle,
bool  bEraseVertices = false
[protected]
 

Removes a given existing triangle.

template<class S>
void mds::seg::CDelaunayTri::serialize mds::mod::CChannelSerializer< S > &  Writer  )  [inline]
 

Serializes the triangular mesh.

Reimplemented in mds::seg::CTriMesh.


Friends And Related Function Documentation

friend class mds::base::CSharedPtr< CDelaunayTri > [friend]
 


Member Data Documentation

const double mds::seg::CDelaunayTri::DEFAULT_MIN_EDGE_LENGTH = 1.0 [static]
 

Minimal length of a triangle edge in the mesh.

const tSize mds::seg::CDelaunayTri::DEFAULT_NUMBER_OF_NODES = 7 [static]
 

Default methods parameters.

double mds::seg::CDelaunayTri::m_dMaxX [protected]
 

Maximal vertex coordinates in the mesh.

double mds::seg::CDelaunayTri::m_dMaxY [protected]
 

double mds::seg::CDelaunayTri::m_dMinX [protected]
 

Minimal vertex coordinates in the mesh.

double mds::seg::CDelaunayTri::m_dMinY [protected]
 

vctl::MCVerticeS* mds::seg::CDelaunayTri::m_pVertices [protected]
 

Pointer to the container of vertices which is stored in the triangular mesh.

mds::math::CUniformPRNG mds::seg::CDelaunayTri::m_Random [protected]
 

Random number generator.

vctl::MCTriS mds::seg::CDelaunayTri::m_Triangles [protected]
 

Container of all triangles in the mesh.

const double mds::seg::CDelaunayTri::MAX_MOVEMENT = 0.5 [static]
 

Maximal allowed random permutation of vertex coordinates.


The documentation for this class was generated from the following files:
Generated on Thu Mar 11 10:35:59 2010 for MDSTk Extension Libraries by  doxygen 1.4.6-NO