![]() |
TopoMesh
Topological mesh, triangulations and operations
|
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< FaceIterator > | getFacesContainingPoint (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_Point > | getVertices () |
Get list of vertices. | |
QVector< g_Face > | getFaces () |
Get list of faces. | |
Protected Attributes | |
QVector< g_Point > | vertices |
List of vertices. | |
QVector< g_Face > | faces |
List of faces, vertex index triplet. | |
QVector< t_Face > | topology |
Topology of each face, topology[ii][jj] define the neighbor of face ii which is in front of vertex jj. | |
QVector< g_Point > | voronoi_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. | |
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.
v | vertex to add |
f | face to add in |
void Mesh::add_point_in_face_naive | ( | const int & | v, |
const int & | f | ||
) |
Add a point in a triangle which already is in triangulation.
v | vertex to add |
f | face to add in |
void Mesh::add_vertex_inc | ( | const g_Point & | v | ) |
Add a vertex into triangulation, keeping the triangulation as Delaunay.
v | vertex to add |
void Mesh::add_vertex_inc | ( | const int & | ind_vertex | ) |
Add a vertex into triangulation, keeping the triangulation as Delaunay.
ind_vertex | index of vertex to add |
void Mesh::add_vertex_naive | ( | const g_Point & | v | ) |
Add a vertex to triangulation.
v | vertex to add |
void Mesh::add_vertex_naive | ( | const int & | ind_vertex | ) |
Add a vertex to triangulation.
ind_vertex | index of vertex to add |
int Mesh::add_voronoi_centers | ( | ) |
Add Voronoi center of each face to triangulation.
Calculate the center of circumscribed circle of a triangle.
f | triangle to perform |
r | in/out parameter, ray of circle |
Calculate the center of circumscribed circle of a triangle.
f | triangle to perform |
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.
a | First point of a triangle |
b | First point of a triangle |
c | First point of a triangle |
r | in/out parameter, ray of circle |
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.
a | first point of triangle |
b | second point of triangle |
c | third point of triangle |
Calculate the center of gravity of a triangle.
a | First point of a triangle |
b | First point of a triangle |
c | First point of a triangle |
Calculate the center of gravity of a triangle.
f | Face to check |
bool Mesh::contains | ( | int | triangle, |
const QVector3D & | point | ||
) |
Check if a vertex is in a triangle of the triangulation.
triangle | face to check |
vertex | vertex to check |
bool Mesh::contains | ( | int | triangle, |
int | point | ||
) |
Check if a vertex is in a triangle of the triangulation.
triangle | face to check |
point | index of vertex to check |
void Mesh::flip | ( | const FaceIterator & | f1, |
const FaceIterator & | f2 | ||
) |
Performs a Lawson flip between 2 faces.
f1 | |
f2 |
void Mesh::full_flip | ( | const QVector< QVector< FaceIterator >> & | to_flip | ) |
Perform flips on an edge vector, keeping the triangulation as Delaunay.
to_flip | vector of edges to flip |
Mesh::g_Edge Mesh::getCommonEdge | ( | const FaceIterator & | f1, |
const FaceIterator & | f2 | ||
) |
Get common edge between 2 linked faces.
f1 | first face |
f2 | second face |
QVector< FaceIterator > Mesh::getFacesContainingPoint | ( | int | ind | ) |
Get a vector of faces containing point.
ind | index of point to check |
QVector< int > Mesh::getNeighborVertices | ( | const FaceIterator & | f | ) |
Return for a face, the 3 vertex of her neighbors which are not included in current face.
f |
bool Mesh::isConstrainedEdge | ( | const g_Edge & | e | ) |
Check if an edge is constrained.
e | Edge to check |
bool Mesh::isConstrainedEdge | ( | const FaceIterator & | f1, |
const FaceIterator & | f2 | ||
) |
Check if a common edge between two faces is constrained.
f1 | first face to check |
f2 | second face to check |
bool Mesh::isInfiniteFace | ( | const int & | i | ) |
Check if a face is infinite.
i | index of face to check |
bool Mesh::isInfiniteFace | ( | const g_Face & | f | ) |
Check if a face is infinite.
f | face to check |
bool Mesh::isWellFormed | ( | const g_Face & | f, |
const float & | angle = 20 |
||
) |
Check is a triangle has a "good form".
f | triangle to check |
angle | minimum angle size |
bool Mesh::load_ctri | ( | const QString & | f | ) |
Loads a 2D cloud of points. File contains vertex coordonates and constrained edges (pair of vertex index).
f | filename of file containing points |
void Mesh::load_off | ( | const QString & | f | ) |
Load OFF formatted file.
f | OFF filemane |
bool Mesh::load_tri | ( | const QString & | f | ) |
Loads a 2D cloud of points. File only contains vertex coordonates.
f | filename of file containing points |
bool Mesh::need_flip | ( | const FaceIterator & | f1, |
const FaceIterator & | f2 | ||
) |
Check if 2 faces need flip.
f1 | |
f2 |
float Mesh::radius_of_circumscribed_circle | ( | const g_Face & | f | ) |
Calculate the radius of circumscribed circle of a triangle.
f | triangle to perform |
void Mesh::removeConstrainedEdge | ( | const g_Edge & | e | ) |
Remove a constrained egde from triangulation.
e | constrained edge to remove |
void Mesh::save_off | ( | const QString & | filename | ) |
Write triangulation into an OFF formatted file.
filename | filename of file |
void Mesh::splitSeg | ( | const g_Edge & | edge | ) |
Split a constrained edge by adding its center to triangulation.
edge |
int Mesh::the_walking_face | ( | const QVector3D & | v | ) |
Find the face containing a vertex by walking following line.
v | vertex to find containing face |