Added helper function to returning a list of all the unique edges of a mesh
This commit is contained in:
parent
d236258507
commit
1f992d7929
|
@ -160,9 +160,12 @@ inline bool operator == ( const PEdge & pe ) const
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fill a vector with all the edges of the mesh.
|
||||||
|
// each edge is stored in the vector the number of times that it appears in the mesh, with the referring face.
|
||||||
|
|
||||||
static void FillEdgeVector(MeshType &m, std::vector<PEdge> &e)
|
static void FillEdgeVector(MeshType &m, std::vector<PEdge> &e)
|
||||||
{
|
{
|
||||||
FaceIterator pf;
|
FaceIterator pf;
|
||||||
typename std::vector<PEdge>::iterator p;
|
typename std::vector<PEdge>::iterator p;
|
||||||
|
|
||||||
// Alloco il vettore ausiliario
|
// Alloco il vettore ausiliario
|
||||||
|
@ -183,6 +186,17 @@ static void FillEdgeVector(MeshType &m, std::vector<PEdge> &e)
|
||||||
assert(p==e.end());
|
assert(p==e.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FillUniqueEdgeVector(MeshType &m, std::vector<PEdge> &Edges)
|
||||||
|
{
|
||||||
|
FillEdgeVector(m,Edges);
|
||||||
|
sort(Edges.begin(), Edges.end()); // Lo ordino per vertici
|
||||||
|
|
||||||
|
typename std::vector< PEdge>::iterator newEnd = std::unique(Edges.begin(), Edges.end());
|
||||||
|
typename std::vector<PEdge>::iterator ei;
|
||||||
|
|
||||||
|
Edges.resize(newEnd-Edges.begin());
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges.
|
/// \brief Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges.
|
||||||
static void FaceFace(MeshType &m)
|
static void FaceFace(MeshType &m)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue