Planar triangle mesh. ,.
More...
#include <mesh.h>
|
| Mesh2 () |
| Create an empty mesh.
|
|
| Mesh2 (const QVector< Vector2 > &, const QVector< int > &) |
| Create a mesh from a list of vertices and a indexes. More...
|
|
| Mesh2 (const Quadrangle2 &, int, int) |
| Generate a grid geometry over an input quadrangle. More...
|
|
| Mesh2 (const Box2 &, int, int) |
| Generate a grid geometry. More...
|
|
| Mesh2 (const Circle2 &, int) |
| Create an n-adic subdivision of a circle. More...
|
|
| Mesh2 (const Ellipse2 &, int) |
| Create an n-adic subdivision of an ellipse. More...
|
|
| Mesh2 (const Polygon2 &) |
| Create triangle mesh from a polygon. More...
|
|
| ~Mesh2 () |
| Empty.
|
|
Triangle2 | GetTriangle (int) const |
| Get a triangle. More...
|
|
Vector2 | Vertex (int) const |
| Get a vertex. More...
|
|
Vector2 | Vertex (int, int) const |
| Get a vertex from a specific triangle. More...
|
|
Box2 | GetBox () const |
| Compute the boudning box. More...
|
|
int | VertexSize () const |
| Get the number of vertices in the geometry. More...
|
|
int | TriangleSize () const |
| Get the number of triangles. More...
|
|
int | IndexSize () const |
| Get the size of the index array. More...
|
|
int | index (int) const |
| Get the vertex index. More...
|
|
int | index (int, int) const |
| Get a vertex/normal index according to triangle information. More...
|
|
QVector< int > | Indexes () const |
| Return the set of indexes.
|
|
QVector< int > & | Indexes () |
| Return the set of indexes.
|
|
QVector< Vector2 > | Vertices () const |
| Get the array of vertices.
|
|
QVector< int > | Valences () const |
| Compute the valence of the vertices. More...
|
|
void | Transform (const Frame2 &) |
| Transform a mesh. More...
|
|
void | Translate (const Vector2 &) |
| Translate a mesh. More...
|
|
void | Scale (const Vector2 &) |
| Translate a mesh. More...
|
|
void | Rotate (const Matrix2 &) |
| Rotate a mesh. More...
|
|
void | Draw (QGraphicsScene &, const QPen &=QPen(), bool=true) const |
| Draw the mesh. More...
|
|
|
QVector< Vector2 > | vertices |
| Vertices.
|
|
QVector< int > | indices |
| Triangle vertex indices.
|
|
◆ Mesh2() [1/6]
Mesh2::Mesh2 |
( |
const QVector< Vector2 > & |
v, |
|
|
const QVector< int > & |
i |
|
) |
| |
|
explicit |
Create a mesh from a list of vertices and a indexes.
Indices should be a multiple of three; the number of triangles is derived from the size of indices.
- See also
- Mesh2::TriangleSize
- Parameters
-
v | Set of vertices. |
i | Indexes that represent the triangles. |
◆ Mesh2() [2/6]
Mesh2::Mesh2 |
( |
const Quadrangle2 & |
quad, |
|
|
int |
nx, |
|
|
int |
ny |
|
) |
| |
|
explicit |
Generate a grid geometry over an input quadrangle.
- Parameters
-
quad | Quadrangle. |
nx,ny | Number of points in the subdivision. |
◆ Mesh2() [3/6]
Mesh2::Mesh2 |
( |
const Box2 & |
box, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
|
explicit |
Generate a grid geometry.
- Parameters
-
box | The box. |
x,y | Number of points in the subdivision. |
◆ Mesh2() [4/6]
Mesh2::Mesh2 |
( |
const Circle2 & |
circle, |
|
|
int |
n |
|
) |
| |
|
explicit |
Create an n-adic subdivision of a circle.
Creates an hexagon an applies an n-adic subdivision. The code of this function strongly relies on the more general function Polygon2::Subdivide().
- Parameters
-
circle | The circle. |
n | Subdivision level. |
◆ Mesh2() [5/6]
Mesh2::Mesh2 |
( |
const Ellipse2 & |
ellipse, |
|
|
int |
n |
|
) |
| |
|
explicit |
Create an n-adic subdivision of an ellipse.
Create a circle and apply scaling and translation.
- See also
- Mesh2::Mesh2(const Circle&, int)
This constructor is the same as the following:
mesh.Scale(ellipse.A(),ellipse.B());
mesh.Translate(ellipse.Center());
Circles.
Definition: circle.h:12
Axis aligned ellipses.
Definition: ellipse.h:107
Planar triangle mesh. ,.
Definition: mesh.h:338
Vectors in two dimensions.
Definition: evector.h:617
- Parameters
-
ellipse | The ellipse. |
n | Subdivision level. |
◆ Mesh2() [6/6]
Mesh2::Mesh2 |
( |
const Polygon2 & |
polygon | ) |
|
|
explicit |
Create triangle mesh from a polygon.
Perform a decomposition of the polygon into triangles using the ear-clipping algorithm.
- See also
- Polygon::EarClip()
- Parameters
-
◆ Delaunay()
◆ DelaunayN4()
Compute the Delaunay triangulation of a set of points in the plane.
This function return the set of index of vertices
This function is only provided as a reference: it uses a brute force approach with an O(n4) complexity.
Basically it computes all the possible triangles and checks whether they are valid by testing if some points lie inside the circumscribed circle.
- Parameters
-
- See also
- Mesh2::Delaunay
◆ Draw()
void Mesh2::Draw |
( |
QGraphicsScene & |
graphics, |
|
|
const QPen & |
pen = QPen() , |
|
|
bool |
vertexes = true |
|
) |
| const |
Draw the mesh.
- Parameters
-
graphics | Graphics scene. |
pen | Pen used for the edges and vertexes. |
vertexes | Boolean defining whether vertexes should be drawn as discs. |
◆ GetBox()
Box2 Mesh2::GetBox |
( |
| ) |
const |
Compute the boudning box.
Simply eqsuivalent as:
Axis aligned box in the plane.
Definition: box.h:371
QVector< Vector2 > Vertices() const
Get the array of vertices.
Definition: mesh.h:404
◆ GetTriangle()
Get a triangle.
- Parameters
-
- Returns
- The triangle.
◆ index() [1/2]
int Mesh2::index |
( |
int |
i | ) |
const |
|
inline |
Get the vertex index.
- Parameters
-
i | The number in indices of the wanted vertex. |
- Returns
- The index of the wanted vertex.
◆ index() [2/2]
int Mesh2::index |
( |
int |
t, |
|
|
int |
v |
|
) |
| const |
|
inline |
Get a vertex/normal index according to triangle information.
- Parameters
-
t | The triangle number. |
v | The triangle vertex index. |
- Returns
- The index of the wanted vertex.
◆ IndexSize()
int Mesh2::IndexSize |
( |
| ) |
const |
|
inline |
◆ Rotate()
void Mesh2::Rotate |
( |
const Matrix2 & |
r | ) |
|
Rotate a mesh.
- Parameters
-
◆ Scale()
void Mesh2::Scale |
( |
const Vector2 & |
s | ) |
|
Translate a mesh.
- Parameters
-
◆ Transform()
void Mesh2::Transform |
( |
const Frame2 & |
f | ) |
|
Transform a mesh.
- Parameters
-
◆ Translate()
void Mesh2::Translate |
( |
const Vector2 & |
t | ) |
|
Translate a mesh.
- Parameters
-
◆ TriangleSize()
int Mesh2::TriangleSize |
( |
| ) |
const |
|
inline |
Get the number of triangles.
This is the size of the array of indexes divided by three.
- Returns
- The effective number of triangle in the geometry.
◆ Valences()
QVector< int > Mesh2::Valences |
( |
| ) |
const |
Compute the valence of the vertices.
- Returns
- A vector with the computed valences.
◆ Vertex() [1/2]
Vector2 Mesh2::Vertex |
( |
int |
i | ) |
const |
|
inline |
Get a vertex.
- Parameters
-
i | The index of the wanted vertex. |
- Returns
- The wanted vertex (as a 3D Vector).
◆ Vertex() [2/2]
Vector2 Mesh2::Vertex |
( |
int |
t, |
|
|
int |
v |
|
) |
| const |
|
inline |
Get a vertex from a specific triangle.
- Parameters
-
t | The number of the triangle that contains the wanted vertex. |
v | The triangle vertex: 0, 1, or 2. |
- Returns
- The wanted vertex.
◆ VertexSize()
int Mesh2::VertexSize |
( |
| ) |
const |
|
inline |
Get the number of vertices in the geometry.
- Returns
- The number of vertices in the geometry, in other words the size of vertices.