DelaunayTriangulation
A C++ Object Oriented data structure with algorithms that could be used to generate a Delaunay triangulation
|
Parent class of all objects, contains full triangulation and its constituent parts. More...
#include <Mesh.hpp>
Public Member Functions | |
Mesh () | |
Default contructor. | |
~Mesh () | |
Default destructor. | |
std::vector< Vec > | resolvePoints (std::vector< vertInd > vertInds) |
Implementation of IMesh::resolvePoints Resolves vector of vertex indices to vector of vertex pointers. More... | |
bool | isDelaunay () |
Checks whether mesh is Delauney. More... | |
std::vector< edge > | newEdges (triInd triInd, const std::vector< vertInd > &vert) |
Implementation of IMesh::newEdges Adds triangle's new edges to map. More... | |
void | removeEdges (triInd triInd, const std::vector< edge > &rEdge) |
Implementation of IMesh::removeEdges Remove triangle's old edges from map. More... | |
int | containingTriangle (double x, double y) |
Find the triangle which contains the point \((x,y)\). More... | |
std::vector< int > | adjacentTriangles (triInd triInd) |
Find all triangles that share an edge with triangle represented by triInd. More... | |
void | recalcCircum (vertInd vertInd) |
Implementation of IMesh::recalcCircum Recalculate the Triangle::circumcircle of all Triangles using vertex represented by vertInd. More... | |
void | updateVertTri (triInd triInd, std::vector< vertInd > vertInds) |
Implementation of IMesh::updateVertTri Add Triangle represented by triInd to vertTri. More... | |
void | removeVertTri (triInd triInd, std::vector< vertInd > rVertInds) |
Implementation of IMesh::removeVertTri Remove triangle index from vertTri. More... | |
template<typename T > | |
double | integrate (T func, double(*interp)(T, const Triangle &)) |
Estimate the integral of the function func over the mesh. More... | |
const std::map< int, Vertex > & | getVertices () const |
Accessor to private member vertices. More... | |
void | setVertices (const std::map< int, Vertex > &vertices) |
Mutator for private member vertices. More... | |
const std::map< int, Triangle > & | getTriangles () const |
Accessor to private member vertices. More... | |
void | setTriangles (const std::map< int, Triangle > &triangles) |
Mutator for private member triangles. More... | |
int | getVertexAttributes () const |
Accessor for private member vertexAttributes. More... | |
void | setVertexAttributes (int verAttr) |
Mutator for private member vertexAttributes. More... | |
int | getTriangleAttributes () const |
Accessor for private member triangleAttributes. More... | |
void | setTriangleAttributes (int triAttr) |
Mutator for private member triangleAttributes. More... | |
int | getDimensions () const |
Accessor for private member dimensions. More... | |
const std::map< std::pair< int, int >, std::vector< int > > & | getEdges () const |
Accessor for private member edges. More... | |
bool | operator== (const Mesh &rhs) const |
Equality operator. More... | |
bool | operator!= (const Mesh &rhs) const |
Not-equality operator. More... | |
Public Member Functions inherited from IMesh | |
virtual | ~IMesh () |
Virtual destructor. | |
Private Attributes | |
int | vertexAttributes |
Number of attributes in a vertex object. | |
int | triangleAttributes |
Number of attributes in a triangle object. | |
int | dimensions |
Number of dimensions of the mesh. | |
std::map< triInd, Triangle > | triangles |
Map of triangle indices to triangles they refer to. | |
std::map< vertInd, Vertex > | vertices |
Map of vertex indices to vertices they refer to. | |
std::map< edge, std::vector< triInd > > | edges |
Map of pairs of vertex indices (representing an edge) to a vector of triangles using them. More... | |
std::map< vertInd, std::vector< triInd > > | vertTri |
Map of a vertex index to a vector of triangles using them. More... | |
Friends | |
std::ifstream & | operator>> (std::ifstream &ifs, Mesh &mesh) |
Input filestream operator. More... | |
std::ofstream & | operator<< (std::ofstream &ofs, Mesh &mesh) |
Output filestream operator. More... | |
Additional Inherited Members | |
Public Types inherited from IMesh | |
typedef std::pair< int, int > | edge |
Type representing an edge, two vertex indices. | |
typedef int | vertInd |
Type representing an index of a vertex. | |
typedef int | triInd |
Type representing an index of a triangle. | |
Parent class of all objects, contains full triangulation and its constituent parts.
std::vector< int > Mesh::adjacentTriangles | ( | triInd | triInd | ) |
Find all triangles that share an edge with triangle represented by triInd.
triInd | Index of querying triangle |
int Mesh::containingTriangle | ( | double | x, |
double | y | ||
) |
Find the triangle which contains the point \((x,y)\).
x | |
y |
int Mesh::getDimensions | ( | ) | const |
Accessor for private member dimensions.
const std::map< Mesh::edge, std::vector< int > > & Mesh::getEdges | ( | ) | const |
Accessor for private member edges.
int Mesh::getTriangleAttributes | ( | ) | const |
Accessor for private member triangleAttributes.
const std::map< int, Triangle > & Mesh::getTriangles | ( | ) | const |
int Mesh::getVertexAttributes | ( | ) | const |
Accessor for private member vertexAttributes.
const std::map< int, Vertex > & Mesh::getVertices | ( | ) | const |
|
inline |
Estimate the integral of the function func over the mesh.
T | function with signature double (double, double) |
func | Mathematical function to be integrated |
interp | Function with signature double(T, const Triangle&) which will integrate the function over a triangle Examples are Utils::constantValueApprox and Utils::linearInterpolationApprox |
bool Mesh::isDelaunay | ( | ) |
Checks whether mesh is Delauney.
std::runtime_error | if mesh has no triangles |
|
virtual |
Implementation of IMesh::newEdges Adds triangle's new edges to map.
triInd | index of the triangle using the vertices |
vert | Vector of vertex indices being used by the triangle |
Implements IMesh.
bool Mesh::operator!= | ( | const Mesh & | rhs | ) | const |
Not-equality operator.
rhs |
bool Mesh::operator== | ( | const Mesh & | rhs | ) | const |
Equality operator.
rhs |
|
virtual |
Implementation of IMesh::recalcCircum Recalculate the Triangle::circumcircle of all Triangles using vertex represented by vertInd.
vertInd | Index of changed Vector |
Implements IMesh.
Implementation of IMesh::removeEdges Remove triangle's old edges from map.
triInd | index of triangle using the vertices |
rEdge | Vector of edges that are no longer in use by the triangle |
Implements IMesh.
Implementation of IMesh::removeVertTri Remove triangle index from vertTri.
triInd | Index of triangle to be removed |
rVertInds | Old indices used by Triangle |
Implements IMesh.
Implementation of IMesh::resolvePoints Resolves vector of vertex indices to vector of vertex pointers.
vertInds | Vector of indices of vertexes |
std::runtime_error | if index is out of range of valid vertices |
Implements IMesh.
void Mesh::setTriangleAttributes | ( | int | triAttr | ) |
Mutator for private member triangleAttributes.
triAttr | number of Triangle attributes |
void Mesh::setTriangles | ( | const std::map< int, Triangle > & | triangles | ) |
void Mesh::setVertexAttributes | ( | int | verAttr | ) |
Mutator for private member vertexAttributes.
verAttr | number of Vertex attributes |
void Mesh::setVertices | ( | const std::map< int, Vertex > & | vertices | ) |
Implementation of IMesh::updateVertTri Add Triangle represented by triInd to vertTri.
triInd | Index of triangle to be added |
vertInds | Indices of vertices used by Triangle |
Implements IMesh.
|
friend |
Output filestream operator.
ofs | |
mesh |
|
friend |
Input filestream operator.
ifs | |
mesh |
Map of pairs of vertex indices (representing an edge) to a vector of triangles using them.
Map of a vertex index to a vector of triangles using them.