TopoMesh
Topological mesh, triangulations and operations
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
Mesh Class Reference

Public Types

typedef Mesh Self
 
typedef QVector< int > g_Face
 Geometry face.
 
typedef QVector< int > t_Face
 Topology face.
 
typedef QVector< int > g_Edge
 Edge, index pair of vertex.
 

Public Member Functions

FaceIterator fbegin ()
 Begin of faces iterator.
 
FaceIterator fend ()
 End of faces iterator.
 
VertexCirculator vcbegin (int v)
 Begin of vertex circulator.
 
VertexCirculator vcend (int v)
 End of vertex circulator.
 
ConvexHullCirculator chbegin ()
 Begin of convex hull circulator.
 
ConvexHullCirculator chend ()
 End of convex hull circulator.
 
 Mesh ()
 Mesh initializer.
 
void clear ()
 Realease Mesh.
 
void load_off (const QString &filename)
 Load OFF formatted file. More...
 
bool load_tri (const QString &filename)
 Loads a 2D cloud of points. File only contains vertex coordonates. More...
 
bool load_ctri (const QString &filename)
 Loads a 2D cloud of points. File contains vertex coordonates and constrained edges (pair of vertex index). More...
 
void save_off (const QString &name)
 Write triangulation into an OFF formatted file. More...
 
void draw ()
 Draw result. OpenGL drawing.
 
void show ()
 Print triangulation info on standard output.
 
void swapDisplayCrust ()
 Swap Crust display, draw border or triangulation with Voronoï centers.
 
void swapDisplayCircles ()
 Swap circumscribed circles display, draw circles or not.
 
void swapAddVertexMode ()
 Swap interactive vertex adding mode.
 
bool getAddVertexMode ()
 Get interactive vertex adding mode state.
 
bool contains (int triangle, const QVector3D &point)
 Check if a vertex is in a triangle of the triangulation. More...
 
bool contains (int triangle, int point)
 Check if a vertex is in a triangle of the triangulation. More...
 
QVector< FaceIteratorgetFacesContainingPoint (int ind)
 Get a vector of faces containing point. More...
 
int add_voronoi_centers ()
 Add Voronoi center of each face to triangulation. More...
 
g_Point center_of_gravity (const g_Point &a, const g_Point &b, const g_Point &c)
 Calculate the center of gravity of a triangle. More...
 
g_Point center_of_gravity (const g_Face &f)
 Calculate the center of gravity of a triangle. More...
 
g_Point center_of_circumscribed_circle (const g_Face &f, float &r)
 Calculate the center of circumscribed circle of a triangle. More...
 
g_Point center_of_circumscribed_circle (const g_Face &f)
 Calculate the center of circumscribed circle of a triangle. More...
 
g_Point center_of_circumscribed_circle (const g_Point &a, const g_Point &b, const g_Point &c, float &r)
 Calculate the center of circumscribed circle of a triangle. More...
 
g_Point center_of_circumscribed_circle (const g_Point &a, const g_Point &b, const g_Point &c)
 Calculate the center of circumscribed circle of a triangle. More...
 
float radius_of_circumscribed_circle (const g_Face &f)
 Calculate the radius of circumscribed circle of a triangle. More...
 
void make_topology ()
 Initialize topology from vertices and faces.
 
g_Edge getCommonEdge (const FaceIterator &f1, const FaceIterator &f2)
 Get common edge between 2 linked faces. More...
 
bool need_flip (const FaceIterator &f1, const FaceIterator &f2)
 Check if 2 faces need flip. More...
 
void flip (const FaceIterator &f1, const FaceIterator &f2)
 Performs a Lawson flip between 2 faces. More...
 
int the_walking_face (const QVector3D &v)
 Find the face containing a vertex by walking following line. More...
 
bool isInfiniteFace (const int &i)
 Check if a face is infinite. More...
 
bool isInfiniteFace (const g_Face &f)
 Check if a face is infinite. More...
 
QVector< int > getNeighborVertices (const FaceIterator &f)
 Return for a face, the 3 vertex of her neighbors which are not included in current face. More...
 
void Crust ()
 Performs Crust algorithm to get border of 2D cloud of points.
 
void Lawson ()
 Turn a triangulation into Delaunay's.
 
void triangulation_naive ()
 Create a naive triangulation of 2D cloud of points.
 
void add_vertex_naive (const g_Point &v)
 Add a vertex to triangulation. More...
 
void add_vertex_naive (const int &ind_vertex)
 Add a vertex to triangulation. More...
 
void add_point_in_face_naive (const int &v, const int &f)
 Add a point in a triangle which already is in triangulation. More...
 
void triangulation_delaunay ()
 Create an incremental Delaunay triangulation.
 
void add_vertex_inc (const g_Point &v)
 Add a vertex into triangulation, keeping the triangulation as Delaunay. More...
 
void add_vertex_inc (const int &ind_vertex)
 Add a vertex into triangulation, keeping the triangulation as Delaunay. More...
 
void add_point_in_face_inc (const int &v, const int &f)
 Add a point in a triangle which already is in triangulation, keeping the triangulation as Delaunay. More...
 
void full_flip (const QVector< QVector< FaceIterator >> &to_flip)
 Perform flips on an edge vector, keeping the triangulation as Delaunay. More...
 
void setConstrainedTriangulation ()
 Used after a Delaunay triangulation, set constrained edges in triangulation if needed.
 
void refine ()
 
void Ruppert ()
 Application of the algorithm written in slides.
 
void splitSeg (const g_Edge &edge)
 Split a constrained edge by adding its center to triangulation. More...
 
bool isConstrainedEdge (const g_Edge &e)
 Check if an edge is constrained. More...
 
bool isConstrainedEdge (const FaceIterator &f1, const FaceIterator &f2)
 Check if a common edge between two faces is constrained. More...
 
void removeConstrainedEdge (const g_Edge &e)
 Remove a constrained egde from triangulation. More...
 
bool isWellFormed (const g_Face &f, const float &angle=20)
 Check is a triangle has a "good form". More...
 
QVector< g_PointgetVertices ()
 Get list of vertices.
 
QVector< g_FacegetFaces ()
 Get list of faces.
 

Protected Attributes

QVector< g_Pointvertices
 List of vertices.
 
QVector< g_Facefaces
 List of faces, vertex index triplet.
 
QVector< t_Facetopology
 Topology of each face, topology[ii][jj] define the neighbor of face ii which is in front of vertex jj.
 
QVector< g_Pointvoronoi_center
 List of Voronoï centers added, used for display.
 
QVector< QVector< int > > crust_lines
 List of Crust edges, used for display.
 
QVector< QVector< int > > crust_border
 List of Crust edges sorted without doublons, used for display.
 
QVector< QVector< int > > constrained_edges
 List of constrained edges, used for display.
 
bool b_crusted
 Display of Crust border.
 
bool b_circles
 Display of circumscribed circles.
 
bool b_constrained
 Display of constrained egdes.
 
bool b_add_vertex_mode
 Interactive vertex adding.
 

Friends

class FaceIterator
 Class FaceIterator.
 
class VertexCirculator
 Class VertexCirculator.
 
class ConvexHullCirculator
 Class ConvexHullCirculator.
 

Member Function Documentation

§ add_point_in_face_inc()

void Mesh::add_point_in_face_inc ( const int &  v,
const int &  f 
)

Add a point in a triangle which already is in triangulation, keeping the triangulation as Delaunay.

Parameters
vvertex to add
fface to add in

§ add_point_in_face_naive()

void Mesh::add_point_in_face_naive ( const int &  v,
const int &  f 
)

Add a point in a triangle which already is in triangulation.

Parameters
vvertex to add
fface to add in

§ add_vertex_inc() [1/2]

void Mesh::add_vertex_inc ( const g_Point v)

Add a vertex into triangulation, keeping the triangulation as Delaunay.

Parameters
vvertex to add

§ add_vertex_inc() [2/2]

void Mesh::add_vertex_inc ( const int &  ind_vertex)

Add a vertex into triangulation, keeping the triangulation as Delaunay.

Parameters
ind_vertexindex of vertex to add

§ add_vertex_naive() [1/2]

void Mesh::add_vertex_naive ( const g_Point v)

Add a vertex to triangulation.

Parameters
vvertex to add

§ add_vertex_naive() [2/2]

void Mesh::add_vertex_naive ( const int &  ind_vertex)

Add a vertex to triangulation.

Parameters
ind_vertexindex of vertex to add

§ add_voronoi_centers()

int Mesh::add_voronoi_centers ( )

Add Voronoi center of each face to triangulation.

Returns
number of points before adding Voronoi centers

§ center_of_circumscribed_circle() [1/4]

g_Point Mesh::center_of_circumscribed_circle ( const g_Face f,
float &  r 
)

Calculate the center of circumscribed circle of a triangle.

Parameters
ftriangle to perform
rin/out parameter, ray of circle
Returns
Vertex representing center of circumscribed circle

§ center_of_circumscribed_circle() [2/4]

g_Point Mesh::center_of_circumscribed_circle ( const g_Face f)

Calculate the center of circumscribed circle of a triangle.

Parameters
ftriangle to perform
Returns
Vertex representing center of circumscribed circle

§ center_of_circumscribed_circle() [3/4]

g_Point Mesh::center_of_circumscribed_circle ( const g_Point a,
const g_Point b,
const g_Point c,
float &  r 
)

Calculate the center of circumscribed circle of a triangle.

Parameters
aFirst point of a triangle
bFirst point of a triangle
cFirst point of a triangle
rin/out parameter, ray of circle
Returns
Vertex representing center of circumscribed circle

§ center_of_circumscribed_circle() [4/4]

g_Point Mesh::center_of_circumscribed_circle ( const g_Point a,
const g_Point b,
const g_Point c 
)

Calculate the center of circumscribed circle of a triangle.

Parameters
afirst point of triangle
bsecond point of triangle
cthird point of triangle
Returns
Vertex representing center of circumscribed circle

§ center_of_gravity() [1/2]

g_Point Mesh::center_of_gravity ( const g_Point a,
const g_Point b,
const g_Point c 
)

Calculate the center of gravity of a triangle.

Parameters
aFirst point of a triangle
bFirst point of a triangle
cFirst point of a triangle
Returns
Vertex representing center of gravity

§ center_of_gravity() [2/2]

g_Point Mesh::center_of_gravity ( const g_Face f)

Calculate the center of gravity of a triangle.

Parameters
fFace to check
Returns
Vertex representing center of gravity

§ contains() [1/2]

bool Mesh::contains ( int  triangle,
const QVector3D &  point 
)

Check if a vertex is in a triangle of the triangulation.

Parameters
triangleface to check
vertexvertex to check
Returns
true if vertex in is triangle

§ contains() [2/2]

bool Mesh::contains ( int  triangle,
int  point 
)

Check if a vertex is in a triangle of the triangulation.

Parameters
triangleface to check
pointindex of vertex to check
Returns
true if vertex of index point in is triangle

§ flip()

void Mesh::flip ( const FaceIterator f1,
const FaceIterator f2 
)

Performs a Lawson flip between 2 faces.

Parameters
f1
f2

§ full_flip()

void Mesh::full_flip ( const QVector< QVector< FaceIterator >> &  to_flip)

Perform flips on an edge vector, keeping the triangulation as Delaunay.

Parameters
to_flipvector of edges to flip

§ getCommonEdge()

Mesh::g_Edge Mesh::getCommonEdge ( const FaceIterator f1,
const FaceIterator f2 
)

Get common edge between 2 linked faces.

Parameters
f1first face
f2second face
Returns
pair of vertex defining the edge

§ getFacesContainingPoint()

QVector< FaceIterator > Mesh::getFacesContainingPoint ( int  ind)

Get a vector of faces containing point.

Parameters
indindex of point to check
Returns
QVector<int> of faces indices

§ getNeighborVertices()

QVector< int > Mesh::getNeighborVertices ( const FaceIterator f)

Return for a face, the 3 vertex of her neighbors which are not included in current face.

Parameters
f
Returns

§ isConstrainedEdge() [1/2]

bool Mesh::isConstrainedEdge ( const g_Edge e)

Check if an edge is constrained.

Parameters
eEdge to check
Returns
true if e is constrained, false else

§ isConstrainedEdge() [2/2]

bool Mesh::isConstrainedEdge ( const FaceIterator f1,
const FaceIterator f2 
)

Check if a common edge between two faces is constrained.

Parameters
f1first face to check
f2second face to check
Returns
true common edge between f1 and f2 is constrained, false else

§ isInfiniteFace() [1/2]

bool Mesh::isInfiniteFace ( const int &  i)

Check if a face is infinite.

Parameters
iindex of face to check
Returns
true if face with index i is infinite face, false else

§ isInfiniteFace() [2/2]

bool Mesh::isInfiniteFace ( const g_Face f)

Check if a face is infinite.

Parameters
fface to check
Returns
true if f is infinite face, false else

§ isWellFormed()

bool Mesh::isWellFormed ( const g_Face f,
const float &  angle = 20 
)

Check is a triangle has a "good form".

Parameters
ftriangle to check
angleminimum angle size
Returns
true if f got no angle under angle

§ load_ctri()

bool Mesh::load_ctri ( const QString &  f)

Loads a 2D cloud of points. File contains vertex coordonates and constrained edges (pair of vertex index).

Parameters
ffilename of file containing points
Returns
true if file well opened, false else

§ load_off()

void Mesh::load_off ( const QString &  f)

Load OFF formatted file.

Parameters
fOFF filemane

§ load_tri()

bool Mesh::load_tri ( const QString &  f)

Loads a 2D cloud of points. File only contains vertex coordonates.

Parameters
ffilename of file containing points
Returns
true if file well opened, false else

§ need_flip()

bool Mesh::need_flip ( const FaceIterator f1,
const FaceIterator f2 
)

Check if 2 faces need flip.

Parameters
f1
f2
Returns
true is a flip is needed between faces f1 & f2

§ radius_of_circumscribed_circle()

float Mesh::radius_of_circumscribed_circle ( const g_Face f)

Calculate the radius of circumscribed circle of a triangle.

Parameters
ftriangle to perform
Returns
radius of circumscribed circle of f

§ removeConstrainedEdge()

void Mesh::removeConstrainedEdge ( const g_Edge e)

Remove a constrained egde from triangulation.

Parameters
econstrained edge to remove

§ save_off()

void Mesh::save_off ( const QString &  filename)

Write triangulation into an OFF formatted file.

Parameters
filenamefilename of file

§ splitSeg()

void Mesh::splitSeg ( const g_Edge edge)

Split a constrained edge by adding its center to triangulation.

Parameters
edge

§ the_walking_face()

int Mesh::the_walking_face ( const QVector3D &  v)

Find the face containing a vertex by walking following line.

Parameters
vvertex to find containing face
Returns
index of face containing v, -1 if not in any face

The documentation for this class was generated from the following files: